source: pacpussensors/trunk/Vislab/lib3dv/eigen/doc/snippets/Tutorial_AdvancedInitialization_ThreeWays.cpp@ 136

Last change on this file since 136 was 136, checked in by ldecherf, 7 years ago

Doc

File size: 878 bytes
Line 
1const int size = 6;
2MatrixXd mat1(size, size);
3mat1.topLeftCorner(size/2, size/2) = MatrixXd::Zero(size/2, size/2);
4mat1.topRightCorner(size/2, size/2) = MatrixXd::Identity(size/2, size/2);
5mat1.bottomLeftCorner(size/2, size/2) = MatrixXd::Identity(size/2, size/2);
6mat1.bottomRightCorner(size/2, size/2) = MatrixXd::Zero(size/2, size/2);
7std::cout << mat1 << std::endl << std::endl;
8
9MatrixXd mat2(size, size);
10mat2.topLeftCorner(size/2, size/2).setZero();
11mat2.topRightCorner(size/2, size/2).setIdentity();
12mat2.bottomLeftCorner(size/2, size/2).setIdentity();
13mat2.bottomRightCorner(size/2, size/2).setZero();
14std::cout << mat2 << std::endl << std::endl;
15
16MatrixXd mat3(size, size);
17mat3 << MatrixXd::Zero(size/2, size/2), MatrixXd::Identity(size/2, size/2),
18 MatrixXd::Identity(size/2, size/2), MatrixXd::Zero(size/2, size/2);
19std::cout << mat3 << std::endl;
20
Note: See TracBrowser for help on using the repository browser.