diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-10-15 09:44:43 -0400 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2010-10-15 09:44:43 -0400 |
commit | 26129229ec12961687b0414c40e10e2880beec79 (patch) | |
tree | ad65b5a51cd493c96563462bd668744e55fa7f04 /doc/examples | |
parent | fcee1903be17a07fa07019d21162a8d5797dc6a9 (diff) |
doc updates/improvements
Diffstat (limited to 'doc/examples')
-rw-r--r-- | doc/examples/TutorialLinAlgSVDSolve.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/examples/TutorialLinAlgSVDSolve.cpp b/doc/examples/TutorialLinAlgSVDSolve.cpp new file mode 100644 index 000000000..c75779d5f --- /dev/null +++ b/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; + JacobiSVD<MatrixXf> svd(A, ComputeThinU | ComputeThinV); + cout << "The least-squares solution is:\n" << svd.solve(b) << endl; +} |