1c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan KamathMatrixXf m = MatrixXf::Random(3,2);
2c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathcout << "Here is the matrix m:" << endl << m << endl;
3c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan KamathJacobiSVD<MatrixXf> svd(m, ComputeThinU | ComputeThinV);
4c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathcout << "Its singular values are:" << endl << svd.singularValues() << endl;
5c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathcout << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU() << endl;
6c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathcout << "Its right singular vectors are the columns of the thin V matrix:" << endl << svd.matrixV() << endl;
7c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan KamathVector3f rhs(1, 0, 0);
8c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathcout << "Now consider this rhs vector:" << endl << rhs << endl;
9c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathcout << "A least-squares solution of m*x = rhs is:" << endl << svd.solve(rhs) << endl;
10