Eigen::SparseSelfAdjointView< MatrixType, Mode_ > Class Template Reference

Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix. More...

+ Inheritance diagram for Eigen::SparseSelfAdjointView< MatrixType, Mode_ >:

Public Types

enum  {
  Mode ,
  TransposeMode ,
  RowsAtCompileTime ,
  ColsAtCompileTime
}
 
typedef EigenBase< SparseSelfAdjointViewBase
 
typedef internal::ref_selector< MatrixType >::non_const_type MatrixTypeNested
 
typedef internal::remove_all_t< MatrixTypeNestedMatrixTypeNested_
 
typedef MatrixType::Scalar Scalar
 
typedef MatrixType::StorageIndex StorageIndex
 
typedef Matrix< StorageIndex, Dynamic, 1 > VectorI
 
- Public Types inherited from Eigen::EigenBase< SparseSelfAdjointView< MatrixType, Mode_ > >
typedef Eigen::Index Index
 The interface type of indices. More...
 
typedef internal::traits< SparseSelfAdjointView< MatrixType, Mode_ > >::StorageKind StorageKind
 

Public Member Functions

Index cols () const
 
std::remove_reference_t< MatrixTypeNested > & matrix ()
 
const MatrixTypeNested_matrix () const
 
template<typename OtherDerived >
Product< SparseSelfAdjointView, OtherDerived > operator* (const MatrixBase< OtherDerived > &rhs) const
 
template<typename OtherDerived >
Product< SparseSelfAdjointView, OtherDerived > operator* (const SparseMatrixBase< OtherDerived > &rhs) const
 
SparseSelfAdjointViewoperator= (const SparseSelfAdjointView &src)
 
template<typename SrcMatrixType , unsigned int SrcMode>
SparseSelfAdjointViewoperator= (const SparseSelfAdjointView< SrcMatrixType, SrcMode > &src)
 
template<typename SrcMatrixType , int SrcMode>
SparseSelfAdjointViewoperator= (const SparseSymmetricPermutationProduct< SrcMatrixType, SrcMode > &permutedMatrix)
 
template<typename DerivedU >
SparseSelfAdjointView< MatrixType, Mode > & rankUpdate (const SparseMatrixBase< DerivedU > &u, const Scalar &alpha)
 
template<typename DerivedU >
SparseSelfAdjointViewrankUpdate (const SparseMatrixBase< DerivedU > &u, const Scalar &alpha=Scalar(1))
 
void resize (Index rows, Index cols)
 
Index rows () const
 
 SparseSelfAdjointView (MatrixType &matrix)
 
SparseSymmetricPermutationProduct< MatrixTypeNested_, ModetwistedBy (const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const
 
- Public Member Functions inherited from Eigen::EigenBase< SparseSelfAdjointView< MatrixType, Mode_ > >
void addTo (Dest &dst) const
 
void applyThisOnTheLeft (Dest &dst) const
 
void applyThisOnTheRight (Dest &dst) const
 
EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
SparseSelfAdjointView< MatrixType, Mode_ > & const_cast_derived () const
 
const SparseSelfAdjointView< MatrixType, Mode_ > & const_derived () const
 
SparseSelfAdjointView< MatrixType, Mode_ > & derived ()
 
const SparseSelfAdjointView< MatrixType, Mode_ > & derived () const
 
void evalTo (Dest &dst) const
 
EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
 
void subTo (Dest &dst) const
 

Protected Attributes

MatrixTypeNested m_matrix
 

Private Member Functions

template<typename Dest >
void evalTo (Dest &) const
 

Detailed Description

template<typename MatrixType, unsigned int Mode_>
class Eigen::SparseSelfAdjointView< MatrixType, Mode_ >

Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.

Parameters
MatrixTypethe type of the dense matrix storing the coefficients
Modecan be either Lower or Upper

This class is an expression of a sefladjoint matrix from a triangular part of a matrix with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView() and most of the time this is the only way that it is used.

See also
SparseMatrixBase::selfadjointView()

Definition at line 45 of file SparseSelfAdjointView.h.

Member Typedef Documentation

◆ Base

template<typename MatrixType , unsigned int Mode_>
typedef EigenBase<SparseSelfAdjointView> Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::Base

Definition at line 57 of file SparseSelfAdjointView.h.

◆ MatrixTypeNested

template<typename MatrixType , unsigned int Mode_>
typedef internal::ref_selector<MatrixType>::non_const_type Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::MatrixTypeNested

Definition at line 61 of file SparseSelfAdjointView.h.

◆ MatrixTypeNested_

template<typename MatrixType , unsigned int Mode_>
typedef internal::remove_all_t<MatrixTypeNested> Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::MatrixTypeNested_

Definition at line 62 of file SparseSelfAdjointView.h.

◆ Scalar

template<typename MatrixType , unsigned int Mode_>
typedef MatrixType::Scalar Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::Scalar

Definition at line 58 of file SparseSelfAdjointView.h.

◆ StorageIndex

template<typename MatrixType , unsigned int Mode_>
typedef MatrixType::StorageIndex Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::StorageIndex

Definition at line 59 of file SparseSelfAdjointView.h.

◆ VectorI

template<typename MatrixType , unsigned int Mode_>
typedef Matrix<StorageIndex,Dynamic,1> Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::VectorI

Definition at line 60 of file SparseSelfAdjointView.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename MatrixType , unsigned int Mode_>
anonymous enum
Enumerator
Mode 
TransposeMode 
RowsAtCompileTime 
ColsAtCompileTime 

Definition at line 50 of file SparseSelfAdjointView.h.

50  {
51  Mode = Mode_,
52  TransposeMode = ((Mode & Upper) ? Lower : 0) | ((Mode & Lower) ? Upper : 0),
53  RowsAtCompileTime = internal::traits<SparseSelfAdjointView>::RowsAtCompileTime,
54  ColsAtCompileTime = internal::traits<SparseSelfAdjointView>::ColsAtCompileTime
55  };
@ Lower
Definition: Constants.h:211
@ Upper
Definition: Constants.h:213

Constructor & Destructor Documentation

◆ SparseSelfAdjointView()

template<typename MatrixType , unsigned int Mode_>
Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::SparseSelfAdjointView ( MatrixType matrix)
inlineexplicit

Definition at line 64 of file SparseSelfAdjointView.h.

64  : m_matrix(matrix)
65  {
66  eigen_assert(rows()==cols() && "SelfAdjointView is only for squared matrices");
67  }
#define eigen_assert(x)
Definition: Macros.h:902
const MatrixTypeNested_ & matrix() const

Member Function Documentation

◆ cols()

template<typename MatrixType , unsigned int Mode_>
Index Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::cols ( void  ) const
inline

Definition at line 70 of file SparseSelfAdjointView.h.

70 { return m_matrix.cols(); }

◆ evalTo()

template<typename MatrixType , unsigned int Mode_>
template<typename Dest >
void Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::evalTo ( Dest &  ) const
private

◆ matrix() [1/2]

template<typename MatrixType , unsigned int Mode_>
std::remove_reference_t<MatrixTypeNested>& Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::matrix ( )
inline

Definition at line 74 of file SparseSelfAdjointView.h.

74 { return m_matrix; }

◆ matrix() [2/2]

template<typename MatrixType , unsigned int Mode_>
const MatrixTypeNested_& Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::matrix ( ) const
inline

Definition at line 73 of file SparseSelfAdjointView.h.

73 { return m_matrix; }

◆ operator*() [1/2]

template<typename MatrixType , unsigned int Mode_>
template<typename OtherDerived >
Product<SparseSelfAdjointView,OtherDerived> Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::operator* ( const MatrixBase< OtherDerived > &  rhs) const
inline

Efficient sparse self-adjoint matrix times dense vector/matrix product

Definition at line 103 of file SparseSelfAdjointView.h.

104  {
105  return Product<SparseSelfAdjointView,OtherDerived>(*this, rhs.derived());
106  }

◆ operator*() [2/2]

template<typename MatrixType , unsigned int Mode_>
template<typename OtherDerived >
Product<SparseSelfAdjointView, OtherDerived> Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::operator* ( const SparseMatrixBase< OtherDerived > &  rhs) const
inline
Returns
an expression of the matrix product between a sparse self-adjoint matrix *this and a sparse matrix rhs.

Note that there is no algorithmic advantage of performing such a product compared to a general sparse-sparse matrix product. Indeed, the SparseSelfadjointView operand is first copied into a temporary SparseMatrix before computing the product.

Definition at line 83 of file SparseSelfAdjointView.h.

84  {
85  return Product<SparseSelfAdjointView, OtherDerived>(*this, rhs.derived());
86  }

◆ operator=() [1/3]

template<typename MatrixType , unsigned int Mode_>
SparseSelfAdjointView& Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::operator= ( const SparseSelfAdjointView< MatrixType, Mode_ > &  src)
inline

Definition at line 141 of file SparseSelfAdjointView.h.

142  {
143  PermutationMatrix<Dynamic,Dynamic,StorageIndex> pnull;
144  return *this = src.twistedBy(pnull);
145  }

◆ operator=() [2/3]

template<typename MatrixType , unsigned int Mode_>
template<typename SrcMatrixType , unsigned int SrcMode>
SparseSelfAdjointView& Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::operator= ( const SparseSelfAdjointView< SrcMatrixType, SrcMode > &  src)
inline

Definition at line 151 of file SparseSelfAdjointView.h.

152  {
153  PermutationMatrix<Dynamic,Dynamic,StorageIndex> pnull;
154  return *this = src.twistedBy(pnull);
155  }

◆ operator=() [3/3]

template<typename MatrixType , unsigned int Mode_>
template<typename SrcMatrixType , int SrcMode>
SparseSelfAdjointView& Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::operator= ( const SparseSymmetricPermutationProduct< SrcMatrixType, SrcMode > &  permutedMatrix)
inline

Definition at line 135 of file SparseSelfAdjointView.h.

136  {
138  return *this;
139  }
EIGEN_CONSTEXPR void call_assignment_no_alias_no_transpose(Dst &dst, const Src &src, const Func &func)

◆ rankUpdate() [1/2]

template<typename MatrixType , unsigned int Mode_>
template<typename DerivedU >
SparseSelfAdjointView<MatrixType,Mode>& Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::rankUpdate ( const SparseMatrixBase< DerivedU > &  u,
const Scalar alpha 
)

Implementation of SparseSelfAdjointView methods

Definition at line 199 of file SparseSelfAdjointView.h.

200 {
201  SparseMatrix<Scalar,(MatrixType::Flags&RowMajorBit)?RowMajor:ColMajor> tmp = u * u.adjoint();
202  if(alpha==Scalar(0))
203  m_matrix = tmp.template triangularView<Mode>();
204  else
205  m_matrix += alpha * tmp.template triangularView<Mode>();
206 
207  return *this;
208 }
@ ColMajor
Definition: Constants.h:321
@ RowMajor
Definition: Constants.h:323
const unsigned int RowMajorBit
Definition: Constants.h:68

◆ rankUpdate() [2/2]

template<typename MatrixType , unsigned int Mode_>
template<typename DerivedU >
SparseSelfAdjointView& Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::rankUpdate ( const SparseMatrixBase< DerivedU > &  u,
const Scalar alpha = Scalar(1) 
)

Perform a symmetric rank K update of the selfadjoint matrix *this: \( this = this + \alpha ( u u^* ) \) where u is a vector or matrix.

Returns
a reference to *this

To perform \( this = this + \alpha ( u^* u ) \) you can simply call this function with u.adjoint().

◆ resize()

template<typename MatrixType , unsigned int Mode_>
void Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::resize ( Index  rows,
Index  cols 
)
inline

Definition at line 157 of file SparseSelfAdjointView.h.

158  {
161  eigen_assert(rows == this->rows() && cols == this->cols()
162  && "SparseSelfadjointView::resize() does not actually allow to resize.");
163  }
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:914

◆ rows()

template<typename MatrixType , unsigned int Mode_>
Index Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::rows ( void  ) const
inline

Definition at line 69 of file SparseSelfAdjointView.h.

69 { return m_matrix.rows(); }

◆ twistedBy()

template<typename MatrixType , unsigned int Mode_>
SparseSymmetricPermutationProduct<MatrixTypeNested_,Mode> Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::twistedBy ( const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &  perm) const
inline
Returns
an expression of P H P^-1

Definition at line 129 of file SparseSelfAdjointView.h.

130  {
131  return SparseSymmetricPermutationProduct<MatrixTypeNested_,Mode>(m_matrix, perm);
132  }

Member Data Documentation

◆ m_matrix

template<typename MatrixType , unsigned int Mode_>
MatrixTypeNested Eigen::SparseSelfAdjointView< MatrixType, Mode_ >::m_matrix
protected

Definition at line 167 of file SparseSelfAdjointView.h.


The documentation for this class was generated from the following file: