You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
9 lines
614 B
9 lines
614 B
MatrixXf m = MatrixXf::Random(3,2);
|
|
cout << "Here is the matrix m:" << endl << m << endl;
|
|
JacobiSVD<MatrixXf> svd(m, ComputeThinU | ComputeThinV);
|
|
cout << "Its singular values are:" << endl << svd.singularValues() << endl;
|
|
cout << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU() << endl;
|
|
cout << "Its right singular vectors are the columns of the thin V matrix:" << endl << svd.matrixV() << endl;
|
|
Vector3f rhs(1, 0, 0);
|
|
cout << "Now consider this rhs vector:" << endl << rhs << endl;
|
|
cout << "A least-squares solution of m*x = rhs is:" << endl << svd.solve(rhs) << endl;
|