1MatrixXf mat(2,2);
2mat << 1, 2,  4, 7;
3cout << "Here is the matrix mat:\n" << mat << endl << endl;
4
5mat = 2 * mat;
6cout << "After 'mat = 2 * mat', mat = \n" << mat << endl << endl;
7
8
9mat = mat - MatrixXf::Identity(2,2);
10cout << "After the subtraction, it becomes\n" << mat << endl << endl;
11
12
13ArrayXXf arr = mat;
14arr = arr.square();
15cout << "After squaring, it becomes\n" << arr << endl << endl;
16
17// Combining all operations in one statement:
18mat << 1, 2,  4, 7;
19mat = (2 * mat - MatrixXf::Identity(2,2)).array().square();
20cout << "Doing everything at once yields\n" << mat << endl << endl;
21