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);
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>
115 const Product<SelfAdjointView,OtherDerived>
122 template<
typename OtherDerived>
friend
130 friend EIGEN_DEVICE_FUNC
134 return (s*mat.nestedExpression()).
template selfadjointView<UpLo>();
147 template<
typename DerivedU,
typename DerivedV>
149 SelfAdjointView& rankUpdate(
const MatrixBase<DerivedU>& u,
const MatrixBase<DerivedV>& v,
const Scalar& alpha = Scalar(1));
161 template<
typename DerivedU>
163 SelfAdjointView& rankUpdate(
const MatrixBase<DerivedU>& u,
const Scalar& alpha = Scalar(1));
167 const LLT<PlainObject, UpLo> llt()
const;
168 const LDLT<PlainObject, UpLo> ldlt()
const;
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;
207 static const int AssumeAliasing = 0;
210 template<
int UpLo,
int SetOpposite,
typename DstEvaluatorTypeT,
typename SrcEvaluatorTypeT,
typename Functor,
int Version>
211 class triangular_dense_assignment_kernel<UpLo,
SelfAdjoint,SetOpposite,DstEvaluatorTypeT,SrcEvaluatorTypeT,Functor,Version>
212 :
public generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version>
215 typedef generic_dense_assignment_kernel<DstEvaluatorTypeT, SrcEvaluatorTypeT, Functor, Version> Base;
216 typedef typename Base::DstXprType DstXprType;
217 typedef typename Base::SrcXprType SrcXprType;
220 using Base::m_functor;
223 typedef typename Base::DstEvaluatorType DstEvaluatorType;
224 typedef typename Base::SrcEvaluatorType SrcEvaluatorType;
225 typedef typename Base::Scalar Scalar;
226 typedef typename Base::AssignmentTraits AssignmentTraits;
229 EIGEN_DEVICE_FUNC triangular_dense_assignment_kernel(DstEvaluatorType &dst,
const SrcEvaluatorType &src,
const Functor &func, DstXprType& dstExpr)
230 : Base(dst, src, func, dstExpr)
233 EIGEN_DEVICE_FUNC
void assignCoeff(Index row, Index col)
235 eigen_internal_assert(row!=col);
236 Scalar tmp = m_src.coeff(row,col);
237 m_functor.assignCoeff(m_dst.coeffRef(row,col), tmp);
238 m_functor.assignCoeff(m_dst.coeffRef(col,row), numext::conj(tmp));
241 EIGEN_DEVICE_FUNC
void assignDiagonalCoeff(Index
id)
243 Base::assignCoeff(
id,
id);
246 EIGEN_DEVICE_FUNC
void assignOppositeCoeff(Index, Index)
247 { eigen_internal_assert(
false &&
"should never be called"); }
256 template<
typename Derived>
257 template<
unsigned int UpLo>
258 typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type
259 MatrixBase<Derived>::selfadjointView()
const
261 return typename ConstSelfAdjointViewReturnType<UpLo>::Type(derived());
264 template<
typename Derived>
265 template<
unsigned int UpLo>
266 typename MatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type
267 MatrixBase<Derived>::selfadjointView()
269 return typename SelfAdjointViewReturnType<UpLo>::Type(derived());
274 #endif // EIGEN_SELFADJOINTMATRIX_H
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
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: Constants.h:220
Definition: Eigen_Colamd.h:54
Scalar & coeffRef(Index row, Index col)
Definition: SelfAdjointView.h:96
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