10 #ifndef EIGEN_SELFADJOINTMATRIX_H 11 #define EIGEN_SELFADJOINTMATRIX_H 32 template<
typename MatrixType,
unsigned int UpLo>
33 struct traits<SelfAdjointView<MatrixType, UpLo> > : traits<MatrixType>
35 typedef typename ref_selector<MatrixType>::non_const_type MatrixTypeNested;
36 typedef typename remove_all<MatrixTypeNested>::type MatrixTypeNestedCleaned;
37 typedef MatrixType ExpressionType;
38 typedef typename MatrixType::PlainObject FullMatrixType;
41 FlagsLvalueBit = is_lvalue<MatrixType>::value ?
LvalueBit : 0,
42 Flags = MatrixTypeNestedCleaned::Flags & (HereditaryBits|FlagsLvalueBit)
54 typedef _MatrixType MatrixType;
56 typedef typename internal::traits<SelfAdjointView>::MatrixTypeNested MatrixTypeNested;
57 typedef typename internal::traits<SelfAdjointView>::MatrixTypeNestedCleaned MatrixTypeNestedCleaned;
58 typedef MatrixTypeNestedCleaned NestedExpression;
61 typedef typename internal::traits<SelfAdjointView>::Scalar
Scalar;
62 typedef typename MatrixType::StorageIndex StorageIndex;
63 typedef typename internal::remove_all<typename MatrixType::ConjugateReturnType>::type MatrixConjugateReturnType;
66 Mode = internal::traits<SelfAdjointView>::Mode,
67 Flags = internal::traits<SelfAdjointView>::Flags,
70 typedef typename MatrixType::PlainObject PlainObject;
75 EIGEN_STATIC_ASSERT(UpLo==
Lower || UpLo==
Upper,SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY);
79 inline Index rows()
const {
return m_matrix.rows(); }
81 inline Index cols()
const {
return m_matrix.cols(); }
83 inline Index outerStride()
const {
return m_matrix.outerStride(); }
85 inline Index innerStride()
const {
return m_matrix.innerStride(); }
93 Base::check_coordinates_internal(row, col);
94 return m_matrix.coeff(row, col);
104 Base::check_coordinates_internal(row, col);
105 return m_matrix.coeffRef(row, col);
110 const MatrixTypeNestedCleaned& _expression()
const {
return m_matrix; }
113 const MatrixTypeNestedCleaned& nestedExpression()
const {
return m_matrix; }
115 MatrixTypeNestedCleaned& nestedExpression() {
return m_matrix; }
118 template<
typename OtherDerived>
120 const Product<SelfAdjointView,OtherDerived>
127 template<
typename OtherDerived>
friend 135 friend EIGEN_DEVICE_FUNC
139 return (s*mat.nestedExpression()).
template selfadjointView<UpLo>();
152 template<
typename DerivedU,
typename DerivedV>
154 SelfAdjointView&
rankUpdate(
const MatrixBase<DerivedU>& u,
const MatrixBase<DerivedV>& v,
const Scalar& alpha =
Scalar(1));
166 template<
typename DerivedU>
180 template<
unsigned int TriMode>
183 TriangularView<MatrixType,TriMode>,
184 TriangularView<typename MatrixType::AdjointReturnType,TriMode> >::type
187 typename internal::conditional<(TriMode&(Upper|Lower))==(UpLo&(Upper|Lower)), MatrixType&, typename MatrixType::ConstTransposeReturnType>::type tmp1(m_matrix);
188 typename internal::conditional<(TriMode&(Upper|Lower))==(UpLo&(Upper|Lower)), MatrixType&, typename MatrixType::AdjointReturnType>::type tmp2(tmp1);
211 EIGEN_STATIC_ASSERT_LVALUE(MatrixType)
212 typename MatrixType::TransposeReturnType tmp(m_matrix);
230 typename MatrixType::ConstDiagonalReturnType
diagonal()
const 232 return typename MatrixType::ConstDiagonalReturnType(m_matrix);
253 MatrixTypeNested m_matrix;
271 template<
typename MatrixType,
unsigned int Mode>
274 typedef typename storage_kind_to_evaluator_kind<typename MatrixType::StorageKind>::Kind Kind;
275 typedef SelfAdjointShape Shape;
278 template<
int UpLo,
int SetOpposite,
typename DstEvaluatorTypeT,
typename SrcEvaluatorTypeT,
typename Functor,
int Version>
279 class triangular_dense_assignment_kernel<UpLo,
SelfAdjoint,SetOpposite,DstEvaluatorTypeT,SrcEvaluatorTypeT,Functor,Version>
280 :
public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>
283 typedef generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version> Base;
284 typedef typename Base::DstXprType DstXprType;
285 typedef typename Base::SrcXprType SrcXprType;
288 using Base::m_functor;
291 typedef typename Base::DstEvaluatorType DstEvaluatorType;
292 typedef typename Base::SrcEvaluatorType SrcEvaluatorType;
293 typedef typename Base::Scalar Scalar;
294 typedef typename Base::AssignmentTraits AssignmentTraits;
297 EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst,
const SrcEvaluatorType &src,
const Functor &func, DstXprType& dstExpr)
298 : Base(dst, src, func, dstExpr)
301 EIGEN_DEVICE_FUNC
void assignCoeff(
Index row,
Index col)
303 eigen_internal_assert(row!=col);
304 Scalar tmp = m_src.coeff(row,col);
305 m_functor.assignCoeff(m_dst.coeffRef(row,col), tmp);
306 m_functor.assignCoeff(m_dst.coeffRef(col,row), numext::conj(tmp));
309 EIGEN_DEVICE_FUNC
void assignDiagonalCoeff(
Index id)
311 Base::assignCoeff(
id,
id);
314 EIGEN_DEVICE_FUNC
void assignOppositeCoeff(
Index,
Index)
315 { eigen_internal_assert(
false &&
"should never be called"); }
325 template<
typename Derived>
326 template<
unsigned int UpLo>
327 typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type
330 return typename ConstSelfAdjointViewReturnType<UpLo>::Type(derived());
342 template<
typename Derived>
343 template<
unsigned int UpLo>
347 return typename SelfAdjointViewReturnType<UpLo>::Type(derived());
352 #endif // EIGEN_SELFADJOINTMATRIX_H Robust Cholesky decomposition of a matrix with pivoting.
Definition: LDLT.h:50
Matrix< RealScalar, internal::traits< MatrixType >::ColsAtCompileTime, 1 > EigenvaluesReturnType
Definition: SelfAdjointView.h:245
const LDLT< PlainObject, UpLo > ldlt() const
Definition: LDLT.h:655
SelfAdjointView & rankUpdate(const MatrixBase< DerivedU > &u, const MatrixBase< DerivedV > &v, const Scalar &alpha=Scalar(1))
Expression of the product of two arbitrary matrices or vectors.
Definition: Product.h:71
Base class for triangular part in a matrix.
Definition: TriangularMatrix.h:27
const unsigned int DirectAccessBit
Definition: Constants.h:150
const unsigned int LvalueBit
Definition: Constants.h:139
TransposeReturnType transpose()
Definition: SelfAdjointView.h:209
Namespace containing all symbols from the Eigen library.
Definition: Core:309
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:150
const Product< SelfAdjointView, OtherDerived > operator*(const MatrixBase< OtherDerived > &rhs) const
Definition: SelfAdjointView.h:121
NumTraits< Scalar >::Real RealScalar
Definition: SelfAdjointView.h:243
Scalar coeff(Index row, Index col) const
Definition: SelfAdjointView.h:91
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:38
const unsigned int PacketAccessBit
Definition: Constants.h:89
internal::traits< SelfAdjointView >::Scalar Scalar
The type of coefficients in this matrix.
Definition: SelfAdjointView.h:61
RealScalar operatorNorm() const
Computes the L2 operator norm.
Definition: MatrixBaseEigenvalues.h:151
const ConstTransposeReturnType transpose() const
Definition: SelfAdjointView.h:219
Definition: Constants.h:204
Derived & derived()
Definition: EigenBase.h:45
const ConjugateReturnType conjugate() const
Definition: SelfAdjointView.h:197
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
Definition: LLT.h:56
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Expression of a selfadjoint matrix from a triangular part of a dense matrix.
Definition: SelfAdjointView.h:49
MatrixType::ConstDiagonalReturnType diagonal() const
Definition: SelfAdjointView.h:230
friend const Product< OtherDerived, SelfAdjointView > operator*(const MatrixBase< OtherDerived > &lhs, const SelfAdjointView &rhs)
Definition: SelfAdjointView.h:130
Definition: Constants.h:206
Definition: Eigen_Colamd.h:50
Definition: Constants.h:220
Expression of a triangular part in a matrix.
Definition: TriangularMatrix.h:186
Scalar & coeffRef(Index row, Index col)
Definition: SelfAdjointView.h:101
EigenvaluesReturnType eigenvalues() const
Computes the eigenvalues of a matrix.
Definition: MatrixBaseEigenvalues.h:88
internal::conditional<(TriMode &(Upper|Lower))==(UpLo &(Upper|Lower)), TriangularView< MatrixType, TriMode >, TriangularView< typename MatrixType::AdjointReturnType, TriMode > >::type triangularView() const
Definition: SelfAdjointView.h:185
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
const AdjointReturnType adjoint() const
Definition: SelfAdjointView.h:203
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
const unsigned int LinearAccessBit
Definition: Constants.h:125
const LLT< PlainObject, UpLo > llt() const
Definition: LLT.h:535