aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/LLT_solve.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2008-10-13 15:53:27 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2008-10-13 15:53:27 +0000
commit765219aa5180c40be86a380524db691a0fd5861b (patch)
treeb3d2cab1eb2c43780a8da9a2e418e1adfd0e7cc3 /doc/snippets/LLT_solve.cpp
parente2bd8623f88c3e7aa1c4a2eaa5dc7ab351219a33 (diff)
Big API change in Cholesky module:
* rename Cholesky to LLT * rename CholeskyWithoutSquareRoot to LDLT * rename MatrixBase::cholesky() to llt() * rename MatrixBase::choleskyNoSqrt() to ldlt() * make {LLT,LDLT}::solve() API consistent with other modules Note that we are going to keep a source compatibility untill the next beta release. E.g., the "old" Cholesky* classes, etc are still available for some time. To be clear, Eigen beta2 should be (hopefully) source compatible with beta1, and so beta2 will contain all the deprecated API of beta1. Those features marked as deprecated will be removed in beta3 (or in the final 2.0 if there is no beta 3 !). Also includes various updated in sparse Cholesky.
Diffstat (limited to 'doc/snippets/LLT_solve.cpp')
-rw-r--r--doc/snippets/LLT_solve.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/snippets/LLT_solve.cpp b/doc/snippets/LLT_solve.cpp
new file mode 100644
index 000000000..76ab09ec5
--- /dev/null
+++ b/doc/snippets/LLT_solve.cpp
@@ -0,0 +1,8 @@
+typedef Matrix<float,Dynamic,2> DataMatrix;
+// let's generate some samples on the 3D plane of equation z = 2x+3y (with some noise)
+DataMatrix samples = DataMatrix::Random(12,2);
+VectorXf elevations = 2*samples.col(0) + 3*samples.col(1) + VectorXf::Random(12)*0.1;
+// and let's solve samples * [x y]^T = elevations in least square sense:
+Matrix<float,2,1> xy;
+(samples.adjoint() * samples).llt().solve((samples.adjoint()*elevations), &xy);
+cout << xy << endl;