Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > Class Template Reference

A versatile sparse matrix representation where each element is a block. More...

#include <src/eigen/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h>

+ Inheritance diagram for Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >:
+ Collaboration diagram for Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >:

Classes

class  BlockInnerIterator
 
class  InnerIterator
 

Public Types

enum  {
  Options = _Options , Flags = Options , BlockSize =_BlockAtCompileTime , RowsAtCompileTime = Dynamic ,
  ColsAtCompileTime = Dynamic , MaxRowsAtCompileTime = Dynamic , MaxColsAtCompileTime = Dynamic , IsVectorAtCompileTime = 0 ,
  IsColMajor = Flags&RowMajorBit ? 0 : 1
}
 
typedef _Scalar Scalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef _StorageIndex StorageIndex
 
typedef internal::ref_selector< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::type Nested
 
typedef Matrix< Scalar, _BlockAtCompileTime, _BlockAtCompileTime, IsColMajor ? ColMajor :RowMajorBlockScalar
 
typedef Matrix< RealScalar, _BlockAtCompileTime, _BlockAtCompileTime, IsColMajor ? ColMajor :RowMajorBlockRealScalar
 
typedef internal::conditional< _BlockAtCompileTime==Dynamic, Scalar, BlockScalar >::type BlockScalarReturnType
 
typedef BlockSparseMatrix< Scalar, BlockSize, IsColMajor ? ColMajor :RowMajor, StorageIndexPlainObject
 
enum  
 
typedef Scalar value_type
 
typedef internal::packet_traits< Scalar >::type PacketScalar
 
typedef internal::traits< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::StorageKind StorageKind
 
typedef internal::add_const_on_value_type_if_arithmetic< typenameinternal::packet_traits< Scalar >::type >::type PacketReturnType
 
typedef SparseMatrixBase StorageBaseType
 
typedef Matrix< StorageIndex, Dynamic, 1 > IndexVector
 
typedef Matrix< Scalar, Dynamic, 1 > ScalarVector
 
typedef internal::conditional< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, Eigen::Transpose< constDerived > >, Transpose< constDerived > >::type AdjointReturnType
 
typedef Transpose< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > > TransposeReturnType
 
typedef internal::add_const< Transpose< constDerived > >::type ConstTransposeReturnType
 
typedef internal::conditional< _HasDirectAccess, constScalar &, Scalar >::type CoeffReturnType
 
typedef CwiseNullaryOp< internal::scalar_constant_op< Scalar >, Matrix< Scalar, Dynamic, Dynamic > > ConstantReturnType
 
typedef Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTimeDenseMatrixType
 
typedef Matrix< Scalar, EIGEN_SIZE_MAX(RowsAtCompileTime, ColsAtCompileTime), EIGEN_SIZE_MAX(RowsAtCompileTime, ColsAtCompileTime)> SquareMatrixType
 
typedef EigenBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > > Base
 
typedef Block< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, IsRowMajor?1:Dynamic, IsRowMajor?Dynamic:1, true > InnerVectorReturnType
 
typedef Block< const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, IsRowMajor?1:Dynamic, IsRowMajor?Dynamic:1, true > ConstInnerVectorReturnType
 
typedef Block< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, Dynamic, Dynamic, true > InnerVectorsReturnType
 
typedef Block< const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, Dynamic, Dynamic, true > ConstInnerVectorsReturnType
 
typedef Eigen::Index Index
 The interface type of indices.
 

Public Member Functions

 BlockSparseMatrix ()
 
 BlockSparseMatrix (Index brow, Index bcol)
 Construct and resize.
 
 BlockSparseMatrix (const BlockSparseMatrix &other)
 Copy-constructor.
 
BlockSparseMatrixoperator= (BlockSparseMatrix other)
 
 ~BlockSparseMatrix ()
 
template<typename MatrixType >
 BlockSparseMatrix (const MatrixType &spmat)
 Constructor from a sparse matrix.
 
template<typename MatrixType >
BlockSparseMatrixoperator= (const MatrixType &spmat)
 Assignment from a sparse matrix with the same storage order.
 
template<typename MatrixType >
void setBlockStructure (const MatrixType &blockPattern)
 Set the nonzero block pattern of the matrix.
 
void resize (Index brow, Index bcol)
 Set the number of rows and columns blocks.
 
void setBlockSize (Index blockSize)
 set the block size at runtime for fixed-size block layout
 
void setBlockLayout (const VectorXi &rowBlocks, const VectorXi &colBlocks)
 Set the row and column block layouts,.
 
void reserve (const Index nonzerosblocks)
 Allocate the internal array of pointers to blocks and their inner indices.
 
template<typename InputIterator >
void setFromTriplets (const InputIterator &begin, const InputIterator &end)
 Fill values in a matrix from a triplet list.
 
Index rows () const
 
Index cols () const
 
Index innerSize () const
 
Index outerSize () const
 
Index blockRows () const
 
Index blockCols () const
 
Index outerBlocks () const
 
Index innerBlocks () const
 
Index outerToBlock (Index outer) const
 
Index innerToBlock (Index inner) const
 
Ref< BlockScalarcoeffRef (Index brow, Index bcol)
 
Map< const BlockScalarcoeff (Index brow, Index bcol) const
 
template<typename VecType >
BlockSparseTimeDenseProduct< BlockSparseMatrix, VecType > operator* (const VecType &lhs) const
 
Index nonZerosBlocks () const
 
Index nonZeros () const
 
BlockScalarReturnTypevaluePtr ()
 
StorageIndexinnerIndexPtr ()
 
const StorageIndexinnerIndexPtr () const
 
StorageIndexouterIndexPtr ()
 
const StorageIndexouterIndexPtr () const
 
bool isCompressed () const
 for compatibility purposes with the SparseMatrix class
 
Index blockRowsIndex (Index bi) const
 
Index blockColsIndex (Index bj) const
 
Index blockOuterIndex (Index bj) const
 
Index blockInnerIndex (Index bi) const
 
Index blockInnerSize (Index bi) const
 
Index blockOuterSize (Index bj) const
 
Index blockPtr (Index id) const
 
const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & derived () const
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & derived ()
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & const_cast_derived () const
 
Index size () const
 
bool isVector () const
 
bool isRValue () const
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & markAsRValue ()
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator+= (const SparseMatrixBase< OtherDerived > &other)
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator+= (const DiagonalBase< OtherDerived > &other)
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator+= (const EigenBase< OtherDerived > &other)
 
EIGEN_STRONG_INLINE BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator+= (const SparseMatrixBase< OtherDerived > &other)
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator-= (const SparseMatrixBase< OtherDerived > &other)
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator-= (const DiagonalBase< OtherDerived > &other)
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator-= (const EigenBase< OtherDerived > &other)
 
EIGEN_STRONG_INLINE BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator-= (const SparseMatrixBase< OtherDerived > &other)
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator*= (const Scalar &other)
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator*= (const SparseMatrixBase< OtherDerived > &other)
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & operator/= (const Scalar &other)
 
EIGEN_STRONG_INLINE const CwiseProductDenseReturnType< OtherDerived >::Type cwiseProduct (const MatrixBase< OtherDerived > &other) const
 
EIGEN_STRONG_INLINE const SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::template CwiseProductDenseReturnType< OtherDerived >::Type cwiseProduct (const MatrixBase< OtherDerived > &other) const
 
const Product< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, OtherDerived > operator* (const DiagonalBase< OtherDerived > &other) const
 
const Product< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, OtherDerived, AliasFreeProductoperator* (const SparseMatrixBase< OtherDerived > &other) const
 
const Product< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, OtherDerived > operator* (const MatrixBase< OtherDerived > &other) const
 
SparseSymmetricPermutationProduct< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, Upper|LowertwistedBy (const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const
 
const TriangularView< const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, Mode > triangularView () const
 
ConstSelfAdjointViewReturnType< UpLo >::Type selfadjointView () const
 
SelfAdjointViewReturnType< UpLo >::Type selfadjointView ()
 
SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::template ConstSelfAdjointViewReturnType< UpLo >::Type selfadjointView () const
 
SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::template SelfAdjointViewReturnType< UpLo >::Type selfadjointView ()
 
Scalar dot (const MatrixBase< OtherDerived > &other) const
 
Scalar dot (const SparseMatrixBase< OtherDerived > &other) const
 
internal::traits< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::Scalar dot (const MatrixBase< OtherDerived > &other) const
 
internal::traits< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::Scalar dot (const SparseMatrixBase< OtherDerived > &other) const
 
RealScalar squaredNorm () const
 
RealScalar norm () const
 
RealScalar blueNorm () const
 
TransposeReturnType transpose ()
 
const ConstTransposeReturnType transpose () const
 
const AdjointReturnType adjoint () const
 
InnerVectorReturnType innerVector (Index outer)
 
const ConstInnerVectorReturnType innerVector (Index outer) const
 
InnerVectorsReturnType innerVectors (Index outerStart, Index outerSize)
 
const ConstInnerVectorsReturnType innerVectors (Index outerStart, Index outerSize) const
 
DenseMatrixType toDense () const
 
bool isApprox (const SparseMatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
 
bool isApprox (const MatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
 
const internal::eval< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::type eval () const
 
Scalar sum () const
 
const SparseView< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > > pruned (const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const
 
EIGEN_DEVICE_FUNC const Derived & const_derived () const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void addTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void subTo (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void applyThisOnTheRight (Dest &dst) const
 
template<typename Dest >
EIGEN_DEVICE_FUNC void applyThisOnTheLeft (Dest &dst) const
 

Protected Member Functions

Map< BlockScalarinsert (Index brow, Index bcol)
 
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & assign (const OtherDerived &other)
 
void assignGeneric (const OtherDerived &other)
 

Static Protected Member Functions

static StorageIndex convert_index (const Index idx)
 

Protected Attributes

Index m_innerBSize
 
Index m_outerBSize
 
StorageIndexm_innerOffset
 
StorageIndexm_outerOffset
 
Index m_nonzerosblocks
 
Index m_nonzeros
 
Scalarm_values
 
StorageIndexm_blockPtr
 
StorageIndexm_indices
 
StorageIndexm_outerIndex
 
Index m_blockSize
 
bool m_isRValue
 

Private Member Functions

void evalTo (Dest &) const
 

Friends

void swap (BlockSparseMatrix &first, BlockSparseMatrix &second)
 
std::ostream & operator<< (std::ostream &s, const BlockSparseMatrix &m)
 

Detailed Description

template<typename _Scalar, int _BlockAtCompileTime, int _Options, typename _StorageIndex>
class Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >

A versatile sparse matrix representation where each element is a block.

This class provides routines to manipulate block sparse matrices stored in a BSR-like representation. There are two main types :

  1. All blocks have the same number of rows and columns, called block size in the following. In this case, if this block size is known at compile time, it can be given as a template parameter like
    A versatile sparse matrix representation where each element is a block.
    Definition BlockSparseMatrix.h:285
    Here, bmat is a b_rows x b_cols block sparse matrix where each coefficient is a 3x3 dense matrix. If the block size is fixed but will be given at runtime,
    bmat.setBlockSize(block_size);
  2. The second case is for variable-block sparse matrices. Here each block has its own dimensions. The only restriction is that all the blocks in a row (resp. a column) should have the same number of rows (resp. of columns). It is thus required in this case to describe the layout of the matrix by calling setBlockLayout(rowBlocks, colBlocks).

In any of the previous case, the matrix can be filled by calling setFromTriplets(). A regular sparse matrix can be converted to a block sparse matrix and vice versa. It is obviously required to describe the block layout beforehand by calling either setBlockSize() for fixed-size blocks or setBlockLayout for variable-size blocks.

Template Parameters
_ScalarThe Scalar type
_BlockAtCompileTimeThe block layout option. It takes the following values Dynamic : block size known at runtime a numeric number : fixed-size block known at compile time

Member Typedef Documentation

◆ AdjointReturnType

typedef internal::conditional<NumTraits<Scalar>::IsComplex,CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>,Eigen::Transpose<constDerived>>,Transpose<constDerived>>::type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::AdjointReturnType
inherited

◆ Base

typedef EigenBase<BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > > Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::Base
inherited

◆ BlockRealScalar

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
typedef Matrix<RealScalar, _BlockAtCompileTime, _BlockAtCompileTime,IsColMajor ? ColMajor : RowMajor> Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockRealScalar

◆ BlockScalar

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
typedef Matrix<Scalar, _BlockAtCompileTime, _BlockAtCompileTime,IsColMajor ? ColMajor : RowMajor> Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockScalar

◆ BlockScalarReturnType

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
typedef internal::conditional<_BlockAtCompileTime==Dynamic,Scalar,BlockScalar>::type Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockScalarReturnType

◆ CoeffReturnType

typedef internal::conditional<_HasDirectAccess,constScalar&,Scalar>::type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::CoeffReturnType
inherited

◆ ConstantReturnType

typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,Matrix<Scalar,Dynamic,Dynamic> > Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::ConstantReturnType
inherited

◆ ConstInnerVectorReturnType

typedef Block<const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > ,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::ConstInnerVectorReturnType
inherited

◆ ConstInnerVectorsReturnType

typedef Block<const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > ,Dynamic,Dynamic,true> Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::ConstInnerVectorsReturnType
inherited

◆ ConstTransposeReturnType

typedef internal::add_const<Transpose<constDerived>>::type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::ConstTransposeReturnType
inherited

◆ DenseMatrixType

typedef Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime> Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::DenseMatrixType
inherited

type of the equivalent dense matrix

◆ Index

template<typename Derived >
typedef Eigen::Index Eigen::EigenBase< Derived >::Index
inherited

The interface type of indices.

To change this, #define the preprocessor symbol EIGEN_DEFAULT_DENSE_INDEX_TYPE.

See also
StorageIndex, TopicPreprocessorDirectives.

◆ IndexVector

typedef Matrix<StorageIndex,Dynamic,1> Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::IndexVector
inherited

◆ InnerVectorReturnType

typedef Block<BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > ,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::InnerVectorReturnType
inherited

◆ InnerVectorsReturnType

typedef Block<BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > ,Dynamic,Dynamic,true> Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::InnerVectorsReturnType
inherited

◆ Nested

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
typedef internal::ref_selector<BlockSparseMatrix<_Scalar,_BlockAtCompileTime,_Options,_StorageIndex>>::type Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::Nested

◆ PacketReturnType

typedef internal::add_const_on_value_type_if_arithmetic<typenameinternal::packet_traits<Scalar>::type>::type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::PacketReturnType
inherited

◆ PacketScalar

typedef internal::packet_traits<Scalar>::type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::PacketScalar
inherited

◆ PlainObject

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
typedef BlockSparseMatrix<Scalar, BlockSize, IsColMajor ? ColMajor : RowMajor, StorageIndex> Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::PlainObject

◆ RealScalar

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
typedef NumTraits<Scalar>::Real Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::RealScalar

◆ Scalar

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
typedef _Scalar Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::Scalar

◆ ScalarVector

typedef Matrix<Scalar,Dynamic,1> Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::ScalarVector
inherited

◆ SquareMatrixType

typedef Matrix<Scalar,EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime), EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime)> Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::SquareMatrixType
inherited

type of the equivalent square matrix

◆ StorageBaseType

typedef SparseMatrixBase Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::StorageBaseType
inherited

◆ StorageIndex

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
typedef _StorageIndex Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::StorageIndex

◆ StorageKind

typedef internal::traits<BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::StorageKind Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::StorageKind
inherited

◆ TransposeReturnType

typedef Transpose<BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > > Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::TransposeReturnType
inherited

◆ value_type

typedef Scalar Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::value_type
inherited

The numeric type of the expression' coefficients, e.g. float, double, int or std::complex<float>, etc.

It is an alias for the Scalar type

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
inherited
57 {
58
59 RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
65 ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
72 SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
73 internal::traits<Derived>::ColsAtCompileTime>::ret),
78 MaxRowsAtCompileTime = RowsAtCompileTime,
79 MaxColsAtCompileTime = ColsAtCompileTime,
80
81 MaxSizeAtCompileTime = (internal::size_at_compile_time<MaxRowsAtCompileTime,
82 MaxColsAtCompileTime>::ret),
83
84 IsVectorAtCompileTime = RowsAtCompileTime == 1 || ColsAtCompileTime == 1,
90 Flags = internal::traits<Derived>::Flags,
96
97 InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime)
98 : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
99
100 #ifndef EIGEN_PARSED_BY_DOXYGEN
101 _HasDirectAccess = (int(Flags)&DirectAccessBit) ? 1 : 0 // workaround sunCC
102 #endif
103 };
const unsigned int DirectAccessBit
Definition Constants.h:150
const unsigned int RowMajorBit
Definition Constants.h:61

◆ anonymous enum

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
anonymous enum
Enumerator
Options 
Flags 
BlockSize 
RowsAtCompileTime 
ColsAtCompileTime 
MaxRowsAtCompileTime 
MaxColsAtCompileTime 
IsVectorAtCompileTime 
IsColMajor 
292 {
293 Options = _Options,
294 Flags = Options,
295 BlockSize=_BlockAtCompileTime,
302 };
@ Flags
Definition BlockSparseMatrix.h:294
@ IsVectorAtCompileTime
Definition BlockSparseMatrix.h:300
@ MaxColsAtCompileTime
Definition BlockSparseMatrix.h:299
@ BlockSize
Definition BlockSparseMatrix.h:295
@ MaxRowsAtCompileTime
Definition BlockSparseMatrix.h:298
@ RowsAtCompileTime
Definition BlockSparseMatrix.h:296
@ Options
Definition BlockSparseMatrix.h:293
@ IsColMajor
Definition BlockSparseMatrix.h:301
@ ColsAtCompileTime
Definition BlockSparseMatrix.h:297
const int Dynamic
Definition Constants.h:21

Constructor & Destructor Documentation

◆ BlockSparseMatrix() [1/4]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockSparseMatrix ( )
inline
313 { }
StorageIndex * m_indices
Definition BlockSparseMatrix.h:966
Index m_innerBSize
Definition BlockSparseMatrix.h:958
StorageIndex * m_outerIndex
Definition BlockSparseMatrix.h:967
Index m_outerBSize
Definition BlockSparseMatrix.h:959
Index m_blockSize
Definition BlockSparseMatrix.h:968
StorageIndex * m_blockPtr
Definition BlockSparseMatrix.h:965
Index m_nonzerosblocks
Definition BlockSparseMatrix.h:962
StorageIndex * m_innerOffset
Definition BlockSparseMatrix.h:960
Scalar * m_values
Definition BlockSparseMatrix.h:964
StorageIndex * m_outerOffset
Definition BlockSparseMatrix.h:961

◆ BlockSparseMatrix() [2/4]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockSparseMatrix ( Index  brow,
Index  bcol 
)
inline

Construct and resize.

321 : m_innerBSize(IsColMajor ? brow : bcol),
322 m_outerBSize(IsColMajor ? bcol : brow),
326 { }

◆ BlockSparseMatrix() [3/4]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockSparseMatrix ( const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > &  other)
inline

Copy-constructor.

332 : m_innerBSize(other.m_innerBSize),m_outerBSize(other.m_outerBSize),
333 m_nonzerosblocks(other.m_nonzerosblocks),m_nonzeros(other.m_nonzeros),
334 m_blockPtr(0),m_blockSize(other.m_blockSize)
335 {
336 // should we allow copying between variable-size blocks and fixed-size blocks ??
337 eigen_assert(m_blockSize == BlockSize && " CAN NOT COPY BETWEEN FIXED-SIZE AND VARIABLE-SIZE BLOCKS");
338
339 std::copy(other.m_innerOffset, other.m_innerOffset+m_innerBSize+1, m_innerOffset);
340 std::copy(other.m_outerOffset, other.m_outerOffset+m_outerBSize+1, m_outerOffset);
341 std::copy(other.m_values, other.m_values+m_nonzeros, m_values);
342
343 if(m_blockSize != Dynamic)
344 std::copy(other.m_blockPtr, other.m_blockPtr+m_nonzerosblocks, m_blockPtr);
345
346 std::copy(other.m_indices, other.m_indices+m_nonzerosblocks, m_indices);
347 std::copy(other.m_outerIndex, other.m_outerIndex+m_outerBSize, m_outerIndex);
348 }
#define eigen_assert(x)
Definition Macros.h:579
Index m_nonzeros
Definition BlockSparseMatrix.h:963

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockSize, Eigen::Dynamic, eigen_assert, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockPtr, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_indices, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_innerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_innerOffset, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_nonzeros, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_nonzerosblocks, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerIndex, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerOffset, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_values.

◆ ~BlockSparseMatrix()

◆ BlockSparseMatrix() [4/4]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
template<typename MatrixType >
Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockSparseMatrix ( const MatrixType &  spmat)
inline

Constructor from a sparse matrix.

390 {
391 EIGEN_STATIC_ASSERT((m_blockSize != Dynamic), THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE);
392
393 *this = spmat;
394 }
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition StaticAssert.h:124

References Eigen::Dynamic, EIGEN_STATIC_ASSERT, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize.

Member Function Documentation

◆ addTo()

template<typename Derived >
template<typename Dest >
EIGEN_DEVICE_FUNC void Eigen::EigenBase< Derived >::addTo ( Dest &  dst) const
inlineinherited
78 {
79 // This is the default implementation,
80 // derived class can reimplement it in a more optimized way.
81 typename Dest::PlainObject res(rows(),cols());
82 evalTo(res);
83 dst += res;
84 }
EIGEN_DEVICE_FUNC Index cols() const
Definition EigenBase.h:62
EIGEN_DEVICE_FUNC Index rows() const
Definition EigenBase.h:59
EIGEN_DEVICE_FUNC void evalTo(Dest &dst) const
Definition EigenBase.h:71

◆ adjoint()

const AdjointReturnType Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::adjoint ( ) const
inlineinherited
351{ return AdjointReturnType(transpose()); }
internal::conditional< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, Eigen::Transpose< constDerived > >, Transpose< constDerived > >::type AdjointReturnType
Definition SparseMatrixBase.h:109

◆ applyThisOnTheLeft()

template<typename Derived >
template<typename Dest >
EIGEN_DEVICE_FUNC void Eigen::EigenBase< Derived >::applyThisOnTheLeft ( Dest &  dst) const
inlineinherited
110 {
111 // This is the default implementation,
112 // derived class can reimplement it in a more optimized way.
113 dst = this->derived() * dst;
114 }
EIGEN_DEVICE_FUNC Derived & derived()
Definition EigenBase.h:45

References Eigen::EigenBase< Derived >::derived().

+ Here is the call graph for this function:

◆ applyThisOnTheRight()

template<typename Derived >
template<typename Dest >
EIGEN_DEVICE_FUNC void Eigen::EigenBase< Derived >::applyThisOnTheRight ( Dest &  dst) const
inlineinherited
101 {
102 // This is the default implementation,
103 // derived class can reimplement it in a more optimized way.
104 dst = dst * this->derived();
105 }

References Eigen::EigenBase< Derived >::derived().

+ Here is the call graph for this function:

◆ assign()

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::assign ( const OtherDerived &  other)
inlineprotectedinherited

◆ assignGeneric()

void Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::assignGeneric ( const OtherDerived &  other)
inlineprotectedinherited

◆ blockCols()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockCols ( ) const
inline

◆ blockColsIndex()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockColsIndex ( Index  bj) const
inline
Returns
the starting index of the bj col block
885 {
886 return IsColMajor ? blockOuterIndex(bj) : blockInnerIndex(bj);
887 }
Index blockInnerIndex(Index bi) const
Definition BlockSparseMatrix.h:893
Index blockOuterIndex(Index bj) const
Definition BlockSparseMatrix.h:889

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockInnerIndex(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockOuterIndex(), and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::IsColMajor.

+ Here is the call graph for this function:

◆ blockInnerIndex()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockInnerIndex ( Index  bi) const
inline

◆ blockInnerSize()

◆ blockOuterIndex()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockOuterIndex ( Index  bj) const
inline

◆ blockOuterSize()

◆ blockPtr()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockPtr ( Index  id) const
inline
Returns
the starting position of the block id in the array of values
937 {
938 if(m_blockSize == Dynamic) return m_blockPtr[id];
939 else return id * m_blockSize * m_blockSize;
940 //return blockDynIdx(id, typename internal::conditional<(BlockSize==Dynamic), internal::true_type, internal::false_type>::type());
941 }

References Eigen::Dynamic, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockPtr, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize.

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::coeff(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::coeffRef(), and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setFromTriplets().

+ Here is the caller graph for this function:

◆ blockRows()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockRows ( ) const
inline

◆ blockRowsIndex()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockRowsIndex ( Index  bi) const
inline
Returns
the starting index of the bi row block
877 {
878 return IsColMajor ? blockInnerIndex(bi) : blockOuterIndex(bi);
879 }

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockInnerIndex(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockOuterIndex(), and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::IsColMajor.

+ Here is the call graph for this function:

◆ blueNorm()

NumTraits< typenameinternal::traits< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::Scalar >::Real Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::blueNorm
inlineinherited
93{
94 return internal::blueNorm_impl(*this);
95}

◆ coeff()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Map< const BlockScalar > Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::coeff ( Index  brow,
Index  bcol 
) const
inline
Returns
the value of the (i,j) block as an Eigen Dense Matrix
833 {
834 eigen_assert(brow < blockRows() && "BLOCK ROW INDEX OUT OF BOUNDS");
835 eigen_assert(bcol < blockCols() && "BLOCK COLUMN OUT OF BOUNDS");
836
839 StorageIndex inner = IsColMajor ? brow : bcol;
840 StorageIndex outer = IsColMajor ? bcol : brow;
842 while(offset < m_outerIndex[outer+1] && m_indices[offset] != inner) offset++;
843 if(m_indices[offset] == inner)
844 {
845 return Map<const BlockScalar> (&(m_values[blockPtr(offset)]), rsize, csize);
846 }
847 else
848// return BlockScalar::Zero(rsize, csize);
849 eigen_assert("NOT YET SUPPORTED");
850 }
Index blockPtr(Index id) const
Definition BlockSparseMatrix.h:936
_StorageIndex StorageIndex
Definition BlockSparseMatrix.h:289
Index blockOuterSize(Index bj) const
Definition BlockSparseMatrix.h:903
Index blockRows() const
Definition BlockSparseMatrix.h:765
Index blockCols() const
Definition BlockSparseMatrix.h:770
Index blockInnerSize(Index bi) const
Definition BlockSparseMatrix.h:899
void offset(Slic3r::ExPolygon &sh, coord_t distance, const PolygonTag &)
Definition geometries.hpp:132

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockCols(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockInnerSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockOuterSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockPtr(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockRows(), eigen_assert, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::IsColMajor, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_indices, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerIndex, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_values.

+ Here is the call graph for this function:

◆ coeffRef()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Ref< BlockScalar > Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::coeffRef ( Index  brow,
Index  bcol 
)
inline
Returns
a reference to the (i,j) block as an Eigen Dense Matrix
807 {
808 eigen_assert(brow < blockRows() && "BLOCK ROW INDEX OUT OF BOUNDS");
809 eigen_assert(bcol < blockCols() && "BLOCK nzblocksFlagCOLUMN OUT OF BOUNDS");
810
813 StorageIndex inner = IsColMajor ? brow : bcol;
814 StorageIndex outer = IsColMajor ? bcol : brow;
816 while(offset < m_outerIndex[outer+1] && m_indices[offset] != inner)
817 offset++;
818 if(m_indices[offset] == inner)
819 {
820 return Map<BlockScalar>(&(m_values[blockPtr(offset)]), rsize, csize);
821 }
822 else
823 {
824 //FIXME the block does not exist, Insert it !!!!!!!!!
825 eigen_assert("DYNAMIC INSERTION IS NOT YET SUPPORTED");
826 }
827 }

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockCols(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockInnerSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockOuterSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockPtr(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockRows(), eigen_assert, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::IsColMajor, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_indices, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerIndex, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_values.

+ Here is the call graph for this function:

◆ cols()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::cols ( ) const
inline
Returns
the number of cols
748 {
749// return blockCols();
750 return (IsColMajor ? outerSize() : innerSize());
751 }
Index innerSize() const
Definition BlockSparseMatrix.h:753
Index outerSize() const
Definition BlockSparseMatrix.h:759

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::IsColMajor, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::outerSize().

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockInnerIterator::value(), and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockInnerIterator::valueRef().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ const_cast_derived()

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::const_cast_derived ( ) const
inlineinherited
141 { return *static_cast<Derived*>(const_cast<SparseMatrixBase*>(this)); }

◆ const_derived()

template<typename Derived >
EIGEN_DEVICE_FUNC const Derived & Eigen::EigenBase< Derived >::const_derived ( ) const
inlineinherited
55 { return *static_cast<const Derived*>(this); }

◆ convert_index()

static StorageIndex Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::convert_index ( const Index  idx)
inlinestaticprotectedinherited
396 {
397 return internal::convert_index<StorageIndex>(idx);
398 }

◆ cwiseProduct() [1/2]

EIGEN_STRONG_INLINE const SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::template CwiseProductDenseReturnType< OtherDerived >::Type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::cwiseProduct ( const MatrixBase< OtherDerived > &  other) const
inherited
692{
693 return typename CwiseProductDenseReturnType<OtherDerived>::Type(derived(), other.derived());
694}
const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & derived() const
Definition SparseMatrixBase.h:138

◆ cwiseProduct() [2/2]

EIGEN_STRONG_INLINE const CwiseProductDenseReturnType< OtherDerived >::Type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::cwiseProduct ( const MatrixBase< OtherDerived > &  other) const
inherited

◆ derived() [1/2]

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::derived ( )
inlineinherited
139{ return *static_cast<Derived*>(this); }

◆ derived() [2/2]

const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::derived ( ) const
inlineinherited
138{ return *static_cast<const Derived*>(this); }

◆ dot() [1/4]

internal::traits< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::Scalar Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::dot ( const MatrixBase< OtherDerived > &  other) const
inherited
19{
22 EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
23 EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
24 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
25
26 eigen_assert(size() == other.size());
27 eigen_assert(other.size()>0 && "you are using a non initialized vector");
28
29 internal::evaluator<Derived> thisEval(derived());
30 typename internal::evaluator<Derived>::InnerIterator i(thisEval, 0);
31 Scalar res(0);
32 while (i)
33 {
34 res += numext::conj(i.value()) * other.coeff(i.index());
35 ++i;
36 }
37 return res;
38}
#define EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(TYPE0, TYPE1)
Definition StaticAssert.h:164
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Definition StaticAssert.h:139
internal::traits< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::Scalar Scalar
Definition SparseMatrixBase.h:31

◆ dot() [2/4]

Scalar Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::dot ( const MatrixBase< OtherDerived > &  other) const
inherited

◆ dot() [3/4]

internal::traits< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::Scalar Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::dot ( const SparseMatrixBase< OtherDerived > &  other) const
inherited
44{
47 EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
48 EIGEN_STATIC_ASSERT((internal::is_same<Scalar, typename OtherDerived::Scalar>::value),
49 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
50
51 eigen_assert(size() == other.size());
52
53 internal::evaluator<Derived> thisEval(derived());
54 typename internal::evaluator<Derived>::InnerIterator i(thisEval, 0);
55
56 internal::evaluator<OtherDerived> otherEval(other.derived());
57 typename internal::evaluator<OtherDerived>::InnerIterator j(otherEval, 0);
58
59 Scalar res(0);
60 while (i && j)
61 {
62 if (i.index()==j.index())
63 {
64 res += numext::conj(i.value()) * j.value();
65 ++i; ++j;
66 }
67 else if (i.index()<j.index())
68 ++i;
69 else
70 ++j;
71 }
72 return res;
73}

◆ dot() [4/4]

Scalar Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::dot ( const SparseMatrixBase< OtherDerived > &  other) const
inherited

◆ eval()

const internal::eval< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::eval ( ) const
inlineinherited
Returns
the matrix or vector obtained by evaluating this expression.

Notice that in the case of a plain matrix or vector (not an expression) this function just returns a const reference, in order to avoid a useless copy.

385 { return typename internal::eval<Derived>::type(derived()); }

◆ evalTo()

void Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::evalTo ( Dest &  ) const
privateinherited

◆ innerBlocks()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerBlocks ( ) const
inline
776{ return m_innerBSize; }

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_innerBSize.

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setBlockLayout().

+ Here is the caller graph for this function:

◆ innerIndexPtr() [1/2]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
StorageIndex * Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerIndexPtr ( )
inline

◆ innerIndexPtr() [2/2]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
const StorageIndex * Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerIndexPtr ( ) const
inline

◆ innerSize()

◆ innerToBlock()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerToBlock ( Index  inner) const
inline
Returns
the block index where inner belongs to
792 {
793 eigen_assert(inner < innerSize() && "OUTER INDEX OUT OF BOUNDS");
794
795 if(m_blockSize != Dynamic)
796 return (inner / m_blockSize); // Integer division
797
798 StorageIndex b_inner = 0;
799 while(m_innerOffset[b_inner] <= inner) ++b_inner;
800 return b_inner - 1;
801 }

References Eigen::Dynamic, eigen_assert, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_innerOffset.

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ innerVector() [1/2]

SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::InnerVectorReturnType Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::innerVector ( Index  outer)
inherited
Returns
the outer -th column (resp. row) of the matrix *this if *this is col-major (resp. row-major).
334{ return InnerVectorReturnType(derived(), outer); }
Block< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, IsRowMajor?1:Dynamic, IsRowMajor?Dynamic:1, true > InnerVectorReturnType
Definition SparseMatrixBase.h:354

◆ innerVector() [2/2]

const SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::ConstInnerVectorReturnType Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::innerVector ( Index  outer) const
inherited
Returns
the outer -th column (resp. row) of the matrix *this if *this is col-major (resp. row-major). Read-only.
341{ return ConstInnerVectorReturnType(derived(), outer); }
Block< const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >, IsRowMajor?1:Dynamic, IsRowMajor?Dynamic:1, true > ConstInnerVectorReturnType
Definition SparseMatrixBase.h:355

◆ innerVectors() [1/2]

SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::InnerVectorsReturnType Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::innerVectors ( Index  outerStart,
Index  outerSize 
)
inherited
Returns
the outer -th column (resp. row) of the matrix *this if *this is col-major (resp. row-major).
349{
350 return Block<Derived,Dynamic,Dynamic,true>(derived(),
351 IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
353
354}

◆ innerVectors() [2/2]

const SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::ConstInnerVectorsReturnType Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::innerVectors ( Index  outerStart,
Index  outerSize 
) const
inherited
Returns
the outer -th column (resp. row) of the matrix *this if *this is col-major (resp. row-major). Read-only.
362{
363 return Block<const Derived,Dynamic,Dynamic,true>(derived(),
364 IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,
366
367}

◆ insert()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Map< BlockScalar > Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::insert ( Index  brow,
Index  bcol 
)
protected

◆ isApprox() [1/2]

bool Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::isApprox ( const MatrixBase< OtherDerived > &  other,
const RealScalar prec = NumTraits<Scalar>::dummy_precision() 
) const
inlineinherited
377 { return toDense().isApprox(other,prec); }

◆ isApprox() [2/2]

bool Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::isApprox ( const SparseMatrixBase< OtherDerived > &  other,
const RealScalar prec = NumTraits<Scalar>::dummy_precision() 
) const
inherited
18{
19 const typename internal::nested_eval<Derived,2,PlainObject>::type actualA(derived());
20 typename internal::conditional<bool(IsRowMajor)==bool(OtherDerived::IsRowMajor),
21 const typename internal::nested_eval<OtherDerived,2,PlainObject>::type,
22 const PlainObject>::type actualB(other.derived());
23
24 return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm());
25}
SparseMatrix< Scalar, Flags &RowMajorBit ? RowMajor :ColMajor, StorageIndex > PlainObject
Definition SparseMatrixBase.h:114

◆ isCompressed()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
bool Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::isCompressed ( ) const
inline

for compatibility purposes with the SparseMatrix class

872{return true;}

◆ isRValue()

bool Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::isRValue ( ) const
inlineinherited

◆ isVector()

bool Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::isVector ( ) const
inlineinherited
Returns
true if either the number of rows or the number of columns is equal to 1. In other words, this function returns
rows()==1 || cols()==1
Index rows() const
Definition BlockSparseMatrix.h:738
Index cols() const
Definition BlockSparseMatrix.h:747
See also
rows(), cols(), IsVectorAtCompileTime.
181{ return rows()==1 || cols()==1; }

◆ markAsRValue()

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::markAsRValue ( )
inlineinherited
190{ m_isRValue = true; return derived(); }

◆ nonZeros()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::nonZeros ( ) const
inline
Returns
the total number of nonzero elements, including eventual explicit zeros in blocks
862{ return m_nonzeros; }

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_nonzeros.

◆ nonZerosBlocks()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::nonZerosBlocks ( ) const
inline

◆ norm()

NumTraits< typenameinternal::traits< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::Scalar >::Real Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::norm
inlineinherited
85{
86 using std::sqrt;
87 return sqrt(squaredNorm());
88}
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Definition ArrayCwiseUnaryOps.h:152

◆ operator*() [1/4]

const Product< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > , OtherDerived > Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator* ( const DiagonalBase< OtherDerived > &  other) const
inlineinherited
298 { return Product<Derived,OtherDerived>(derived(), other.derived()); }

◆ operator*() [2/4]

const Product< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > , OtherDerived > Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator* ( const MatrixBase< OtherDerived > &  other) const
inlineinherited
315 { return Product<Derived,OtherDerived>(derived(), other.derived()); }

◆ operator*() [3/4]

const Product< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > , OtherDerived, AliasFreeProduct > Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator* ( const SparseMatrixBase< OtherDerived > &  other) const
inlineinherited
Returns
an expression of the product of two sparse matrices. By default a conservative product preserving the symbolic non zeros is performed. The automatic pruning of the small values can be achieved by calling the pruned() function in which case a totally different product algorithm is employed:
C = (A*B).pruned(); // supress numerical zeros (exact)
C = (A*B).pruned(ref);
C = (A*B).pruned(ref,epsilon);
const SparseView< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > > pruned(const Scalar &reference=Scalar(0), const RealScalar &epsilon=NumTraits< Scalar >::dummy_precision()) const
Definition SparseView.h:245
where ref is a meaningful non zero reference value.
30{
31 return Product<Derived,OtherDerived,AliasFreeProduct>(derived(), other.derived());
32}

◆ operator*() [4/4]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
template<typename VecType >
BlockSparseTimeDenseProduct< BlockSparseMatrix, VecType > Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::operator* ( const VecType &  lhs) const
inline
855 {
856 return BlockSparseTimeDenseProduct<BlockSparseMatrix, VecType>(*this, lhs);
857 }

◆ operator*=() [1/2]

EIGEN_STRONG_INLINE BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator*= ( const Scalar other)
inherited
125{
126 typedef typename internal::evaluator<Derived>::InnerIterator EvalIterator;
127 internal::evaluator<Derived> thisEval(derived());
128 for (Index j=0; j<outerSize(); ++j)
129 for (EvalIterator i(thisEval,j); i; ++i)
130 i.valueRef() *= other;
131 return derived();
132}

◆ operator*=() [2/2]

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator*= ( const SparseMatrixBase< OtherDerived > &  other)
inherited

◆ operator+=() [1/4]

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator+= ( const DiagonalBase< OtherDerived > &  other)
inherited
675{
676 call_assignment_no_alias(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
677 return derived();
678}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
Definition AssignEvaluator.h:819

◆ operator+=() [2/4]

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator+= ( const EigenBase< OtherDerived > &  other)
inherited
643{
644 call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
645 return derived();
646}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment(Dst &dst, const Src &src)
Definition AssignEvaluator.h:780

◆ operator+=() [3/4]

EIGEN_STRONG_INLINE BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator+= ( const SparseMatrixBase< OtherDerived > &  other)
inherited
668{
669 return derived() = derived() + other.derived();
670}

◆ operator+=() [4/4]

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator+= ( const SparseMatrixBase< OtherDerived > &  other)
inherited

◆ operator-=() [1/4]

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator-= ( const DiagonalBase< OtherDerived > &  other)
inherited
683{
684 call_assignment_no_alias(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
685 return derived();
686}

◆ operator-=() [2/4]

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator-= ( const EigenBase< OtherDerived > &  other)
inherited
651{
652 call_assignment(derived(), other.derived(), internal::assign_op<Scalar,typename OtherDerived::Scalar>());
653 return derived();
654}

◆ operator-=() [3/4]

EIGEN_STRONG_INLINE BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator-= ( const SparseMatrixBase< OtherDerived > &  other)
inherited
660{
661 return derived() = derived() - other.derived();
662}

◆ operator-=() [4/4]

BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator-= ( const SparseMatrixBase< OtherDerived > &  other)
inherited

◆ operator/=()

EIGEN_STRONG_INLINE BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > & Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::operator/= ( const Scalar other)
inherited
137{
138 typedef typename internal::evaluator<Derived>::InnerIterator EvalIterator;
139 internal::evaluator<Derived> thisEval(derived());
140 for (Index j=0; j<outerSize(); ++j)
141 for (EvalIterator i(thisEval,j); i; ++i)
142 i.valueRef() /= other;
143 return derived();
144}

◆ operator=() [1/2]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
BlockSparseMatrix & Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::operator= ( BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >  other)
inline
366 {
367 //Copy-and-swap paradigm ... avoid leaked data if thrown
368 swap(*this, other);
369 return *this;
370 }
friend void swap(BlockSparseMatrix &first, BlockSparseMatrix &second)
Definition BlockSparseMatrix.h:350

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::swap.

◆ operator=() [2/2]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
template<typename MatrixType >
BlockSparseMatrix & Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::operator= ( const MatrixType &  spmat)
inline

Assignment from a sparse matrix with the same storage order.

Convert from a sparse matrix to block sparse matrix.

Warning
Before calling this function, tt is necessary to call either setBlockLayout() (matrices with variable-size blocks) or setBlockSize() (for fixed-size blocks).
406 {
408 && "Trying to assign to a zero-size matrix, call resize() first");
409 eigen_assert(((MatrixType::Options&RowMajorBit) != IsColMajor) && "Wrong storage order");
410 typedef SparseMatrix<bool,MatrixType::Options,typename MatrixType::Index> MatrixPatternType;
411 MatrixPatternType blockPattern(blockRows(), blockCols());
412 m_nonzeros = 0;
413
414 // First, compute the number of nonzero blocks and their locations
415 for(StorageIndex bj = 0; bj < m_outerBSize; ++bj)
416 {
417 // Browse each outer block and compute the structure
418 std::vector<bool> nzblocksFlag(m_innerBSize,false); // Record the existing blocks
419 blockPattern.startVec(bj);
420 for(StorageIndex j = blockOuterIndex(bj); j < blockOuterIndex(bj+1); ++j)
421 {
422 typename MatrixType::InnerIterator it_spmat(spmat, j);
423 for(; it_spmat; ++it_spmat)
424 {
425 StorageIndex bi = innerToBlock(it_spmat.index()); // Index of the current nonzero block
426 if(!nzblocksFlag[bi])
427 {
428 // Save the index of this nonzero block
429 nzblocksFlag[bi] = true;
430 blockPattern.insertBackByOuterInnerUnordered(bj, bi) = true;
431 // Compute the total number of nonzeros (including explicit zeros in blocks)
433 }
434 }
435 } // end current outer block
436 }
437 blockPattern.finalize();
438
439 // Allocate the internal arrays
440 setBlockStructure(blockPattern);
441
442 for(StorageIndex nz = 0; nz < m_nonzeros; ++nz) m_values[nz] = Scalar(0);
443 for(StorageIndex bj = 0; bj < m_outerBSize; ++bj)
444 {
445 // Now copy the values
446 for(StorageIndex j = blockOuterIndex(bj); j < blockOuterIndex(bj+1); ++j)
447 {
448 // Browse the outer block column by column (for column-major matrices)
449 typename MatrixType::InnerIterator it_spmat(spmat, j);
450 for(; it_spmat; ++it_spmat)
451 {
452 StorageIndex idx = 0; // Position of this block in the column block
453 StorageIndex bi = innerToBlock(it_spmat.index()); // Index of the current nonzero block
454 // Go to the inner block where this element belongs to
455 while(bi > m_indices[m_outerIndex[bj]+idx]) ++idx; // Not expensive for ordered blocks
456 StorageIndex idxVal;// Get the right position in the array of values for this element
457 if(m_blockSize == Dynamic)
458 {
459 // Offset from all blocks before ...
460 idxVal = m_blockPtr[m_outerIndex[bj]+idx];
461 // ... and offset inside the block
462 idxVal += (j - blockOuterIndex(bj)) * blockOuterSize(bj) + it_spmat.index() - m_innerOffset[bi];
463 }
464 else
465 {
466 // All blocks before
467 idxVal = (m_outerIndex[bj] + idx) * m_blockSize * m_blockSize;
468 // inside the block
469 idxVal += (j - blockOuterIndex(bj)) * m_blockSize + (it_spmat.index()%m_blockSize);
470 }
471 // Insert the value
472 m_values[idxVal] = it_spmat.value();
473 } // end of this column
474 } // end of this block
475 } // end of this outer block
476
477 return *this;
478 }
void setBlockStructure(const MatrixType &blockPattern)
Set the nonzero block pattern of the matrix.
Definition BlockSparseMatrix.h:498
Index innerToBlock(Index inner) const
Definition BlockSparseMatrix.h:791
_Scalar Scalar
Definition BlockSparseMatrix.h:287

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockCols(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockInnerSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockOuterIndex(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockOuterSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockRows(), Eigen::Dynamic, eigen_assert, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerToBlock(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::IsColMajor, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockPtr, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_indices, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_innerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_innerOffset, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_nonzeros, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerIndex, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_values, Eigen::RowMajorBit, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setBlockStructure().

+ Here is the call graph for this function:

◆ outerBlocks()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::outerBlocks ( ) const
inline
775{ return m_outerBSize; }

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerBSize.

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setBlockLayout().

+ Here is the caller graph for this function:

◆ outerIndexPtr() [1/2]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
StorageIndex * Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::outerIndexPtr ( )
inline

◆ outerIndexPtr() [2/2]

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
const StorageIndex * Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::outerIndexPtr ( ) const
inline

◆ outerSize()

◆ outerToBlock()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::outerToBlock ( Index  outer) const
inline
Returns
the block index where outer belongs to
780 {
781 eigen_assert(outer < outerSize() && "OUTER INDEX OUT OF BOUNDS");
782
783 if(m_blockSize != Dynamic)
784 return (outer / m_blockSize); // Integer division
785
786 StorageIndex b_outer = 0;
787 while(m_outerOffset[b_outer] <= outer) ++b_outer;
788 return b_outer - 1;
789 }

References Eigen::Dynamic, eigen_assert, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerOffset, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::outerSize().

+ Here is the call graph for this function:

◆ pruned()

const SparseView< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > > Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::pruned ( const Scalar reference = Scalar(0),
const RealScalar epsilon = NumTraits<Scalar>::dummy_precision() 
) const
inlineinherited
Returns
an expression of *this with values smaller than reference * epsilon removed.

This method is typically used in conjunction with the product of two sparse matrices to automatically prune the smallest values as follows:

C = (A*B).pruned(); // suppress numerical zeros (exact)
C = (A*B).pruned(ref);
C = (A*B).pruned(ref,epsilon);

where ref is a meaningful non zero reference value.

247{
248 return SparseView<Derived>(derived(), reference, epsilon);
249}

◆ reserve()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
void Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::reserve ( const Index  nonzerosblocks)
inline

Allocate the internal array of pointers to blocks and their inner indices.

Note
For fixed-size blocks, call setBlockSize() to set the block. And For variable-size blocks, call setBlockLayout() before using this function
Parameters
nonzerosblocksNumber of nonzero blocks. The total number of nonzeros is is computed in setBlockLayout() for variable-size blocks
See also
setBlockSize()
597 {
598 eigen_assert((m_innerBSize != 0 && m_outerBSize != 0) &&
599 "TRYING TO RESERVE ZERO-SIZE MATRICES, CALL resize() first");
600
601 //FIXME Should free if already allocated
603
604 m_nonzerosblocks = nonzerosblocks;
605 if(m_blockSize != Dynamic)
606 {
607 m_nonzeros = nonzerosblocks * (m_blockSize * m_blockSize);
608 m_blockPtr = 0;
609 }
610 else
611 {
612 // m_nonzeros is already computed in setBlockLayout()
614 }
617 }

References Eigen::Dynamic, eigen_assert, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockPtr, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_indices, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_innerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_nonzeros, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_nonzerosblocks, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerIndex, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_values.

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setBlockStructure(), and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setFromTriplets().

+ Here is the caller graph for this function:

◆ resize()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
void Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::resize ( Index  brow,
Index  bcol 
)
inline

◆ rows()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::rows ( ) const
inline
Returns
the number of rows
739 {
740// return blockRows();
741 return (IsColMajor ? innerSize() : outerSize());
742 }

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::IsColMajor, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::outerSize().

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockInnerIterator::value(), and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockInnerIterator::valueRef().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selfadjointView() [1/4]

SelfAdjointViewReturnType< UpLo >::Type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::selfadjointView ( )
inlineinherited

◆ selfadjointView() [2/4]

SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::template SelfAdjointViewReturnType< UpLo >::Type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::selfadjointView ( )
inherited
183{
184 return SparseSelfAdjointView<Derived, UpLo>(derived());
185}

◆ selfadjointView() [3/4]

ConstSelfAdjointViewReturnType< UpLo >::Type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::selfadjointView ( ) const
inlineinherited

◆ selfadjointView() [4/4]

SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::template ConstSelfAdjointViewReturnType< UpLo >::Type Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::selfadjointView ( ) const
inherited
176{
177 return SparseSelfAdjointView<const Derived, UpLo>(derived());
178}

◆ setBlockLayout()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
void Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setBlockLayout ( const VectorXi &  rowBlocks,
const VectorXi &  colBlocks 
)
inline

Set the row and column block layouts,.

This function set the size of each row and column block. So this function should be used only for blocks with variable size.

Parameters
rowBlocks: Number of rows per row block
colBlocks: Number of columns per column block
See also
resize(), setBlockSize()
564 {
565 const VectorXi& innerBlocks = IsColMajor ? rowBlocks : colBlocks;
566 const VectorXi& outerBlocks = IsColMajor ? colBlocks : rowBlocks;
567 eigen_assert(m_innerBSize == innerBlocks.size() && "CHECK THE NUMBER OF ROW OR COLUMN BLOCKS");
568 eigen_assert(m_outerBSize == outerBlocks.size() && "CHECK THE NUMBER OF ROW OR COLUMN BLOCKS");
569 m_outerBSize = outerBlocks.size();
570 // starting index of blocks... cumulative sums
573 m_innerOffset[0] = 0;
574 m_outerOffset[0] = 0;
575 std::partial_sum(&innerBlocks[0], &innerBlocks[m_innerBSize-1]+1, &m_innerOffset[1]);
576 std::partial_sum(&outerBlocks[0], &outerBlocks[m_outerBSize-1]+1, &m_outerOffset[1]);
577
578 // Compute the total number of nonzeros
579 m_nonzeros = 0;
580 for(StorageIndex bj = 0; bj < m_outerBSize; ++bj)
581 for(StorageIndex bi = 0; bi < m_innerBSize; ++bi)
583
584 }
Index outerBlocks() const
Definition BlockSparseMatrix.h:775
Index innerBlocks() const
Definition BlockSparseMatrix.h:776

References eigen_assert, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerBlocks(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::IsColMajor, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_innerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_innerOffset, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_nonzeros, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerOffset, and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::outerBlocks().

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setFromTriplets().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBlockSize()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
void Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setBlockSize ( Index  blockSize)
inline

set the block size at runtime for fixed-size block layout

Call this only for fixed-size blocks

550 {
551 m_blockSize = blockSize;
552 }

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize.

◆ setBlockStructure()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
template<typename MatrixType >
void Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setBlockStructure ( const MatrixType &  blockPattern)
inline

Set the nonzero block pattern of the matrix.

Given a sparse matrix describing the nonzero block pattern, this function prepares the internal pointers for values. After calling this function, any nonzero block (bi, bj) can be set with a simple call to coeffRef(bi,bj).

Warning
Before calling this function, tt is necessary to call either setBlockLayout() (matrices with variable-size blocks) or setBlockSize() (for fixed-size blocks).
Parameters
blockPatternSparse matrix of boolean elements describing the block structure
See also
setBlockLayout()
setBlockSize()
499 {
500 resize(blockPattern.rows(), blockPattern.cols());
501 reserve(blockPattern.nonZeros());
502
503 // Browse the block pattern and set up the various pointers
504 m_outerIndex[0] = 0;
505 if(m_blockSize == Dynamic) m_blockPtr[0] = 0;
506 for(StorageIndex nz = 0; nz < m_nonzeros; ++nz) m_values[nz] = Scalar(0);
507 for(StorageIndex bj = 0; bj < m_outerBSize; ++bj)
508 {
509 //Browse each outer block
510
511 //First, copy and save the indices of nonzero blocks
512 //FIXME : find a way to avoid this ...
513 std::vector<int> nzBlockIdx;
514 typename MatrixType::InnerIterator it(blockPattern, bj);
515 for(; it; ++it)
516 {
517 nzBlockIdx.push_back(it.index());
518 }
519 std::sort(nzBlockIdx.begin(), nzBlockIdx.end());
520
521 // Now, fill block indices and (eventually) pointers to blocks
522 for(StorageIndex idx = 0; idx < nzBlockIdx.size(); ++idx)
523 {
524 StorageIndex offset = m_outerIndex[bj]+idx; // offset in m_indices
525 m_indices[offset] = nzBlockIdx[idx];
526 if(m_blockSize == Dynamic)
527 m_blockPtr[offset] = m_blockPtr[offset-1] + blockInnerSize(nzBlockIdx[idx]) * blockOuterSize(bj);
528 // There is no blockPtr for fixed-size blocks... not needed !???
529 }
530 // Save the pointer to the next outer block
531 m_outerIndex[bj+1] = m_outerIndex[bj] + nzBlockIdx.size();
532 }
533 }
void reserve(const Index nonzerosblocks)
Allocate the internal array of pointers to blocks and their inner indices.
Definition BlockSparseMatrix.h:596
void resize(Index brow, Index bcol)
Set the number of rows and columns blocks.
Definition BlockSparseMatrix.h:538

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockInnerSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockOuterSize(), Eigen::Dynamic, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockPtr, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_indices, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_nonzeros, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerIndex, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_values, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::reserve(), and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::resize().

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::operator=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFromTriplets()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
template<typename InputIterator >
void Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setFromTriplets ( const InputIterator &  begin,
const InputIterator &  end 
)
inline

Fill values in a matrix from a triplet list.

Each triplet item has a block stored in an Eigen dense matrix. The InputIterator class should provide the functions row(), col() and value()

Note
For fixed-size blocks, call setBlockSize() before this function.

FIXME Do not accept duplicates

632 {
633 eigen_assert((m_innerBSize!=0 && m_outerBSize !=0) && "ZERO BLOCKS, PLEASE CALL resize() before");
634
635 /* First, sort the triplet list
636 * FIXME This can be unnecessarily expensive since only the inner indices have to be sorted
637 * The best approach is like in SparseMatrix::setFromTriplets()
638 */
639 internal::TripletComp<InputIterator, IsColMajor> tripletcomp;
640 std::sort(begin, end, tripletcomp);
641
642 /* Count the number of rows and column blocks,
643 * and the number of nonzero blocks per outer dimension
644 */
645 VectorXi rowBlocks(m_innerBSize); // Size of each block row
646 VectorXi colBlocks(m_outerBSize); // Size of each block column
647 rowBlocks.setZero(); colBlocks.setZero();
648 VectorXi nzblock_outer(m_outerBSize); // Number of nz blocks per outer vector
649 VectorXi nz_outer(m_outerBSize); // Number of nz per outer vector...for variable-size blocks
650 nzblock_outer.setZero();
651 nz_outer.setZero();
652 for(InputIterator it(begin); it !=end; ++it)
653 {
654 eigen_assert(it->row() >= 0 && it->row() < this->blockRows() && it->col() >= 0 && it->col() < this->blockCols());
655 eigen_assert((it->value().rows() == it->value().cols() && (it->value().rows() == m_blockSize))
656 || (m_blockSize == Dynamic));
657
658 if(m_blockSize == Dynamic)
659 {
660 eigen_assert((rowBlocks[it->row()] == 0 || rowBlocks[it->row()] == it->value().rows()) &&
661 "NON CORRESPONDING SIZES FOR ROW BLOCKS");
662 eigen_assert((colBlocks[it->col()] == 0 || colBlocks[it->col()] == it->value().cols()) &&
663 "NON CORRESPONDING SIZES FOR COLUMN BLOCKS");
664 rowBlocks[it->row()] =it->value().rows();
665 colBlocks[it->col()] = it->value().cols();
666 }
667 nz_outer(IsColMajor ? it->col() : it->row()) += it->value().rows() * it->value().cols();
668 nzblock_outer(IsColMajor ? it->col() : it->row())++;
669 }
670 // Allocate member arrays
671 if(m_blockSize == Dynamic) setBlockLayout(rowBlocks, colBlocks);
672 StorageIndex nzblocks = nzblock_outer.sum();
673 reserve(nzblocks);
674
675 // Temporary markers
676 VectorXi block_id(m_outerBSize); // To be used as a block marker during insertion
677
678 // Setup outer index pointers and markers
679 m_outerIndex[0] = 0;
680 if (m_blockSize == Dynamic) m_blockPtr[0] = 0;
681 for(StorageIndex bj = 0; bj < m_outerBSize; ++bj)
682 {
683 m_outerIndex[bj+1] = m_outerIndex[bj] + nzblock_outer(bj);
684 block_id(bj) = m_outerIndex[bj];
686 {
687 m_blockPtr[m_outerIndex[bj+1]] = m_blockPtr[m_outerIndex[bj]] + nz_outer(bj);
688 }
689 }
690
691 // Fill the matrix
692 for(InputIterator it(begin); it!=end; ++it)
693 {
694 StorageIndex outer = IsColMajor ? it->col() : it->row();
695 StorageIndex inner = IsColMajor ? it->row() : it->col();
696 m_indices[block_id(outer)] = inner;
697 StorageIndex block_size = it->value().rows()*it->value().cols();
698 StorageIndex nz_marker = blockPtr(block_id[outer]);
699 memcpy(&(m_values[nz_marker]), it->value().data(), block_size * sizeof(Scalar));
700 if(m_blockSize == Dynamic)
701 {
702 m_blockPtr[block_id(outer)+1] = m_blockPtr[block_id(outer)] + block_size;
703 }
704 block_id(outer)++;
705 }
706
707 // An alternative when the outer indices are sorted...no need to use an array of markers
708// for(Index bcol = 0; bcol < m_outerBSize; ++bcol)
709// {
710// Index id = 0, id_nz = 0, id_nzblock = 0;
711// for(InputIterator it(begin); it!=end; ++it)
712// {
713// while (id<bcol) // one pass should do the job unless there are empty columns
714// {
715// id++;
716// m_outerIndex[id+1]=m_outerIndex[id];
717// }
718// m_outerIndex[id+1] += 1;
719// m_indices[id_nzblock]=brow;
720// Index block_size = it->value().rows()*it->value().cols();
721// m_blockPtr[id_nzblock+1] = m_blockPtr[id_nzblock] + block_size;
722// id_nzblock++;
723// memcpy(&(m_values[id_nz]),it->value().data(), block_size*sizeof(Scalar));
724// id_nz += block_size;
725// }
726// while(id < m_outerBSize-1) // Empty columns at the end
727// {
728// id++;
729// m_outerIndex[id+1]=m_outerIndex[id];
730// }
731// }
732 }
EIGEN_DEVICE_FUNC RowXpr row(Index i)
This is the const version of row(). *‍/.
Definition BlockMethods.h:859
void setBlockLayout(const VectorXi &rowBlocks, const VectorXi &colBlocks)
Set the row and column block layouts,.
Definition BlockSparseMatrix.h:563
T * begin(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:605
T * end(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:608

References Eigen::begin(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockPtr(), Eigen::Dynamic, eigen_assert, Eigen::end(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::IsColMajor, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockPtr, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_indices, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_innerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerBSize, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_outerIndex, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_values, Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::reserve(), and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setBlockLayout().

+ Here is the call graph for this function:

◆ size()

Index Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::size ( ) const
inlineinherited
Returns
the number of coefficients, which is rows()*cols().
See also
rows(), cols().
176{ return rows() * cols(); }

◆ squaredNorm()

NumTraits< typenameinternal::traits< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::Scalar >::Real Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::squaredNorm
inlineinherited
78{
79 return numext::real((*this).cwiseAbs2().sum());
80}

◆ subTo()

template<typename Derived >
template<typename Dest >
EIGEN_DEVICE_FUNC void Eigen::EigenBase< Derived >::subTo ( Dest &  dst) const
inlineinherited
90 {
91 // This is the default implementation,
92 // derived class can reimplement it in a more optimized way.
93 typename Dest::PlainObject res(rows(),cols());
94 evalTo(res);
95 dst -= res;
96 }

References Eigen::EigenBase< Derived >::cols(), Eigen::EigenBase< Derived >::evalTo(), and Eigen::EigenBase< Derived >::rows().

+ Here is the call graph for this function:

◆ sum()

internal::traits< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::Scalar Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::sum
inherited
18{
19 eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
20 Scalar res(0);
21 internal::evaluator<Derived> thisEval(derived());
22 for (Index j=0; j<outerSize(); ++j)
23 for (typename internal::evaluator<Derived>::InnerIterator iter(thisEval,j); iter; ++iter)
24 res += iter.value();
25 return res;
26}

◆ toDense()

DenseMatrixType Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::toDense ( ) const
inlineinherited
366 {
367 return DenseMatrixType(derived());
368 }
Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime > DenseMatrixType
Definition SparseMatrixBase.h:133

◆ transpose() [1/2]

TransposeReturnType Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::transpose ( )
inlineinherited
349{ return TransposeReturnType(derived()); }
Transpose< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > > TransposeReturnType
Definition SparseMatrixBase.h:110

◆ transpose() [2/2]

const ConstTransposeReturnType Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::transpose ( ) const
inlineinherited
internal::add_const< Transpose< constDerived > >::type ConstTransposeReturnType
Definition SparseMatrixBase.h:111

◆ triangularView()

const TriangularView< const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > , Mode > Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::triangularView
inlineinherited
183{
184 return TriangularView<const Derived, Mode>(derived());
185}

◆ twistedBy()

SparseSymmetricPermutationProduct< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > , Upper|Lower > Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::twistedBy ( const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &  perm) const
inlineinherited
Returns
an expression of P H P^-1 where H is the matrix represented by *this
325 {
326 return SparseSymmetricPermutationProduct<Derived,Upper|Lower>(derived(), perm);
327 }

◆ valuePtr()

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
BlockScalarReturnType * Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::valuePtr ( )
inline
864{return static_cast<BlockScalarReturnType *>(m_values);}
internal::conditional< _BlockAtCompileTime==Dynamic, Scalar, BlockScalar >::type BlockScalarReturnType
Definition BlockSparseMatrix.h:305

References Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_values.

Friends And Related Symbol Documentation

◆ operator<<

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
std::ostream & operator<< ( std::ostream &  s,
const BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > &  m 
)
friend
919 {
920 for (StorageIndex j = 0; j < m.outerBlocks(); ++j)
921 {
922 BlockInnerIterator itb(m, j);
923 for(; itb; ++itb)
924 {
925 s << "("<<itb.row() << ", " << itb.col() << ")\n";
926 s << itb.value() <<"\n";
927 }
928 }
929 s << std::endl;
930 return s;
931 }

◆ swap

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
void swap ( BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > &  first,
BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > &  second 
)
friend
351 {
352 std::swap(first.m_innerBSize, second.m_innerBSize);
353 std::swap(first.m_outerBSize, second.m_outerBSize);
354 std::swap(first.m_innerOffset, second.m_innerOffset);
355 std::swap(first.m_outerOffset, second.m_outerOffset);
356 std::swap(first.m_nonzerosblocks, second.m_nonzerosblocks);
357 std::swap(first.m_nonzeros, second.m_nonzeros);
358 std::swap(first.m_values, second.m_values);
359 std::swap(first.m_blockPtr, second.m_blockPtr);
360 std::swap(first.m_indices, second.m_indices);
361 std::swap(first.m_outerIndex, second.m_outerIndex);
362 std::swap(first.m_BlockSize, second.m_blockSize);
363 }

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::operator=().

Member Data Documentation

◆ m_blockPtr

◆ m_blockSize

template<typename _Scalar , int _BlockAtCompileTime, int _Options, typename _StorageIndex >
Index Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::m_blockSize
protected

Referenced by Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockSparseMatrix(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::BlockSparseMatrix(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockInnerIndex(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockInnerSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockOuterIndex(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockOuterSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::blockPtr(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::innerToBlock(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::operator=(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::outerSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::outerToBlock(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::reserve(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setBlockSize(), Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setBlockStructure(), and Eigen::BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex >::setFromTriplets().

◆ m_indices

◆ m_innerBSize

◆ m_innerOffset

◆ m_isRValue

bool Eigen::SparseMatrixBase< BlockSparseMatrix< _Scalar, _BlockAtCompileTime, _Options, _StorageIndex > >::m_isRValue
protectedinherited

◆ m_nonzeros

◆ m_nonzerosblocks

◆ m_outerBSize

◆ m_outerIndex

◆ m_outerOffset

◆ m_values


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