From 4338834e33d3bb1168d4257ba59bb714dd91e4d3 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 25 Jun 2010 10:04:35 -0400 Subject: add tutorial page 1 - the Matrix class + 3 examples --- doc/examples/tut_matrix_resize.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 doc/examples/tut_matrix_resize.cpp (limited to 'doc/examples/tut_matrix_resize.cpp') diff --git a/doc/examples/tut_matrix_resize.cpp b/doc/examples/tut_matrix_resize.cpp new file mode 100644 index 000000000..0392c3aa5 --- /dev/null +++ b/doc/examples/tut_matrix_resize.cpp @@ -0,0 +1,18 @@ +#include +#include + +using namespace Eigen; + +int main() +{ + MatrixXd m(2,5); + m.resize(4,3); + std::cout << "The matrix m is of size " + << m.rows() << "x" << m.cols() << std::endl; + std::cout << "It has " << m.size() << " coefficients" << std::endl; + VectorXd v(2); + v.resize(5); + std::cout << "The vector v is of size " << v.size() << std::endl; + std::cout << "As a matrix, v is of size " + << v.rows() << "x" << v.cols() << std::endl; +} -- cgit v1.2.3