compile_TopicAliasing_cwise.cpp
Go to the documentation of this file.
00001 #include <Eigen/Core>
00002 #include <Eigen/LU>
00003 #include <Eigen/QR>
00004 #include <Eigen/Cholesky>
00005 #include <Eigen/Geometry>
00006 #include <Eigen/Jacobi>
00007 #include <Eigen/Eigenvalues>
00008 #include <iostream>
00009 
00010 using namespace Eigen;
00011 using namespace std;
00012 
00013 int main(int, char**)
00014 {
00015   cout.precision(3);
00016   MatrixXf mat(2,2); 
00017 mat << 1, 2,  4, 7;
00018 cout << "Here is the matrix mat:\n" << mat << endl << endl;
00019 
00020 mat = 2 * mat;
00021 cout << "After 'mat = 2 * mat', mat = \n" << mat << endl << endl;
00022 
00023 
00024 mat = mat - MatrixXf::Identity(2,2);
00025 cout << "After the subtraction, it becomes\n" << mat << endl << endl;
00026 
00027 
00028 ArrayXXf arr = mat;
00029 arr = arr.square();
00030 cout << "After squaring, it becomes\n" << arr << endl << endl;
00031 
00032 // Combining all operations in one statement:
00033 mat << 1, 2,  4, 7;
00034 mat = (2 * mat - MatrixXf::Identity(2,2)).array().square();
00035 cout << "Doing everything at once yields\n" << mat << endl << endl;
00036 
00037   return 0;
00038 }


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