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>::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;
60 typedef typename internal::traits<SelfAdjointView>::Scalar
Scalar;
61 typedef typename MatrixType::StorageIndex StorageIndex;
64 Mode = internal::traits<SelfAdjointView>::Mode,
65 Flags = internal::traits<SelfAdjointView>::Flags
67 typedef typename MatrixType::PlainObject PlainObject;
74 inline Index rows()
const {
return m_matrix.rows(); }
76 inline Index cols()
const {
return m_matrix.cols(); }
78 inline Index outerStride()
const {
return m_matrix.outerStride(); }
80 inline Index innerStride()
const {
return m_matrix.innerStride(); }
88 Base::check_coordinates_internal(row, col);
89 return m_matrix.coeff(row, col);
98 EIGEN_STATIC_ASSERT_LVALUE(SelfAdjointView);
99 Base::check_coordinates_internal(row, col);
100 return m_matrix.const_cast_derived().coeffRef(row, col);
105 const MatrixTypeNestedCleaned& _expression()
const {
return m_matrix; }
108 const MatrixTypeNestedCleaned& nestedExpression()
const {
return m_matrix; }
110 MatrixTypeNestedCleaned& nestedExpression() {
return *
const_cast<MatrixTypeNestedCleaned*
>(&m_matrix); }
113 template<
typename OtherDerived>
122 template<
typename OtherDerived>
friend 130 friend EIGEN_DEVICE_FUNC
132 operator*(
const Scalar& s,
const SelfAdjointView& mat)
134 return (s*mat.nestedExpression()).
template selfadjointView<UpLo>();
147 template<
typename DerivedU,
typename DerivedV>
161 template<
typename DerivedU>
178 EigenvaluesReturnType eigenvalues()
const;
180 RealScalar operatorNorm()
const;
183 MatrixTypeNested m_matrix;
201 template<
typename MatrixType,
unsigned int Mode>
204 typedef typename storage_kind_to_evaluator_kind<typename MatrixType::StorageKind>::Kind Kind;
205 typedef SelfAdjointShape Shape;
208 template<
int UpLo,
int SetOpposite,
typename DstEvaluatorTypeT,
typename SrcEvaluatorTypeT,
typename Functor,
int Version>
209 class triangular_dense_assignment_kernel<UpLo,
SelfAdjoint,SetOpposite,DstEvaluatorTypeT,SrcEvaluatorTypeT,Functor,Version>
210 :
public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>
213 typedef generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>
Base;
214 typedef typename Base::DstXprType DstXprType;
215 typedef typename Base::SrcXprType SrcXprType;
218 using Base::m_functor;
221 typedef typename Base::DstEvaluatorType DstEvaluatorType;
222 typedef typename Base::SrcEvaluatorType SrcEvaluatorType;
223 typedef typename Base::Scalar
Scalar;
224 typedef typename Base::AssignmentTraits AssignmentTraits;
227 EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst,
const SrcEvaluatorType &src,
const Functor &func, DstXprType& dstExpr)
228 : Base(dst, src, func, dstExpr)
231 EIGEN_DEVICE_FUNC
void assignCoeff(
Index row,
Index col)
233 eigen_internal_assert(row!=col);
234 Scalar tmp = m_src.coeff(row,col);
235 m_functor.assignCoeff(m_dst.coeffRef(row,col), tmp);
236 m_functor.assignCoeff(m_dst.coeffRef(col,row), numext::conj(tmp));
239 EIGEN_DEVICE_FUNC
void assignDiagonalCoeff(
Index id)
241 Base::assignCoeff(
id,
id);
244 EIGEN_DEVICE_FUNC
void assignOppositeCoeff(
Index,
Index)
245 { eigen_internal_assert(
false &&
"should never be called"); }
254 template<
typename Derived>
255 template<
unsigned int UpLo>
259 return typename ConstSelfAdjointViewReturnType<UpLo>::Type(derived());
262 template<
typename Derived>
263 template<
unsigned int UpLo>
267 return typename SelfAdjointViewReturnType<UpLo>::Type(derived());
272 #endif // EIGEN_SELFADJOINTMATRIX_H Robust Cholesky decomposition of a matrix with pivoting.
Definition: LDLT.h:48
Matrix< RealScalar, internal::traits< MatrixType >::ColsAtCompileTime, 1 > EigenvaluesReturnType
Definition: SelfAdjointView.h:175
const Product< SelfAdjointView, OtherDerived > operator*(const MatrixBase< OtherDerived > &rhs) const
Definition: SelfAdjointView.h:116
Expression of the product of two arbitrary matrices or vectors.
Definition: Product.h:107
Base class for triangular part in a matrix.
Definition: TriangularMatrix.h:27
const unsigned int DirectAccessBit
Definition: Constants.h:149
const unsigned int LvalueBit
Definition: Constants.h:138
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:107
NumTraits< Scalar >::Real RealScalar
Definition: SelfAdjointView.h:173
Scalar coeff(Index row, Index col) const
Definition: SelfAdjointView.h:86
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:37
const unsigned int PacketAccessBit
Definition: Constants.h:88
internal::traits< SelfAdjointView >::Scalar Scalar
The type of coefficients in this matrix.
Definition: SelfAdjointView.h:60
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
Definition: LLT.h:50
Expression of a selfadjoint matrix from a triangular part of a dense matrix.
Definition: SelfAdjointView.h:49
friend const Product< OtherDerived, SelfAdjointView > operator*(const MatrixBase< OtherDerived > &lhs, const SelfAdjointView &rhs)
Definition: SelfAdjointView.h:125
Definition: Eigen_Colamd.h:54
Scalar & coeffRef(Index row, Index col)
Definition: SelfAdjointView.h:96
Definition: Constants.h:220
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
const unsigned int LinearAccessBit
Definition: Constants.h:124