Update SVD Module with Options template parameter

This commit is contained in:
Arthur
2022-02-02 00:15:44 +00:00
committed by Rasmus Munk Larsen
parent 89c6ab2385
commit 18b50458b6
24 changed files with 1112 additions and 815 deletions

View File

@@ -101,8 +101,8 @@ m1.colPivHouseholderQr();
?geqp3
\endcode</td></tr>
<tr class="alt"><td>Singular value decomposition \n \c EIGEN_USE_LAPACKE </td><td>\code
JacobiSVD<MatrixXd> svd;
svd.compute(m1, ComputeThinV);
JacobiSVD<MatrixXd, ComputeThinV> svd;
svd.compute(m1);
\endcode</td><td>\code
?gesvd
\endcode</td></tr>

View File

@@ -3,10 +3,10 @@
int main()
{
Eigen::MatrixXf A = Eigen::MatrixXf::Random(3, 2);
std::cout << "Here is the matrix A:\n" << A << std::endl;
Eigen::VectorXf b = Eigen::VectorXf::Random(3);
std::cout << "Here is the right hand side b:\n" << b << std::endl;
std::cout << "The least-squares solution is:\n"
<< A.bdcSvd(Eigen::ComputeThinU | Eigen::ComputeThinV).solve(b) << std::endl;
MatrixXf A = MatrixXf::Random(3, 2);
cout << "Here is the matrix A:\n" << A << endl;
VectorXf b = VectorXf::Random(3);
cout << "Here is the right hand side b:\n" << b << endl;
cout << "The least-squares solution is:\n"
<< A.template bdcSvd<ComputeThinU | ComputeThinV>().solve(b) << endl;
}

View File

@@ -1,6 +1,6 @@
MatrixXf m = MatrixXf::Random(3,2);
cout << "Here is the matrix m:" << endl << m << endl;
JacobiSVD<MatrixXf> svd(m, ComputeThinU | ComputeThinV);
JacobiSVD<MatrixXf, ComputeThinU | ComputeThinV> svd(m);
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;