Fix some formatting in quick ref. Add references to headers.

This commit is contained in:
Keir Mierle 2009-02-19 16:46:35 +00:00
parent e2ee7a6a58
commit 22b9de1849

View File

@ -1,3 +1,9 @@
// A simple quickref for Eigen. Add anything that's missing.
// Main author: Keir Mierle
#include <Eigen/Core>
#include <Eigen/Array>
Matrix<double, 3, 3> A; // Fixed rows and cols. Same as Matrix3d.
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
@ -137,11 +143,11 @@ C(i,j) // C(i+1,j+1) //
// Solve Ax = b. Result stored in x. Matlab: x = A \ b.
bool solved;
solved = A.ldlt().solve(b, &x)); // A symmetric p.s.d.
solved = A.llt() .solve(b, &x)); // A symmetric p.d.
solved = A.lu() .solve(b, &x)); // Stable and fast.
solved = A.qr() .solve(b, &x)); // No pivoting.
solved = A.svd() .solve(b, &x)); // Most stable, slowest.
solved = A.ldlt().solve(b, &x)); // A sym. p.s.d. #include <Eigen/Cholesky>
solved = A.llt() .solve(b, &x)); // A sym. p.d. #include <Eigen/Cholesky>
solved = A.lu() .solve(b, &x)); // Stable and fast. #include <Eigen/LU>
solved = A.qr() .solve(b, &x)); // No pivoting. #include <Eigen/QR>
solved = A.svd() .solve(b, &x)); // Stable, slowest. #include <Eigen/SVD>
// .ldlt() -> .matrixL() and .matrixD()
// .llt() -> .matrixL()
// .lu() -> .matrixL() and .matrixU()
@ -154,6 +160,3 @@ C(i,j) // C(i+1,j+1) //
EigenSolver<Matrix3d> eig(A); // [vec val] = eig(A)
eig.eigenvalues(); // diag(val)
eig.eigenvectors(); // vec
__________
Main author: Keir Mierle