24 typedef typename Real_::DoubleType Double_;
41 assert(a.rows() == a.cols(),
"Matrix must be square and symmetric");
43 _w.
resize(n); _indR.resize(n); _indC.resize(n);
46 jacobi(_a, _w, _v, _indR, _indC);
55 assert(a.rows() == a.cols(),
"Matrix must be square and symmetric");
57 _w.
resize(n); _indR.resize(n); _indC.resize(n);
59 jacobi(_a, _w,
optnull, _indR, _indC);
64 template<
class B,
class X>
72 const Vec&
w()
const {
return _w; }
74 const Matrix&
v()
const {
return _v; }
76 const Matrix&
vt()
const {
return _vt; }
79 void init() { _vt.setEval([&](Matrix& val) { _v.
transpose(val); }); }
82 static void jacobi(Matrix& A, Vec& W, optional<Matrix&> V, vector<sdt>& indR, vector<sdt>& indC);
90 BackSub<Real> _backSub;
93 extern template class Eigen<Float>;
94 extern template class Eigen<Double>;
95 extern template class Eigen<Quad>;
Eigen(const MatrixBase< T > &a)
Calculate the eigendecomposition of symmetric matrix A.
Definition: Eigen.h:35
Algebra.
Definition: Alge.h:13
static optnull_t optnull
Null optional, use to reset an optional to an uninitialized state or test for initialization.
Definition: Optional.h:12
const Matrix & vt() const
Get the row eigenvectors of the decomposition.
Definition: Eigen.h:76
void inverse(MatrixBase< T > &res)
Calculate the inverse of A, the decomposed matrix.
Definition: Eigen.h:69
ptrdiff_t sdt
Size difference type, shorthand for ptrdiff_t.
Definition: Core.h:92
#define assert(...)
Forwards to assert_#args. See assert_1(), assert_2().
Definition: Debug.h:24
Eigen()
Definition: Eigen.h:32
Numeric type information, use numeral() to get instance safely from a static context.
Definition: Numeral.h:17
MatrixS & resize(sdt rows, sdt cols)
Sets number of rows/columns and reallocates only if the size has changed (rows*cols). All previous data is lost on reallocation. Returns self.
Definition: Base.h:277
const Matrix & v() const
Get the column eigenvectors of the decomposition.
Definition: Eigen.h:74
Matrix< matrix::dynamic, matrix::dynamic, Real > Matrix
Definition: Eigen.h:29
Eigen & calc(const MatrixBase< T > &a)
Calculate the eigendecomposition of symmetric matrix A. The eigenvalues/vectors are sorted from large...
Definition: Eigen.h:39
double Real
Definition: Real.h:14
void solve(const MatrixBase< B > &b, MatrixBase< X > &x)
Solve the linear system where A is the decomposed matrix. A and B row sizes must match...
Definition: Eigen.h:65
Eigen & calcValues(const MatrixBase< T > &a)
Calculate the eigenvalues of symmetric matrix A. This is a fast method for when the eigenvectors are ...
Definition: Eigen.h:53
Eigendecomposition. Decomposes any square (n x n) symmetric matrix into eigenvalues and eigenvectors...
Definition: Eigen.h:21
Matrix base class.
Definition: Base.h:17
Vec< matrix::dynamic, Real > Vec
Definition: Eigen.h:30
Global Honeycomb namespace.
const Vec & w() const
Get the eigenvalues of the decomposition.
Definition: Eigen.h:72
Res && transpose(Res &&res) const
transpose and store result in res. Returns res.
Definition: Base.h:314
VecS & resize(sdt dim)
Sets number of dimensions and reallocates only if different. All previous data is lost on reallocatio...
Definition: Base.h:69