diff options
Diffstat (limited to 'eigen/doc/examples/TutorialLinAlgSVDSolve.cpp')
-rw-r--r-- | eigen/doc/examples/TutorialLinAlgSVDSolve.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/eigen/doc/examples/TutorialLinAlgSVDSolve.cpp b/eigen/doc/examples/TutorialLinAlgSVDSolve.cpp new file mode 100644 index 0000000..9fbc031 --- /dev/null +++ b/eigen/doc/examples/TutorialLinAlgSVDSolve.cpp @@ -0,0 +1,15 @@ +#include <iostream> +#include <Eigen/Dense> + +using namespace std; +using namespace Eigen; + +int main() +{ + 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.jacobiSvd(ComputeThinU | ComputeThinV).solve(b) << endl; +} |