TopicAliasing_cwise.cpp
Go to the documentation of this file.
00001 MatrixXf mat(2,2); 
00002 mat << 1, 2,  4, 7;
00003 cout << "Here is the matrix mat:\n" << mat << endl << endl;
00004 
00005 mat = 2 * mat;
00006 cout << "After 'mat = 2 * mat', mat = \n" << mat << endl << endl;
00007 
00008 
00009 mat = mat - MatrixXf::Identity(2,2);
00010 cout << "After the subtraction, it becomes\n" << mat << endl << endl;
00011 
00012 
00013 ArrayXXf arr = mat;
00014 arr = arr.square();
00015 cout << "After squaring, it becomes\n" << arr << endl << endl;
00016 
00017 // Combining all operations in one statement:
00018 mat << 1, 2,  4, 7;
00019 mat = (2 * mat - MatrixXf::Identity(2,2)).array().square();
00020 cout << "Doing everything at once yields\n" << mat << endl << endl;


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:33:08