From 03ad303d1417e53b8bcec8dd8d8e404cd4e13af4 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Wed, 24 Jun 2009 22:07:03 +0200 Subject: * add resize(int, NoChange) and resize(NoChange, int) * add missing assert in resize(int) * add examples for all resize variants * expand docs (part of which is from Tim Hutt's e-mail) --- doc/snippets/Matrix_resize_int_int.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 doc/snippets/Matrix_resize_int_int.cpp (limited to 'doc/snippets/Matrix_resize_int_int.cpp') diff --git a/doc/snippets/Matrix_resize_int_int.cpp b/doc/snippets/Matrix_resize_int_int.cpp new file mode 100644 index 000000000..bfd474159 --- /dev/null +++ b/doc/snippets/Matrix_resize_int_int.cpp @@ -0,0 +1,9 @@ +MatrixXd m(2,3); +m << 1,2,3,4,5,6; +cout << "here's the 2x3 matrix m:" << endl << m << endl; +cout << "let's resize m to 3x2. This is a conservative resizing because 2*3==3*2." << endl; +m.resize(3,2); +cout << "here's the 3x2 matrix m:" << endl << m << endl; +cout << "now let's resize m to size 2x2. This is NOT a conservative resizing, so it becomes uninitialized:" << endl; +m.resize(2,2); +cout << m << endl; -- cgit v1.2.3