Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
4f8a9397
Commit
4f8a9397
authored
Jan 11, 2014
by
Davis King
Browse files
clarified example
parent
627a5c4a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
examples/matrix_ex.cpp
examples/matrix_ex.cpp
+9
-9
No files found.
examples/matrix_ex.cpp
View file @
4f8a9397
...
...
@@ -43,19 +43,19 @@ int main()
// You may be wondering why someone would want to specify the size of a
// matrix at compile time when you don't have to. The reason is two fold.
// First, there is often a substantial performance improvement, especially
// for small matrices, because
the compiler is able to perform loop
//
unrolling if it knows the sizes of matrices
. Second, the dlib::matrix
//
object checks
these compile time sizes to ensure that the matrices are
//
being used
correctly. For example, if you attempt to compile the
//
expression y*y you
will get a compiler error since that is not a legal
// matrix
operation (the matrix
dimensions don't make sense as a matrix
//
multiplication). So if
you know the size of a matrix at compile time
//
then it is always a good
idea to let the compiler know about it.
// for small matrices, because
it enables a number of optimizations that
//
otherwise would be impossible
. Second, the dlib::matrix
object checks
// these compile time sizes to ensure that the matrices are
being used
// correctly. For example, if you attempt to compile the
expression y*y you
// will get a compiler error since that is not a legal
matrix operation (the
// matrix dimensions don't make sense as a matrix
multiplication). So if
// you know the size of a matrix at compile time
then it is always a good
// idea to let the compiler know about it.
//
n
ow we need to initialize the y and M matrices and we can do so like this:
//
N
ow we need to initialize the y and M matrices and we can do so like this:
M
=
54.2
,
7.4
,
12.1
,
1
,
2
,
3
,
5.9
,
0.05
,
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment