diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-08-04 21:42:32 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-08-04 21:42:32 -0400 |
commit | 976d7c19e82d2b25640e8b7a95376ac09041ab80 (patch) | |
tree | e63a4b93da81e91da2d06153b5bf2a25a991cdfb /doc/examples | |
parent | 5c7cb3c05cc2138fcab78a8e402ee93aaef6e600 (diff) |
some small improvements to the page on functions taking eigen objects.
- make the beginning more precise
- make the first example be a full selfcontained compiled example, no need for all the others, but having the first one doesn't hurt.
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/function_taking_eigenbase.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/examples/function_taking_eigenbase.cpp b/doc/examples/function_taking_eigenbase.cpp new file mode 100644 index 000000000..49d94b3d6 --- /dev/null +++ b/doc/examples/function_taking_eigenbase.cpp @@ -0,0 +1,18 @@ +#include <iostream> +#include <Eigen/Core> +using namespace Eigen; + +template <typename Derived> +void print_size(const EigenBase<Derived>& b) +{ + std::cout << "size (rows, cols): " << b.size() << " (" << b.rows() + << ", " << b.cols() << ")" << std::endl; +} + +int main() +{ + Vector3f v; + print_size(v); + // v.asDiagonal() returns a 3x3 diagonal matrix pseudo-expression + print_size(v.asDiagonal()); +} |