source: pacpussensors/trunk/Vislab/lib3dv-1.2.0/lib3dv/eigen/doc/snippets/JacobiSVD_basic.cpp

Last change on this file was 136, checked in by ldecherf, 8 years ago

Doc

File size: 614 bytes
Line 
1MatrixXf m = MatrixXf::Random(3,2);
2cout << "Here is the matrix m:" << endl << m << endl;
3JacobiSVD<MatrixXf> svd(m, ComputeThinU | ComputeThinV);
4cout << "Its singular values are:" << endl << svd.singularValues() << endl;
5cout << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU() << endl;
6cout << "Its right singular vectors are the columns of the thin V matrix:" << endl << svd.matrixV() << endl;
7Vector3f rhs(1, 0, 0);
8cout << "Now consider this rhs vector:" << endl << rhs << endl;
9cout << "A least-squares solution of m*x = rhs is:" << endl << svd.solve(rhs) << endl;
Note: See TracBrowser for help on using the repository browser.