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;
67 Mode = internal::traits<SelfAdjointView>::Mode,
68 Flags = internal::traits<SelfAdjointView>::Flags,
71 typedef typename MatrixType::PlainObject PlainObject;
76 EIGEN_STATIC_ASSERT(UpLo==
Lower || UpLo==
Upper,SELFADJOINTVIEW_ACCEPTS_UPPER_AND_LOWER_MODE_ONLY);
79 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
80 inline Index rows()
const EIGEN_NOEXCEPT {
return m_matrix.rows(); }
81 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
82 inline Index cols()
const EIGEN_NOEXCEPT {
return m_matrix.cols(); }
83 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
84 inline Index outerStride()
const EIGEN_NOEXCEPT {
return m_matrix.outerStride(); }
85 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
86 inline Index innerStride()
const EIGEN_NOEXCEPT {
return m_matrix.innerStride(); }
94 Base::check_coordinates_internal(row, col);
95 return m_matrix.coeff(row, col);
104 EIGEN_STATIC_ASSERT_LVALUE(SelfAdjointView);
105 Base::check_coordinates_internal(row, col);
106 return m_matrix.coeffRef(row, col);
111 const MatrixTypeNestedCleaned& _expression()
const {
return m_matrix; }
114 const MatrixTypeNestedCleaned& nestedExpression()
const {
return m_matrix; }
116 MatrixTypeNestedCleaned& nestedExpression() {
return m_matrix; }
119 template<
typename OtherDerived>
128 template<
typename OtherDerived>
friend 136 friend EIGEN_DEVICE_FUNC
138 operator*(
const Scalar& s,
const SelfAdjointView& mat)
140 return (s*mat.nestedExpression()).
template selfadjointView<UpLo>();
153 template<
typename DerivedU,
typename DerivedV>
167 template<
typename DerivedU>
181 template<
unsigned int TriMode>
188 typename internal::conditional<(TriMode&(Upper|Lower))==(UpLo&(Upper|Lower)), MatrixType&, typename MatrixType::ConstTransposeReturnType>::type tmp1(m_matrix);
189 typename internal::conditional<(TriMode&(Upper|Lower))==(UpLo&(Upper|Lower)), MatrixType&, typename MatrixType::AdjointReturnType>::type tmp2(tmp1);
199 {
return ConjugateReturnType(m_matrix.conjugate()); }
206 inline typename internal::conditional<Cond,ConjugateReturnType,ConstSelfAdjointView>::type
209 typedef typename internal::conditional<Cond,ConjugateReturnType,ConstSelfAdjointView>::type ReturnType;
210 return ReturnType(m_matrix.template conjugateIf<Cond>());
216 inline const AdjointReturnType
adjoint()
const 217 {
return AdjointReturnType(m_matrix.adjoint()); }
224 EIGEN_STATIC_ASSERT_LVALUE(MatrixType)
225 typename MatrixType::TransposeReturnType tmp(m_matrix);
226 return TransposeReturnType(tmp);
234 return ConstTransposeReturnType(m_matrix.transpose());
243 typename MatrixType::ConstDiagonalReturnType
diagonal()
const 245 return typename MatrixType::ConstDiagonalReturnType(m_matrix);
261 EigenvaluesReturnType eigenvalues()
const;
263 RealScalar operatorNorm()
const;
266 MatrixTypeNested m_matrix;
284 template<
typename MatrixType,
unsigned int Mode>
287 typedef typename storage_kind_to_evaluator_kind<typename MatrixType::StorageKind>::Kind Kind;
288 typedef SelfAdjointShape Shape;
291 template<
int UpLo,
int SetOpposite,
typename DstEvaluatorTypeT,
typename SrcEvaluatorTypeT,
typename Functor,
int Version>
292 class triangular_dense_assignment_kernel<UpLo,
SelfAdjoint,SetOpposite,DstEvaluatorTypeT,SrcEvaluatorTypeT,Functor,Version>
293 :
public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>
296 typedef generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>
Base;
297 typedef typename Base::DstXprType DstXprType;
298 typedef typename Base::SrcXprType SrcXprType;
301 using Base::m_functor;
304 typedef typename Base::DstEvaluatorType DstEvaluatorType;
305 typedef typename Base::SrcEvaluatorType SrcEvaluatorType;
306 typedef typename Base::Scalar
Scalar;
307 typedef typename Base::AssignmentTraits AssignmentTraits;
310 EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst,
const SrcEvaluatorType &src,
const Functor &func, DstXprType& dstExpr)
311 : Base(dst, src, func, dstExpr)
314 EIGEN_DEVICE_FUNC
void assignCoeff(
Index row,
Index col)
316 eigen_internal_assert(row!=col);
317 Scalar tmp = m_src.coeff(row,col);
318 m_functor.assignCoeff(m_dst.coeffRef(row,col), tmp);
319 m_functor.assignCoeff(m_dst.coeffRef(col,row), numext::conj(tmp));
322 EIGEN_DEVICE_FUNC
void assignDiagonalCoeff(
Index id)
324 Base::assignCoeff(
id,
id);
327 EIGEN_DEVICE_FUNC
void assignOppositeCoeff(
Index,
Index)
328 { eigen_internal_assert(
false &&
"should never be called"); }
338 template<
typename Derived>
339 template<
unsigned int UpLo>
343 return typename ConstSelfAdjointViewReturnType<UpLo>::Type(derived());
355 template<
typename Derived>
356 template<
unsigned int UpLo>
360 return typename SelfAdjointViewReturnType<UpLo>::Type(derived());
365 #endif // EIGEN_SELFADJOINTMATRIX_H Robust Cholesky decomposition of a matrix with pivoting.
Definition: LDLT.h:59
Matrix< RealScalar, internal::traits< MatrixType >::ColsAtCompileTime, 1 > EigenvaluesReturnType
Definition: SelfAdjointView.h:258
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:155
const unsigned int LvalueBit
Definition: Constants.h:144
TransposeReturnType transpose()
Definition: SelfAdjointView.h:222
Namespace containing all symbols from the Eigen library.
Definition: Core:141
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:232
const Product< SelfAdjointView, OtherDerived > operator*(const MatrixBase< OtherDerived > &rhs) const
Definition: SelfAdjointView.h:122
NumTraits< Scalar >::Real RealScalar
Definition: SelfAdjointView.h:256
Scalar coeff(Index row, Index col) const
Definition: SelfAdjointView.h:92
Derived & derived()
Definition: EigenBase.h:46
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:39
const unsigned int PacketAccessBit
Definition: Constants.h:94
internal::traits< SelfAdjointView >::Scalar Scalar
The type of coefficients in this matrix.
Definition: SelfAdjointView.h:61
const ConstTransposeReturnType transpose() const
Definition: SelfAdjointView.h:232
Definition: Constants.h:209
const ConjugateReturnType conjugate() const
Definition: SelfAdjointView.h:198
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
Definition: LLT.h:66
const Product< MatrixDerived, PermutationDerived, AliasFreeProduct > operator*(const MatrixBase< MatrixDerived > &matrix, const PermutationBase< PermutationDerived > &permutation)
Definition: PermutationMatrix.h:515
Expression of a selfadjoint matrix from a triangular part of a dense matrix.
Definition: SelfAdjointView.h:49
MatrixType::ConstDiagonalReturnType diagonal() const
Definition: SelfAdjointView.h:243
friend const Product< OtherDerived, SelfAdjointView > operator*(const MatrixBase< OtherDerived > &lhs, const SelfAdjointView &rhs)
Definition: SelfAdjointView.h:131
Definition: Constants.h:211
Definition: Eigen_Colamd.h:50
Definition: Constants.h:225
Expression of a triangular part in a matrix.
Definition: TriangularMatrix.h:187
Scalar & coeffRef(Index row, Index col)
Definition: SelfAdjointView.h:102
internal::conditional< Cond, ConjugateReturnType, ConstSelfAdjointView >::type conjugateIf() const
Definition: SelfAdjointView.h:207
internal::conditional<(TriMode &(Upper|Lower))==(UpLo &(Upper|Lower)), TriangularView< MatrixType, TriMode >, TriangularView< typename MatrixType::AdjointReturnType, TriMode > >::type triangularView() const
Definition: SelfAdjointView.h:186
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
const AdjointReturnType adjoint() const
Definition: SelfAdjointView.h:216
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
const unsigned int LinearAccessBit
Definition: Constants.h:130