From 44861dcbfeee041223c4aac1ee075e92fa4daa01 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Sep 2016 12:42:15 +0200 Subject: update --- eigen/doc/snippets/PartialPivLU_solve.cpp | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 eigen/doc/snippets/PartialPivLU_solve.cpp (limited to 'eigen/doc/snippets/PartialPivLU_solve.cpp') diff --git a/eigen/doc/snippets/PartialPivLU_solve.cpp b/eigen/doc/snippets/PartialPivLU_solve.cpp new file mode 100644 index 0000000..fa3570a --- /dev/null +++ b/eigen/doc/snippets/PartialPivLU_solve.cpp @@ -0,0 +1,7 @@ +MatrixXd A = MatrixXd::Random(3,3); +MatrixXd B = MatrixXd::Random(3,2); +cout << "Here is the invertible matrix A:" << endl << A << endl; +cout << "Here is the matrix B:" << endl << B << endl; +MatrixXd X = A.lu().solve(B); +cout << "Here is the (unique) solution X to the equation AX=B:" << endl << X << endl; +cout << "Relative error: " << (A*X-B).norm() / B.norm() << endl; -- cgit v1.2.3