diff options
author | Gael Guennebaud <g.gael@free.fr> | 2008-08-24 19:14:20 +0000 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2008-08-24 19:14:20 +0000 |
commit | 854d6e8458a379e1583f6e2c835263ca5bdb19a5 (patch) | |
tree | 0f17fe963f333f752d77af7edd3fb21aaacc108e /doc/examples | |
parent | 251ecc0ab9ee7bf923c5212ab93bdf02dc8156d7 (diff) |
Documentation: fill the placeholders, add a custom CSS file,
add a reference to the tutorial in the main page.
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/Tutorial_simple_example_dynamic_size.cpp | 22 | ||||
-rw-r--r-- | doc/examples/Tutorial_simple_example_fixed_size.cpp | 14 |
2 files changed, 36 insertions, 0 deletions
diff --git a/doc/examples/Tutorial_simple_example_dynamic_size.cpp b/doc/examples/Tutorial_simple_example_dynamic_size.cpp new file mode 100644 index 000000000..93486e6a0 --- /dev/null +++ b/doc/examples/Tutorial_simple_example_dynamic_size.cpp @@ -0,0 +1,22 @@ +#include <Eigen/Core> + +// import most common Eigen's types +USING_PART_OF_NAMESPACE_EIGEN + +int main(int argc, char *argv[]) +{ + for (int size=1; size<=4; ++size) + { + MatrixXi m(size,size+1); // creates a size x (size+1) matrix of int + for (int j=0; j<m.cols(); ++j) // loop over the columns + for (int i=0; i<m.rows(); ++i) // loop over the rows + m(i,j) = i+j*m.rows(); // to access matrix elements use operator (int,int) + std::cout << m << "\n\n"; + } + + VectorXf v4(4); + // to access vector elements + // you can use either operator () or operator [] + v4[0] = 1; v4[1] = 2; v4(2) = 3; v4(3) = 4; + std::cout << "\nv4:\n" << v4 << std::endl; +} diff --git a/doc/examples/Tutorial_simple_example_fixed_size.cpp b/doc/examples/Tutorial_simple_example_fixed_size.cpp new file mode 100644 index 000000000..e3691d83a --- /dev/null +++ b/doc/examples/Tutorial_simple_example_fixed_size.cpp @@ -0,0 +1,14 @@ +#include <Eigen/Core> + +// import most common Eigen's types +USING_PART_OF_NAMESPACE_EIGEN + +int main(int argc, char *argv[]) +{ + Matrix3f m3; + m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9; + Matrix4f m4 = Matrix4f::Identity(); + Vector4i v4(1, 2, 3, 4); + + std::cout << "m3\n" << m3 << "\nm4:\n" << m4 << "\nv4:\n" << v4 << std::endl; +}
\ No newline at end of file |