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 Matrix2f M = Matrix2f::Random();
00017 Matrix2f m;
00018 m = M;
00019 cout << "Here is the matrix m:" << endl << m << endl;
00020 cout << "Now we want to copy a column into a row." << endl;
00021 cout << "If we do m.col(1) = m.row(0), then m becomes:" << endl;
00022 m.col(1) = m.row(0);
00023 cout << m << endl << "which is wrong!" << endl;
00024 cout << "Now let us instead do m.col(1) = m.row(0).eval(). Then m becomes" << endl;
00025 m = M;
00026 m.col(1) = m.row(0).eval();
00027 cout << m << endl << "which is right." << endl;
00028
00029 return 0;
00030 }