mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-18 12:23:13 +08:00
Fix some formatting in quick ref. Add references to headers.
This commit is contained in:
parent
e2ee7a6a58
commit
22b9de1849
@ -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, 3> A; // Fixed rows and cols. Same as Matrix3d.
|
||||||
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
|
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
|
||||||
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
|
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.
|
// Solve Ax = b. Result stored in x. Matlab: x = A \ b.
|
||||||
bool solved;
|
bool solved;
|
||||||
solved = A.ldlt().solve(b, &x)); // A symmetric p.s.d.
|
solved = A.ldlt().solve(b, &x)); // A sym. p.s.d. #include <Eigen/Cholesky>
|
||||||
solved = A.llt() .solve(b, &x)); // A symmetric p.d.
|
solved = A.llt() .solve(b, &x)); // A sym. p.d. #include <Eigen/Cholesky>
|
||||||
solved = A.lu() .solve(b, &x)); // Stable and fast.
|
solved = A.lu() .solve(b, &x)); // Stable and fast. #include <Eigen/LU>
|
||||||
solved = A.qr() .solve(b, &x)); // No pivoting.
|
solved = A.qr() .solve(b, &x)); // No pivoting. #include <Eigen/QR>
|
||||||
solved = A.svd() .solve(b, &x)); // Most stable, slowest.
|
solved = A.svd() .solve(b, &x)); // Stable, slowest. #include <Eigen/SVD>
|
||||||
// .ldlt() -> .matrixL() and .matrixD()
|
// .ldlt() -> .matrixL() and .matrixD()
|
||||||
// .llt() -> .matrixL()
|
// .llt() -> .matrixL()
|
||||||
// .lu() -> .matrixL() and .matrixU()
|
// .lu() -> .matrixL() and .matrixU()
|
||||||
@ -154,6 +160,3 @@ C(i,j) // C(i+1,j+1) //
|
|||||||
EigenSolver<Matrix3d> eig(A); // [vec val] = eig(A)
|
EigenSolver<Matrix3d> eig(A); // [vec val] = eig(A)
|
||||||
eig.eigenvalues(); // diag(val)
|
eig.eigenvalues(); // diag(val)
|
||||||
eig.eigenvectors(); // vec
|
eig.eigenvectors(); // vec
|
||||||
|
|
||||||
__________
|
|
||||||
Main author: Keir Mierle
|
|
Loading…
x
Reference in New Issue
Block a user