aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-10-26 14:37:43 -0400
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-10-26 14:37:43 -0400
commit1f1c04cac1d8a87cbb34741d141df646b2da2827 (patch)
treec4a6c6dbac0f6d0cf337c778f2d03849883c0028 /doc
parent44cdbaba4d084b31854ed5bec58f2887f0479b81 (diff)
sync the documentation examples
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/Tutorial_PartialLU_solve.cpp3
-rw-r--r--doc/snippets/MatrixBase_computeInverse.cpp5
-rw-r--r--doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp13
-rw-r--r--doc/snippets/MatrixBase_computeInverseWithCheck.cpp8
-rw-r--r--doc/snippets/PartialLU_solve.cpp3
-rw-r--r--doc/snippets/Tutorial_solve_multiple_rhs.cpp2
-rw-r--r--doc/snippets/Tutorial_solve_reuse_decomposition.cpp4
-rw-r--r--doc/snippets/Tutorial_solve_singular.cpp2
8 files changed, 24 insertions, 16 deletions
diff --git a/doc/examples/Tutorial_PartialLU_solve.cpp b/doc/examples/Tutorial_PartialLU_solve.cpp
index 80c393f9a..4cbd8c10d 100644
--- a/doc/examples/Tutorial_PartialLU_solve.cpp
+++ b/doc/examples/Tutorial_PartialLU_solve.cpp
@@ -12,7 +12,6 @@ int main(int, char *[])
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
- Vector3f x;
- A.partialLu().solve(b, &x);
+ Vector3f x = A.partialLu().solve(b);
cout << "The solution is:" << endl << x << endl;
}
diff --git a/doc/snippets/MatrixBase_computeInverse.cpp b/doc/snippets/MatrixBase_computeInverse.cpp
deleted file mode 100644
index ba7377a4a..000000000
--- a/doc/snippets/MatrixBase_computeInverse.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-Matrix3d m = Matrix3d::Random();
-cout << "Here is the matrix m:" << endl << m << endl;
-Matrix3d inv;
-m.computeInverse(&inv);
-cout << "Its inverse is:" << endl << inv << endl;
diff --git a/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp b/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp
new file mode 100644
index 000000000..a7b084fd0
--- /dev/null
+++ b/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp
@@ -0,0 +1,13 @@
+Matrix3d m = Matrix3d::Random();
+cout << "Here is the matrix m:" << endl << m << endl;
+Matrix3d inverse;
+bool invertible;
+double determinant;
+m.computeInverseAndDetWithCheck(inverse,determinant,invertible);
+cout << "Its determinant is " << determinant << endl;
+if(invertible) {
+ cout << "It is invertible, and its inverse is:" << endl << inverse << endl;
+}
+else {
+ cout << "It is not invertible." << endl;
+}
diff --git a/doc/snippets/MatrixBase_computeInverseWithCheck.cpp b/doc/snippets/MatrixBase_computeInverseWithCheck.cpp
index 19e24c90b..873a9f870 100644
--- a/doc/snippets/MatrixBase_computeInverseWithCheck.cpp
+++ b/doc/snippets/MatrixBase_computeInverseWithCheck.cpp
@@ -1,8 +1,10 @@
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
-Matrix3d inv;
-if(m.computeInverseWithCheck(&inv)) {
- cout << "It is invertible, and its inverse is:" << endl << inv << endl;
+Matrix3d inverse;
+bool invertible;
+m.computeInverseWithCheck(inverse,invertible);
+if(invertible) {
+ cout << "It is invertible, and its inverse is:" << endl << inverse << endl;
}
else {
cout << "It is not invertible." << endl;
diff --git a/doc/snippets/PartialLU_solve.cpp b/doc/snippets/PartialLU_solve.cpp
index d9ccbe9f0..69e788dc4 100644
--- a/doc/snippets/PartialLU_solve.cpp
+++ b/doc/snippets/PartialLU_solve.cpp
@@ -2,7 +2,6 @@ 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.partialLu().solve(B, &X);
+MatrixXd X = A.partialLu().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;
diff --git a/doc/snippets/Tutorial_solve_multiple_rhs.cpp b/doc/snippets/Tutorial_solve_multiple_rhs.cpp
index fbb15165a..1ffcc61f0 100644
--- a/doc/snippets/Tutorial_solve_multiple_rhs.cpp
+++ b/doc/snippets/Tutorial_solve_multiple_rhs.cpp
@@ -3,7 +3,7 @@ A << 1,2,3, 4,5,6, 7,8,10;
Matrix<float,3,2> B;
B << 3,1, 3,1, 4,1;
Matrix<float,3,2> X;
-A.partialLu().solve(B, &X);
+X = A.partialLu().solve(B);
cout << "The solution with right-hand side (3,3,4) is:" << endl;
cout << X.col(0) << endl;
cout << "The solution with right-hand side (1,1,1) is:" << endl;
diff --git a/doc/snippets/Tutorial_solve_reuse_decomposition.cpp b/doc/snippets/Tutorial_solve_reuse_decomposition.cpp
index b4112adc4..1b8b0ae9e 100644
--- a/doc/snippets/Tutorial_solve_reuse_decomposition.cpp
+++ b/doc/snippets/Tutorial_solve_reuse_decomposition.cpp
@@ -4,10 +4,10 @@ PartialLU<Matrix3f> luOfA(A); // compute LU decomposition of A
Vector3f b;
b << 3,3,4;
Vector3f x;
-luOfA.solve(b, &x);
+x = luOfA.solve(b);
cout << "The solution with right-hand side (3,3,4) is:" << endl;
cout << x << endl;
b << 1,1,1;
-luOfA.solve(b, &x);
+x = luOfA.solve(b);
cout << "The solution with right-hand side (1,1,1) is:" << endl;
cout << x << endl;
diff --git a/doc/snippets/Tutorial_solve_singular.cpp b/doc/snippets/Tutorial_solve_singular.cpp
index da94ad445..f5f2d2f6a 100644
--- a/doc/snippets/Tutorial_solve_singular.cpp
+++ b/doc/snippets/Tutorial_solve_singular.cpp
@@ -5,5 +5,5 @@ b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vector3f x;
-A.partialLu().solve(b, &x);
+x = A.partialLu().solve(b);
cout << "The solution is:" << endl << x << endl;