10 #ifndef EIGEN_SELFADJOINTMATRIX_H 11 #define EIGEN_SELFADJOINTMATRIX_H 32 template<
typename MatrixType,
unsigned int UpLo>
38 typedef typename MatrixType::PlainObject DenseMatrixType;
41 Flags = MatrixTypeNestedCleaned::Flags & (HereditaryBits)
43 CoeffReadCost = MatrixTypeNestedCleaned::CoeffReadCost
48 template <
typename Lhs,
int LhsMode,
bool LhsIsVector,
49 typename Rhs,
int RhsMode,
bool RhsIsVector>
65 typedef typename MatrixType::Index Index;
70 typedef typename MatrixType::PlainObject PlainObject;
75 inline Index rows()
const {
return m_matrix.rows(); }
76 inline Index cols()
const {
return m_matrix.cols(); }
77 inline Index outerStride()
const {
return m_matrix.outerStride(); }
78 inline Index innerStride()
const {
return m_matrix.innerStride(); }
83 inline Scalar
coeff(Index row, Index col)
const 85 Base::check_coordinates_internal(row, col);
86 return m_matrix.coeff(row, col);
94 Base::check_coordinates_internal(row, col);
95 return m_matrix.const_cast_derived().coeffRef(row, col);
99 const MatrixTypeNestedCleaned& _expression()
const {
return m_matrix; }
101 const MatrixTypeNestedCleaned& nestedExpression()
const {
return m_matrix; }
102 MatrixTypeNestedCleaned& nestedExpression() {
return *
const_cast<MatrixTypeNestedCleaned*
>(&m_matrix); }
105 template<
typename OtherDerived>
110 <
MatrixType,Mode,
false,OtherDerived,0,OtherDerived::IsVectorAtCompileTime>
111 (m_matrix, rhs.derived());
115 template<
typename OtherDerived>
friend 120 <OtherDerived,0,OtherDerived::IsVectorAtCompileTime,
MatrixType,Mode,
false>
121 (lhs.derived(),rhs.m_matrix);
134 template<
typename DerivedU,
typename DerivedV>
147 template<
typename DerivedU>
162 EigenvaluesReturnType eigenvalues()
const;
163 RealScalar operatorNorm()
const;
165 #ifdef EIGEN2_SUPPORT 166 template<
typename OtherDerived>
172 m_matrix.const_cast_derived().template triangularView<UpLo>() = other;
173 m_matrix.const_cast_derived().template triangularView<OtherPart>() = other.
adjoint();
176 template<
typename OtherMatrixType,
unsigned int OtherMode>
182 m_matrix.const_cast_derived().template triangularView<UpLo>() = other.toDenseMatrix();
183 m_matrix.const_cast_derived().template triangularView<OtherPart>() = other.toDenseMatrix().adjoint();
189 MatrixTypeNested m_matrix;
204 template<
typename Derived1,
typename Derived2,
int UnrollCount,
bool ClearOpposite>
208 col = (UnrollCount-1) / Derived1::RowsAtCompileTime,
209 row = (UnrollCount-1) % Derived1::RowsAtCompileTime
212 static inline void run(Derived1 &dst,
const Derived2 &src)
217 dst.coeffRef(row, col) = numext::real(src.coeff(row, col));
219 dst.coeffRef(col, row) = numext::conj(dst.coeffRef(row, col) = src.coeff(row, col));
223 template<
typename Derived1,
typename Derived2,
bool ClearOpposite>
226 static inline void run(Derived1 &,
const Derived2 &) {}
229 template<
typename Derived1,
typename Derived2,
int UnrollCount,
bool ClearOpposite>
233 col = (UnrollCount-1) / Derived1::RowsAtCompileTime,
234 row = (UnrollCount-1) % Derived1::RowsAtCompileTime
237 static inline void run(Derived1 &dst,
const Derived2 &src)
242 dst.coeffRef(row, col) = numext::real(src.coeff(row, col));
244 dst.coeffRef(col, row) = numext::conj(dst.coeffRef(row, col) = src.coeff(row, col));
248 template<
typename Derived1,
typename Derived2,
bool ClearOpposite>
251 static inline void run(Derived1 &,
const Derived2 &) {}
254 template<
typename Derived1,
typename Derived2,
bool ClearOpposite>
257 typedef typename Derived1::Index Index;
258 static inline void run(Derived1 &dst,
const Derived2 &src)
260 for(Index j = 0; j < dst.cols(); ++j)
262 for(Index i = 0; i < j; ++i)
264 dst.copyCoeff(i, j, src);
265 dst.coeffRef(j,i) = numext::conj(dst.coeff(i,j));
267 dst.copyCoeff(j, j, src);
272 template<
typename Derived1,
typename Derived2,
bool ClearOpposite>
275 static inline void run(Derived1 &dst,
const Derived2 &src)
277 typedef typename Derived1::Index Index;
278 for(Index i = 0; i < dst.rows(); ++i)
280 for(Index j = 0; j < i; ++j)
282 dst.copyCoeff(i, j, src);
283 dst.coeffRef(j,i) = numext::conj(dst.coeff(i,j));
285 dst.copyCoeff(i, i, src);
296 template<
typename Derived>
297 template<
unsigned int UpLo>
304 template<
typename Derived>
305 template<
unsigned int UpLo>
314 #endif // EIGEN_SELFADJOINTMATRIX_H Robust Cholesky decomposition of a matrix with pivoting.
Definition: LDLT.h:48
Scalar & coeffRef(Index row, Index col)
Definition: SelfAdjointView.h:92
SelfadjointProductMatrix< MatrixType, Mode, false, OtherDerived, 0, OtherDerived::IsVectorAtCompileTime > operator*(const MatrixBase< OtherDerived > &rhs) const
Efficient self-adjoint matrix times vector/matrix product.
Definition: SelfAdjointView.h:107
const AdjointReturnType adjoint() const
Definition: Transpose.h:237
View matrix as a lower triangular matrix with zeros on the diagonal.
Definition: Constants.h:179
friend SelfadjointProductMatrix< OtherDerived, 0, OtherDerived::IsVectorAtCompileTime, MatrixType, Mode, false > operator*(const MatrixBase< OtherDerived > &lhs, const SelfAdjointView &rhs)
Efficient vector/matrix times self-adjoint matrix product.
Definition: SelfAdjointView.h:117
Definition: TriangularMatrix.h:29
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array...
Definition: Constants.h:142
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Holds information about the various numeric (i.e.
Definition: NumTraits.h:88
Matrix< RealScalar, internal::traits< MatrixType >::ColsAtCompileTime, 1 > EigenvaluesReturnType
Return type of eigenvalues()
Definition: SelfAdjointView.h:160
Definition: SelfAdjointView.h:50
const unsigned int PacketAccessBit
Short version: means the expression might be vectorized.
Definition: Constants.h:81
internal::traits< SelfAdjointView >::Scalar Scalar
The type of coefficients in this matrix.
Definition: SelfAdjointView.h:63
View matrix as an upper triangular matrix.
Definition: Constants.h:169
Used in BandMatrix and SelfAdjointView to indicate that the matrix is self-adjoint.
Definition: Constants.h:183
View matrix as an upper triangular matrix with zeros on the diagonal.
Definition: Constants.h:181
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
Definition: LLT.h:50
NumTraits< Scalar >::Real RealScalar
Real part of Scalar.
Definition: SelfAdjointView.h:158
Definition: TriangularMatrix.h:442
Expression of a selfadjoint matrix from a triangular part of a dense matrix.
Definition: SelfAdjointView.h:53
Definition: BandTriangularSolver.h:13
Base class for triangular part in a matrix.
Definition: TriangularMatrix.h:158
View matrix as a lower triangular matrix.
Definition: Constants.h:167
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition: Constants.h:117
Definition: ForwardDeclarations.h:17
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48
Scalar coeff(Index row, Index col) const
Definition: SelfAdjointView.h:83