COSC-4P80-Assignment-2/lib/eigen-3.4.0/doc/snippets/TopicAliasing_block.cpp

8 lines
267 B
C++
Raw Normal View History

2024-10-21 16:42:03 -04:00
MatrixXi mat(3,3);
mat << 1, 2, 3, 4, 5, 6, 7, 8, 9;
cout << "Here is the matrix mat:\n" << mat << endl;
// This assignment shows the aliasing problem
mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2);
cout << "After the assignment, mat = \n" << mat << endl;