TopicAliasing_cwise.cpp
Go to the documentation of this file.
1 MatrixXf mat(2,2);
2 mat << 1, 2, 4, 7;
3 cout << "Here is the matrix mat:\n" << mat << endl << endl;
4 
5 mat = 2 * mat;
6 cout << "After 'mat = 2 * mat', mat = \n" << mat << endl << endl;
7 
8 
9 mat = mat - MatrixXf::Identity(2,2);
10 cout << "After the subtraction, it becomes\n" << mat << endl << endl;
11 
12 
13 ArrayXXf arr = mat;
14 arr = arr.square();
15 cout << "After squaring, it becomes\n" << arr << endl << endl;
16 
17 // Combining all operations in one statement:
18 mat << 1, 2, 4, 7;
19 mat = (2 * mat - MatrixXf::Identity(2,2)).array().square();
20 cout << "Doing everything at once yields\n" << mat << endl << endl;
array
int array[24]
Definition: Map_general_stride.cpp:1
arr
py::array arr
Definition: test_numpy_array.cpp:77
mat
MatrixXf mat(2, 2)


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:09:14