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

A versatible sparse matrix representation. More...

#include <src/eigen/Eigen/src/SparseCore/SparseMatrix.h>

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

Classes

struct  default_prunning_func
 
class  SingletonVector
 

Public Types

enum  { Options = _Options }
 
typedef MappedSparseMatrix< Scalar, FlagsMap
 
typedef Diagonal< SparseMatrixDiagonalReturnType
 
typedef Diagonal< const SparseMatrixConstDiagonalReturnType
 
typedef Base::InnerIterator InnerIterator
 
typedef Base::ReverseInnerIterator ReverseInnerIterator
 
typedef internal::CompressedStorage< Scalar, StorageIndexStorage
 
typedef Base::IndexVector IndexVector
 
typedef Base::ScalarVector ScalarVector
 
enum  {
  RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime , ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime , SizeAtCompileTime , MaxRowsAtCompileTime = RowsAtCompileTime ,
  MaxColsAtCompileTime = ColsAtCompileTime , MaxSizeAtCompileTime , IsVectorAtCompileTime = RowsAtCompileTime == 1 || ColsAtCompileTime == 1 , Flags = internal::traits<Derived>::Flags ,
  IsRowMajor = Flags&RowMajorBit ? 1 : 0 , InnerSizeAtCompileTime , _HasDirectAccess = (int(Flags)&DirectAccessBit) ? 1 : 0
}
 
typedef internal::traits< Derived >::Scalar Scalar
 
typedef Scalar value_type
 
typedef internal::packet_traits< Scalar >::type PacketScalar
 
typedef internal::traits< Derived >::StorageKind StorageKind
 
typedef internal::traits< Derived >::StorageIndex StorageIndex
 
typedef internal::add_const_on_value_type_if_arithmetic< typenameinternal::packet_traits< Scalar >::type >::type PacketReturnType
 
typedef SparseMatrixBase StorageBaseType
 
typedef internal::conditional< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, Eigen::Transpose< constDerived > >, Transpose< constDerived > >::type AdjointReturnType
 
typedef Transpose< Derived > TransposeReturnType
 
typedef internal::add_const< Transpose< constDerived > >::type ConstTransposeReturnType
 
typedef SparseMatrix< Scalar, Flags &RowMajorBit ? RowMajor :ColMajor, StorageIndexPlainObject
 
typedef NumTraits< Scalar >::Real RealScalar
 
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 Block< Derived, IsRowMajor?1:Dynamic, IsRowMajor?Dynamic:1, true > InnerVectorReturnType
 
typedef Block< const Derived, IsRowMajor?1:Dynamic, IsRowMajor?Dynamic:1, true > ConstInnerVectorReturnType
 
typedef Block< Derived, Dynamic, Dynamic, true > InnerVectorsReturnType
 
typedef Block< const Derived, Dynamic, Dynamic, true > ConstInnerVectorsReturnType
 
typedef Eigen::Index Index
 The interface type of indices.
 

Public Member Functions

Index rows () const
 
Index cols () const
 
Index innerSize () const
 
Index outerSize () const
 
const ScalarvaluePtr () const
 
ScalarvaluePtr ()
 
const StorageIndexinnerIndexPtr () const
 
StorageIndexinnerIndexPtr ()
 
const StorageIndexouterIndexPtr () const
 
StorageIndexouterIndexPtr ()
 
const StorageIndexinnerNonZeroPtr () const
 
StorageIndexinnerNonZeroPtr ()
 
Storagedata ()
 
const Storagedata () const
 
Scalar coeff (Index row, Index col) const
 
ScalarcoeffRef (Index row, Index col)
 
Scalarinsert (Index row, Index col)
 
void setZero ()
 
void reserve (Index reserveSize)
 
template<class SizesType >
void reserve (const SizesType &reserveSizes, const typename SizesType::value_type &enableif=typename SizesType::value_type())
 
ScalarinsertBack (Index row, Index col)
 
ScalarinsertBackByOuterInner (Index outer, Index inner)
 
ScalarinsertBackByOuterInnerUnordered (Index outer, Index inner)
 
void startVec (Index outer)
 
void finalize ()
 
template<typename InputIterators >
void setFromTriplets (const InputIterators &begin, const InputIterators &end)
 
template<typename InputIterators , typename DupFunctor >
void setFromTriplets (const InputIterators &begin, const InputIterators &end, DupFunctor dup_func)
 
void sumupDuplicates ()
 
template<typename DupFunctor >
void collapseDuplicates (DupFunctor dup_func=DupFunctor())
 
ScalarinsertByOuterInner (Index j, Index i)
 
void makeCompressed ()
 
void uncompress ()
 
void prune (const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision())
 
template<typename KeepFunc >
void prune (const KeepFunc &keep=KeepFunc())
 
void conservativeResize (Index rows, Index cols)
 
void resize (Index rows, Index cols)
 
void resizeNonZeros (Index size)
 
const ConstDiagonalReturnType diagonal () const
 
DiagonalReturnType diagonal ()
 
 SparseMatrix ()
 
 SparseMatrix (Index rows, Index cols)
 
template<typename OtherDerived >
 SparseMatrix (const SparseMatrixBase< OtherDerived > &other)
 
template<typename OtherDerived , unsigned int UpLo>
 SparseMatrix (const SparseSelfAdjointView< OtherDerived, UpLo > &other)
 
 SparseMatrix (const SparseMatrix &other)
 
template<typename OtherDerived >
 SparseMatrix (const ReturnByValue< OtherDerived > &other)
 Copy constructor with in-place evaluation.
 
template<typename OtherDerived >
 SparseMatrix (const DiagonalBase< OtherDerived > &other)
 Copy constructor with in-place evaluation.
 
void swap (SparseMatrix &other)
 
void setIdentity ()
 
SparseMatrixoperator= (const SparseMatrix &other)
 
template<typename OtherDerived >
SparseMatrixoperator= (const EigenBase< OtherDerived > &other)
 
template<typename OtherDerived >
EIGEN_DONT_INLINE SparseMatrixoperator= (const SparseMatrixBase< OtherDerived > &other)
 
 ~SparseMatrix ()
 
Scalar sum () const
 
EIGEN_STRONG_INLINE ScalarinsertBackUncompressed (Index row, Index col)
 
template<typename OtherDerived >
EIGEN_DONT_INLINE SparseMatrix< Scalar, _Options, _StorageIndex > & operator= (const SparseMatrixBase< OtherDerived > &other)
 
bool isCompressed () const
 
Index nonZeros () const
 
const Map< const Array< Scalar, Dynamic, 1 > > coeffs () const
 
Map< Array< Scalar, Dynamic, 1 > > coeffs ()
 
const Derived & derived () const
 
Derived & derived ()
 
Derived & const_cast_derived () const
 
Index size () const
 
bool isVector () const
 
bool isRValue () const
 
Derived & markAsRValue ()
 
template<typename OtherDerived >
Derived & operator+= (const SparseMatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Derived & operator+= (const DiagonalBase< OtherDerived > &other)
 
template<typename OtherDerived >
Derived & operator+= (const EigenBase< OtherDerived > &other)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived & operator+= (const SparseMatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Derived & operator-= (const SparseMatrixBase< OtherDerived > &other)
 
template<typename OtherDerived >
Derived & operator-= (const DiagonalBase< OtherDerived > &other)
 
template<typename OtherDerived >
Derived & operator-= (const EigenBase< OtherDerived > &other)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived & operator-= (const SparseMatrixBase< OtherDerived > &other)
 
Derived & operator*= (const Scalar &other)
 
template<typename OtherDerived >
Derived & operator*= (const SparseMatrixBase< OtherDerived > &other)
 
Derived & operator/= (const Scalar &other)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE const CwiseProductDenseReturnType< OtherDerived >::Type cwiseProduct (const MatrixBase< OtherDerived > &other) const
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE const SparseMatrixBase< Derived >::template CwiseProductDenseReturnType< OtherDerived >::Type cwiseProduct (const MatrixBase< OtherDerived > &other) const
 
template<typename OtherDerived >
const Product< Derived, OtherDerived > operator* (const DiagonalBase< OtherDerived > &other) const
 
template<typename OtherDerived >
const Product< Derived, OtherDerived, AliasFreeProductoperator* (const SparseMatrixBase< OtherDerived > &other) const
 
template<typename OtherDerived >
const Product< Derived, OtherDerived > operator* (const MatrixBase< OtherDerived > &other) const
 
SparseSymmetricPermutationProduct< Derived, Upper|LowertwistedBy (const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const
 
template<int Mode>
const TriangularView< const Derived, Mode > triangularView () const
 
template<unsigned int UpLo>
ConstSelfAdjointViewReturnType< UpLo >::Type selfadjointView () const
 
template<unsigned int UpLo>
SelfAdjointViewReturnType< UpLo >::Type selfadjointView ()
 
template<unsigned int UpLo>
SparseMatrixBase< Derived >::template ConstSelfAdjointViewReturnType< UpLo >::Type selfadjointView () const
 
template<unsigned int UpLo>
SparseMatrixBase< Derived >::template SelfAdjointViewReturnType< UpLo >::Type selfadjointView ()
 
template<typename OtherDerived >
Scalar dot (const MatrixBase< OtherDerived > &other) const
 
template<typename OtherDerived >
Scalar dot (const SparseMatrixBase< OtherDerived > &other) const
 
template<typename OtherDerived >
internal::traits< Derived >::Scalar dot (const MatrixBase< OtherDerived > &other) const
 
template<typename OtherDerived >
internal::traits< Derived >::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
 
template<typename OtherDerived >
bool isApprox (const SparseMatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
 
template<typename OtherDerived >
bool isApprox (const MatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
 
const internal::eval< Derived >::type eval () const
 
const SparseView< Derived > 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 Types

typedef SparseMatrix< Scalar,(Flags &~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> TransposedSparseMatrix
 

Protected Member Functions

template<class SizesType >
void reserveInnerVectors (const SizesType &reserveSizes)
 
template<typename Other >
void initAssignment (const Other &other)
 
EIGEN_DONT_INLINE ScalarinsertCompressed (Index row, Index col)
 
EIGEN_DONT_INLINE ScalarinsertUncompressed (Index row, Index col)
 
Eigen::Map< IndexVectorinnerNonZeros ()
 
const Eigen::Map< const IndexVectorinnerNonZeros () const
 
template<typename OtherDerived >
Derived & assign (const OtherDerived &other)
 
template<typename OtherDerived >
void assignGeneric (const OtherDerived &other)
 

Static Protected Member Functions

static StorageIndex convert_index (const Index idx)
 

Protected Attributes

Index m_outerSize
 
Index m_innerSize
 
StorageIndexm_outerIndex
 
StorageIndexm_innerNonZeros
 
Storage m_data
 
bool m_isRValue
 

Private Types

typedef SparseCompressedBase< SparseMatrixBase
 

Private Member Functions

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

Static Private Member Functions

static void check_template_parameters ()
 

Friends

class SparseVector< _Scalar, 0, _StorageIndex >
 
std::ostream & operator<< (std::ostream &s, const SparseMatrix &m)
 

Detailed Description

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

A versatible sparse matrix representation.

This class implements a more versatile variants of the common compressed row/column storage format. Each colmun's (resp. row) non zeros are stored as a pair of value with associated row (resp. colmiun) index. All the non zeros are stored in a single large buffer. Unlike the compressed format, there might be extra space inbetween the nonzeros of two successive colmuns (resp. rows) such that insertion of new non-zero can be done with limited memory reallocation and copies.

A call to the function makeCompressed() turns the matrix into the standard compressed format compatible with many library.

More details on this storage sceheme are given in the manual pages.

Template Parameters
_Scalarthe scalar type, i.e. the type of the coefficients
_OptionsUnion of bit flags controlling the storage scheme. Currently the only possibility is ColMajor or RowMajor. The default is 0 which means column-major.
_StorageIndexthe type of the indices. It has to be a signed type (e.g., short, int, std::ptrdiff_t). Default is int.
Warning
In Eigen 3.2, the undocumented type SparseMatrix::Index was improperly defined as the storage index type (e.g., int), whereas it is now (starting from Eigen 3.3) deprecated and always defined as Eigen::Index. Codes making use of SparseMatrix::Index, might thus likely have to be changed to use SparseMatrix::StorageIndex instead.

This class can be extended with the help of the plugin mechanism described on the page TopicCustomizing_Plugins by defining the preprocessor symbol EIGEN_SPARSEMATRIX_PLUGIN.

Member Typedef Documentation

◆ AdjointReturnType

template<typename Derived >
typedef internal::conditional<NumTraits<Scalar>::IsComplex,CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>,Eigen::Transpose<constDerived>>,Transpose<constDerived>>::type Eigen::SparseMatrixBase< Derived >::AdjointReturnType
inherited

◆ Base

template<typename _Scalar , int _Options, typename _StorageIndex >
typedef SparseCompressedBase<SparseMatrix> Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::Base
private

◆ CoeffReturnType

template<typename Derived >
typedef internal::conditional<_HasDirectAccess,constScalar&,Scalar>::type Eigen::SparseMatrixBase< Derived >::CoeffReturnType
inherited

◆ ConstantReturnType

template<typename Derived >
typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,Matrix<Scalar,Dynamic,Dynamic> > Eigen::SparseMatrixBase< Derived >::ConstantReturnType
inherited

◆ ConstDiagonalReturnType

template<typename _Scalar , int _Options, typename _StorageIndex >
typedef Diagonal<const SparseMatrix> Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::ConstDiagonalReturnType

◆ ConstInnerVectorReturnType

template<typename Derived >
typedef Block<const Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> Eigen::SparseMatrixBase< Derived >::ConstInnerVectorReturnType
inherited

◆ ConstInnerVectorsReturnType

template<typename Derived >
typedef Block<const Derived,Dynamic,Dynamic,true> Eigen::SparseMatrixBase< Derived >::ConstInnerVectorsReturnType
inherited

◆ ConstTransposeReturnType

template<typename Derived >
typedef internal::add_const<Transpose<constDerived>>::type Eigen::SparseMatrixBase< Derived >::ConstTransposeReturnType
inherited

◆ DenseMatrixType

template<typename Derived >
typedef Matrix<Scalar,RowsAtCompileTime,ColsAtCompileTime> Eigen::SparseMatrixBase< Derived >::DenseMatrixType
inherited

type of the equivalent dense matrix

◆ DiagonalReturnType

template<typename _Scalar , int _Options, typename _StorageIndex >
typedef Diagonal<SparseMatrix> Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::DiagonalReturnType

◆ 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

template<typename _Scalar , int _Options, typename _StorageIndex >
typedef Base::IndexVector Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::IndexVector

◆ InnerIterator

template<typename _Scalar , int _Options, typename _StorageIndex >
typedef Base::InnerIterator Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::InnerIterator

◆ InnerVectorReturnType

template<typename Derived >
typedef Block<Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> Eigen::SparseMatrixBase< Derived >::InnerVectorReturnType
inherited

◆ InnerVectorsReturnType

template<typename Derived >
typedef Block<Derived,Dynamic,Dynamic,true> Eigen::SparseMatrixBase< Derived >::InnerVectorsReturnType
inherited

◆ Map

template<typename _Scalar , int _Options, typename _StorageIndex >
typedef MappedSparseMatrix<Scalar,Flags> Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::Map

◆ PacketReturnType

template<typename Derived >
typedef internal::add_const_on_value_type_if_arithmetic<typenameinternal::packet_traits<Scalar>::type>::type Eigen::SparseMatrixBase< Derived >::PacketReturnType
inherited

◆ PacketScalar

template<typename Derived >
typedef internal::packet_traits<Scalar>::type Eigen::SparseMatrixBase< Derived >::PacketScalar
inherited

◆ PlainObject

template<typename Derived >
typedef SparseMatrix<Scalar, Flags&RowMajorBit ? RowMajor : ColMajor, StorageIndex> Eigen::SparseMatrixBase< Derived >::PlainObject
inherited

◆ RealScalar

template<typename Derived >
typedef NumTraits<Scalar>::Real Eigen::SparseMatrixBase< Derived >::RealScalar
inherited

This is the "real scalar" type; if the Scalar type is already real numbers (e.g. int, float or double) then RealScalar is just the same as Scalar. If Scalar is std::complex<T> then RealScalar is T.

See also
class NumTraits

◆ ReverseInnerIterator

template<typename _Scalar , int _Options, typename _StorageIndex >
typedef Base::ReverseInnerIterator Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::ReverseInnerIterator

◆ Scalar

template<typename Derived >
typedef internal::traits<Derived>::Scalar Eigen::SparseMatrixBase< Derived >::Scalar
inherited

◆ ScalarVector

template<typename _Scalar , int _Options, typename _StorageIndex >
typedef Base::ScalarVector Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::ScalarVector

◆ SquareMatrixType

template<typename Derived >
typedef Matrix<Scalar,EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime), EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime)> Eigen::SparseMatrixBase< Derived >::SquareMatrixType
inherited

type of the equivalent square matrix

◆ Storage

template<typename _Scalar , int _Options, typename _StorageIndex >
typedef internal::CompressedStorage<Scalar,StorageIndex> Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::Storage

◆ StorageBaseType

template<typename Derived >
typedef SparseMatrixBase Eigen::SparseMatrixBase< Derived >::StorageBaseType
inherited

◆ StorageIndex

template<typename Derived >
typedef internal::traits<Derived>::StorageIndex Eigen::SparseMatrixBase< Derived >::StorageIndex
inherited

The integer type used to store indices within a SparseMatrix. For a SparseMatrix<Scalar,Options,IndexType> it an alias of the third template parameter IndexType.

◆ StorageKind

template<typename Derived >
typedef internal::traits<Derived>::StorageKind Eigen::SparseMatrixBase< Derived >::StorageKind
inherited

◆ TransposedSparseMatrix

template<typename _Scalar , int _Options, typename _StorageIndex >
typedef SparseMatrix<Scalar,(Flags&~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::TransposedSparseMatrix
protected

◆ TransposeReturnType

template<typename Derived >
typedef Transpose<Derived> Eigen::SparseMatrixBase< Derived >::TransposeReturnType
inherited

◆ value_type

template<typename Derived >
typedef Scalar Eigen::SparseMatrixBase< Derived >::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

template<typename Derived >
anonymous enum
inherited
Enumerator
RowsAtCompileTime 

The number of rows at compile-time. This is just a copy of the value provided by the Derived type. If a value is not known at compile-time, it is set to the Dynamic constant.

See also
MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime
ColsAtCompileTime 

The number of columns at compile-time. This is just a copy of the value provided by the Derived type. If a value is not known at compile-time, it is set to the Dynamic constant.

See also
MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime
SizeAtCompileTime 

This is equal to the number of coefficients, i.e. the number of rows times the number of columns, or to Dynamic if this is not known at compile-time.

See also
RowsAtCompileTime, ColsAtCompileTime
MaxRowsAtCompileTime 
MaxColsAtCompileTime 
MaxSizeAtCompileTime 
IsVectorAtCompileTime 

This is set to true if either the number of rows or the number of columns is known at compile-time to be equal to 1. Indeed, in that case, we are dealing with a column-vector (if there is only one column) or with a row-vector (if there is only one row).

Flags 

This stores expression Flags flags which may or may not be inherited by new expressions constructed from this one. See the list of flags.

IsRowMajor 
InnerSizeAtCompileTime 
_HasDirectAccess 
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),
80
81 MaxSizeAtCompileTime = (internal::size_at_compile_time<MaxRowsAtCompileTime,
83
90 Flags = internal::traits<Derived>::Flags,
96
99
100 #ifndef EIGEN_PARSED_BY_DOXYGEN
101 _HasDirectAccess = (int(Flags)&DirectAccessBit) ? 1 : 0 // workaround sunCC
102 #endif
103 };
@ _HasDirectAccess
Definition SparseMatrixBase.h:101
@ InnerSizeAtCompileTime
Definition SparseMatrixBase.h:97
@ IsVectorAtCompileTime
Definition SparseMatrixBase.h:84
@ ColsAtCompileTime
Definition SparseMatrixBase.h:65
@ Flags
Definition SparseMatrixBase.h:90
@ RowsAtCompileTime
Definition SparseMatrixBase.h:59
@ MaxColsAtCompileTime
Definition SparseMatrixBase.h:79
@ MaxRowsAtCompileTime
Definition SparseMatrixBase.h:78
@ MaxSizeAtCompileTime
Definition SparseMatrixBase.h:81
@ SizeAtCompileTime
Definition SparseMatrixBase.h:72
@ IsRowMajor
Definition SparseMatrixBase.h:95
const unsigned int DirectAccessBit
Definition Constants.h:150
const unsigned int RowMajorBit
Definition Constants.h:61

◆ anonymous enum

template<typename _Scalar , int _Options, typename _StorageIndex >
anonymous enum
Enumerator
Options 
118 {
119 Options = _Options
120 };
@ Options
Definition SparseMatrix.h:119

Constructor & Destructor Documentation

◆ SparseMatrix() [1/7]

template<typename _Scalar , int _Options, typename _StorageIndex >
Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix ( )
inline

Default constructor yielding an empty 0 x 0 matrix

661 {
663 resize(0, 0);
664 }
Index m_outerSize
Definition SparseMatrix.h:127
StorageIndex * m_outerIndex
Definition SparseMatrix.h:129
StorageIndex * m_innerNonZeros
Definition SparseMatrix.h:130
Index m_innerSize
Definition SparseMatrix.h:128
static void check_template_parameters()
Definition SparseMatrix.h:900
void resize(Index rows, Index cols)
Definition SparseMatrix.h:621

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::check_template_parameters(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::resize().

+ Here is the call graph for this function:

◆ SparseMatrix() [2/7]

template<typename _Scalar , int _Options, typename _StorageIndex >
Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix ( Index  rows,
Index  cols 
)
inline

Constructs a rows x cols empty matrix

669 {
671 resize(rows, cols);
672 }
Index rows() const
Definition SparseMatrix.h:136
Index cols() const
Definition SparseMatrix.h:138

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::check_template_parameters(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::cols(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::resize(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows().

+ Here is the call graph for this function:

◆ SparseMatrix() [3/7]

template<typename _Scalar , int _Options, typename _StorageIndex >
template<typename OtherDerived >
Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix ( const SparseMatrixBase< OtherDerived > &  other)
inline

Constructs a sparse matrix from the sparse expression other

678 {
680 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
682 const bool needToTranspose = (Flags & RowMajorBit) != (internal::evaluator<OtherDerived>::Flags & RowMajorBit);
683 if (needToTranspose)
684 *this = other.derived();
685 else
686 {
687 #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
688 EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
689 #endif
690 internal::call_assignment_no_alias(*this, other.derived());
691 }
692 }
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition StaticAssert.h:124
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)
Definition AssignEvaluator.h:819
@ value
Definition Meta.h:63

References Eigen::internal::call_assignment_no_alias(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::check_template_parameters(), Eigen::SparseMatrixBase< Derived >::derived(), EIGEN_STATIC_ASSERT, Eigen::SparseMatrixBase< Derived >::Flags, and Eigen::RowMajorBit.

+ Here is the call graph for this function:

◆ SparseMatrix() [4/7]

template<typename _Scalar , int _Options, typename _StorageIndex >
template<typename OtherDerived , unsigned int UpLo>
Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix ( const SparseSelfAdjointView< OtherDerived, UpLo > &  other)
inline

Constructs a sparse matrix from the sparse selfadjoint view other

698 {
700 Base::operator=(other);
701 }
Derived & operator=(const EigenBase< OtherDerived > &other)
Definition SparseAssign.h:17

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::check_template_parameters(), and Eigen::SparseCompressedBase< Derived >::operator=().

+ Here is the call graph for this function:

◆ SparseMatrix() [5/7]

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

Copy constructor (it performs a deep copy)

706 {
708 *this = other.derived();
709 }
SparseCompressedBase< SparseMatrix > Base
Definition SparseMatrix.h:99

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::check_template_parameters(), and Eigen::SparseMatrixBase< Derived >::derived().

+ Here is the call graph for this function:

◆ SparseMatrix() [6/7]

template<typename _Scalar , int _Options, typename _StorageIndex >
template<typename OtherDerived >
Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix ( const ReturnByValue< OtherDerived > &  other)
inline

Copy constructor with in-place evaluation.

715 {
717 initAssignment(other);
718 other.evalTo(*this);
719 }
void initAssignment(const Other &other)
Definition SparseMatrix.h:850

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::check_template_parameters(), Eigen::ReturnByValue< Derived >::evalTo(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::initAssignment().

+ Here is the call graph for this function:

◆ SparseMatrix() [7/7]

template<typename _Scalar , int _Options, typename _StorageIndex >
template<typename OtherDerived >
Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix ( const DiagonalBase< OtherDerived > &  other)
inlineexplicit

Copy constructor with in-place evaluation.

725 {
727 *this = other.derived();
728 }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::check_template_parameters(), and Eigen::DiagonalBase< Derived >::derived().

+ Here is the call graph for this function:

◆ ~SparseMatrix()

template<typename _Scalar , int _Options, typename _StorageIndex >
Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::~SparseMatrix ( )
inline

Destructor

835 {
836 std::free(m_outerIndex);
837 std::free(m_innerNonZeros);
838 }

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()

template<typename Derived >
const AdjointReturnType Eigen::SparseMatrixBase< Derived >::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
TransposeReturnType transpose()
Definition SparseMatrixBase.h:349

References Eigen::SparseMatrixBase< Derived >::transpose().

Referenced by Eigen::IncompleteCholesky< Scalar, _UpLo, _OrderingType >::_solve_impl(), and Eigen::SparseSelfAdjointView< MatrixType, _Mode >::rankUpdate().

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

◆ 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()

template<typename Derived >
template<typename OtherDerived >
Derived & Eigen::SparseMatrixBase< Derived >::assign ( const OtherDerived &  other)
inlineprotectedinherited

◆ assignGeneric()

template<typename Derived >
template<typename OtherDerived >
void Eigen::SparseMatrixBase< Derived >::assignGeneric ( const OtherDerived &  other)
inlineprotectedinherited

◆ blueNorm()

template<typename Derived >
NumTraits< typenameinternal::traits< Derived >::Scalar >::Real Eigen::SparseMatrixBase< Derived >::blueNorm
inlineinherited
93{
94 return internal::blueNorm_impl(*this);
95}
NumTraits< typenametraits< Derived >::Scalar >::Real blueNorm_impl(const EigenBase< Derived > &_vec)
Definition StableNorm.h:55

References Eigen::internal::blueNorm_impl().

+ Here is the call graph for this function:

◆ check_template_parameters()

template<typename _Scalar , int _Options, typename _StorageIndex >
static void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::check_template_parameters ( )
inlinestaticprivate

◆ coeff()

template<typename _Scalar , int _Options, typename _StorageIndex >
Scalar Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::coeff ( Index  row,
Index  col 
) const
inline
Returns
the value of the matrix at position i, j This function returns Scalar(0) if the element is an explicit zero
189 {
190 eigen_assert(row>=0 && row<rows() && col>=0 && col<cols());
191
192 const Index outer = IsRowMajor ? row : col;
193 const Index inner = IsRowMajor ? col : row;
194 Index end = m_innerNonZeros ? m_outerIndex[outer] + m_innerNonZeros[outer] : m_outerIndex[outer+1];
195 return m_data.atInRange(m_outerIndex[outer], end, StorageIndex(inner));
196 }
EIGEN_DEVICE_FUNC RowXpr row(Index i)
This is the const version of row(). *‍/.
Definition BlockMethods.h:859
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col().
Definition BlockMethods.h:838
#define eigen_assert(x)
Definition Macros.h:579
internal::traits< Derived >::StorageIndex StorageIndex
Definition SparseMatrixBase.h:43
Storage m_data
Definition SparseMatrix.h:131
@ IsRowMajor
Definition SparseMatrixBase.h:95
Scalar atInRange(Index start, Index end, Index key, const Scalar &defaultValue=Scalar(0)) const
Definition CompressedStorage.h:159
T * end(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:608
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:33

References Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::atInRange(), col(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::cols(), eigen_assert, Eigen::end(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::IsRowMajor, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, row(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows().

+ Here is the call graph for this function:

◆ coeffRef()

template<typename _Scalar , int _Options, typename _StorageIndex >
Scalar & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::coeffRef ( Index  row,
Index  col 
)
inline
Returns
a non-const reference to the value of the matrix at position i, j

If the element does not exist then it is inserted via the insert(Index,Index) function which itself turns the matrix into a non compressed form if that was not the case.

This is a O(log(nnz_j)) operation (binary search) plus the cost of insert(Index,Index) function if the element does not already exist.

207 {
208 eigen_assert(row>=0 && row<rows() && col>=0 && col<cols());
209
210 const Index outer = IsRowMajor ? row : col;
211 const Index inner = IsRowMajor ? col : row;
212
213 Index start = m_outerIndex[outer];
214 Index end = m_innerNonZeros ? m_outerIndex[outer] + m_innerNonZeros[outer] : m_outerIndex[outer+1];
215 eigen_assert(end>=start && "you probably called coeffRef on a non finalized matrix");
216 if(end<=start)
217 return insert(row,col);
218 const Index p = m_data.searchLowerIndex(start,end-1,StorageIndex(inner));
219 if((p<end) && (m_data.index(p)==inner))
220 return m_data.value(p);
221 else
222 return insert(row,col);
223 }
Scalar & insert(Index row, Index col)
Definition SparseMatrix.h:1129
Scalar & value(Index i)
Definition CompressedStorage.h:118
StorageIndex & index(Index i)
Definition CompressedStorage.h:121
Index searchLowerIndex(Index key) const
Definition CompressedStorage.h:125

References col(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::cols(), eigen_assert, Eigen::end(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insert(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::IsRowMajor, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, row(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::searchLowerIndex(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

Referenced by igl::adjacency_matrix(), and igl::orientable_patches().

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

◆ coeffs() [1/2]

Map< Array< Scalar, Dynamic, 1 > > Eigen::SparseCompressedBase< SparseMatrix< _Scalar, _Options, _StorageIndex > >::coeffs ( )
inlineinherited
Returns
a read-write view of the stored coefficients as a 1D array expression
Warning
this method is for compressed storage only, and it will trigger an assertion otherwise.

Here is an example:

and the output is:

See also
valuePtr(), isCompressed()
126{ eigen_assert(isCompressed()); return Array<Scalar,Dynamic,1>::Map(valuePtr(),nonZeros()); }
const Scalar * valuePtr() const
Definition SparseCompressedBase.h:71
bool isCompressed() const
Definition SparseCompressedBase.h:107

◆ coeffs() [2/2]

const Map< const Array< Scalar, Dynamic, 1 > > Eigen::SparseCompressedBase< SparseMatrix< _Scalar, _Options, _StorageIndex > >::coeffs ( ) const
inlineinherited
Returns
a read-only view of the stored coefficients as a 1D array expression.
Warning
this method is for compressed storage only, and it will trigger an assertion otherwise.
See also
valuePtr(), isCompressed()
114{ eigen_assert(isCompressed()); return Array<Scalar,Dynamic,1>::Map(valuePtr(),nonZeros()); }

◆ collapseDuplicates()

template<typename Scalar , int _Options, typename _StorageIndex >
template<typename DupFunctor >
void Eigen::SparseMatrix< Scalar, _Options, _StorageIndex >::collapseDuplicates ( DupFunctor  dup_func = DupFunctor())
1018{
1020 // TODO, in practice we should be able to use m_innerNonZeros for that task
1021 IndexVector wi(innerSize());
1022 wi.fill(-1);
1023 StorageIndex count = 0;
1024 // for each inner-vector, wi[inner_index] will hold the position of first element into the index/value buffers
1025 for(Index j=0; j<outerSize(); ++j)
1026 {
1027 StorageIndex start = count;
1028 Index oldEnd = m_outerIndex[j]+m_innerNonZeros[j];
1029 for(Index k=m_outerIndex[j]; k<oldEnd; ++k)
1030 {
1031 Index i = m_data.index(k);
1032 if(wi(i)>=start)
1033 {
1034 // we already meet this entry => accumulate it
1035 m_data.value(wi(i)) = dup_func(m_data.value(wi(i)), m_data.value(k));
1036 }
1037 else
1038 {
1039 m_data.value(count) = m_data.value(k);
1040 m_data.index(count) = m_data.index(k);
1041 wi(i) = count;
1042 ++count;
1043 }
1044 }
1045 m_outerIndex[j] = start;
1046 }
1048
1049 // turn the matrix into compressed form
1050 std::free(m_innerNonZeros);
1051 m_innerNonZeros = 0;
1053}
Index innerSize() const
Definition SparseMatrix.h:141
Index outerSize() const
Definition SparseMatrix.h:143
bool isCompressed() const
Definition SparseCompressedBase.h:107
Base::IndexVector IndexVector
Definition SparseMatrix.h:122
void resize(Index size, double reserveSizeFactor=0)
Definition CompressedStorage.h:89
IGL_INLINE void count(const Eigen::SparseMatrix< XType > &X, const int dim, Eigen::SparseVector< SType > &S)
Definition count.cpp:12

References eigen_assert, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::resize(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

Referenced by Eigen::internal::set_from_triplets(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::sumupDuplicates().

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

◆ cols()

template<typename _Scalar , int _Options, typename _StorageIndex >
Index Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::cols ( ) const
inline
Returns
the number of columns of the matrix
138{ return IsRowMajor ? m_innerSize : m_outerSize; }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::IsRowMajor, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerSize, and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize.

Referenced by Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix(), igl::active_set(), igl::arap_dof_precomputation(), igl::arap_dof_recomputation(), igl::arap_precomputation(), igl::arap_rhs(), igl::AtA_cached_precompute(), igl::bfs(), igl::slim::build_linear_system(), igl::cat(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::coeff(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::coeffRef(), Eigen::IncompleteCholesky< Scalar, _UpLo, _OrderingType >::cols(), Eigen::IncompleteLUT< _Scalar, _StorageIndex >::cols(), Eigen::SimplicialCholeskyBase< Derived >::cols(), Eigen::SparseLU< _MatrixType, _OrderingType >::cols(), Eigen::SparseQR< _MatrixType, _OrderingType >::cols(), Eigen::SuperLUBase< _MatrixType, Derived >::cols(), igl::components(), Eigen::PastixBase< Derived >::compute(), Eigen::SPQR< _MatrixType >::compute(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::conservativeResize(), Eigen::SimplicialCholeskyBase< Derived >::dumpMemory(), igl::eigs(), Eigen::SimplicialCholeskyBase< Derived >::factorize_preordered(), igl::find_zero(), igl::harmonic(), igl::harmonic(), igl::harwell_boeing(), igl::matlab_format(), igl::max(), igl::min(), igl::min_quad_with_fixed_precompute(), Eigen::internal::minimum_degree_ordering(), igl::matlab::mlsetmatrix(), igl::mosek::mosek_linprog(), igl::mosek::mosek_quadprog(), igl::matlab::prepare_lhs_double(), igl::redux(), Eigen::MatrixMarketIterator< Scalar >::refX(), igl::repdiag(), igl::repmat(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::resize(), Eigen::MatrixMarketIterator< Scalar >::rhs(), Eigen::internal::Assignment< DstXprType, SrcXprType, Functor, Diagonal2Sparse >::run(), igl::matlab::MatlabWorkspace::save(), igl::serialization::serialize(), igl::xml::serialization_xml::serialize(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::setIdentity().

+ Here is the caller graph for this function:

◆ conservativeResize()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::conservativeResize ( Index  rows,
Index  cols 
)
inline

Resizes the matrix to a rows x cols matrix leaving old values untouched.

If the sizes of the matrix are decreased, then the matrix is turned to uncompressed-mode and the storage of the out of bounds coefficients is kept and reserved. Call makeCompressed() to pack the entries and squeeze extra memory.

See also
reserve(), setZero(), makeCompressed()
554 {
555 // No change
556 if (this->rows() == rows && this->cols() == cols) return;
557
558 // If one dimension is null, then there is nothing to be preserved
559 if(rows==0 || cols==0) return resize(rows,cols);
560
561 Index innerChange = IsRowMajor ? cols - this->cols() : rows - this->rows();
562 Index outerChange = IsRowMajor ? rows - this->rows() : cols - this->cols();
563 StorageIndex newInnerSize = convert_index(IsRowMajor ? cols : rows);
564
565 // Deals with inner non zeros
566 if (m_innerNonZeros)
567 {
568 // Resize m_innerNonZeros
569 StorageIndex *newInnerNonZeros = static_cast<StorageIndex*>(std::realloc(m_innerNonZeros, (m_outerSize + outerChange) * sizeof(StorageIndex)));
570 if (!newInnerNonZeros) internal::throw_std_bad_alloc();
571 m_innerNonZeros = newInnerNonZeros;
572
573 for(Index i=m_outerSize; i<m_outerSize+outerChange; i++)
574 m_innerNonZeros[i] = 0;
575 }
576 else if (innerChange < 0)
577 {
578 // Inner size decreased: allocate a new m_innerNonZeros
579 m_innerNonZeros = static_cast<StorageIndex*>(std::malloc((m_outerSize+outerChange+1) * sizeof(StorageIndex)));
581 for(Index i = 0; i < m_outerSize; i++)
583 }
584
585 // Change the m_innerNonZeros in case of a decrease of inner size
586 if (m_innerNonZeros && innerChange < 0)
587 {
588 for(Index i = 0; i < m_outerSize + (std::min)(outerChange, Index(0)); i++)
589 {
591 StorageIndex start = m_outerIndex[i];
592 while (n > 0 && m_data.index(start+n-1) >= newInnerSize) --n;
593 }
594 }
595
596 m_innerSize = newInnerSize;
597
598 // Re-allocate outer index structure if necessary
599 if (outerChange == 0)
600 return;
601
602 StorageIndex *newOuterIndex = static_cast<StorageIndex*>(std::realloc(m_outerIndex, (m_outerSize + outerChange + 1) * sizeof(StorageIndex)));
603 if (!newOuterIndex) internal::throw_std_bad_alloc();
604 m_outerIndex = newOuterIndex;
605 if (outerChange > 0)
606 {
608 for(Index i=m_outerSize; i<m_outerSize+outerChange+1; i++)
609 m_outerIndex[i] = last;
610 }
611 m_outerSize += outerChange;
612 }
static StorageIndex convert_index(const Index idx)
Definition SparseMatrixBase.h:396
EIGEN_DEVICE_FUNC void throw_std_bad_alloc()
Definition Memory.h:67

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::cols(), Eigen::SparseMatrixBase< Derived >::convert_index(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::IsRowMajor, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerSize, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::resize(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows(), and Eigen::internal::throw_std_bad_alloc().

Referenced by igl::shapeup_precomputation().

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

◆ const_cast_derived()

◆ 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()

template<typename Derived >
static StorageIndex Eigen::SparseMatrixBase< Derived >::convert_index ( const Index  idx)
inlinestaticprotectedinherited
396 {
397 return internal::convert_index<StorageIndex>(idx);
398 }

Referenced by Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::conservativeResize().

+ Here is the caller graph for this function:

◆ cwiseProduct() [1/2]

template<typename Derived >
template<typename OtherDerived >
EIGEN_STRONG_INLINE const SparseMatrixBase< Derived >::template CwiseProductDenseReturnType< OtherDerived >::Type Eigen::SparseMatrixBase< Derived >::cwiseProduct ( const MatrixBase< OtherDerived > &  other) const
inherited
692{
693 return typename CwiseProductDenseReturnType<OtherDerived>::Type(derived(), other.derived());
694}
CwiseBinaryOp< internal::scalar_product_op< typename ScalarBinaryOpTraits< typename internal::traits< Derived >::Scalar, typename internal::traits< OtherDerived >::Scalar >::ReturnType >, const Derived, const OtherDerived > Type
Definition SparseMatrixBase.h:287
const Derived & derived() const
Definition SparseMatrixBase.h:138

◆ cwiseProduct() [2/2]

template<typename Derived >
template<typename OtherDerived >
EIGEN_STRONG_INLINE const CwiseProductDenseReturnType< OtherDerived >::Type Eigen::SparseMatrixBase< Derived >::cwiseProduct ( const MatrixBase< OtherDerived > &  other) const
inherited

Referenced by Eigen::MatrixBase< Derived >::cwiseProduct().

+ Here is the caller graph for this function:

◆ data() [1/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
Storage & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::data ( )
inline

◆ data() [2/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
const Storage & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::data ( ) const
inline

◆ derived() [1/2]

template<typename Derived >
Derived & Eigen::SparseMatrixBase< Derived >::derived ( )
inlineinherited
139{ return *static_cast<Derived*>(this); }

◆ derived() [2/2]

template<typename Derived >
const Derived & Eigen::SparseMatrixBase< Derived >::derived ( ) const
inlineinherited
138{ return *static_cast<const Derived*>(this); }

Referenced by Eigen::DynamicSparseMatrix< _Scalar, _Options, _StorageIndex >::DynamicSparseMatrix(), Eigen::DynamicSparseMatrix< _Scalar, _Options, _StorageIndex >::DynamicSparseMatrix(), Eigen::Ref< const SparseMatrix< MatScalar, MatOptions, MatIndex >, Options, StrideType >::Ref(), Eigen::Ref< const SparseVector< MatScalar, MatOptions, MatIndex >, Options, StrideType >::Ref(), Eigen::Ref< SparseMatrix< MatScalar, MatOptions, MatIndex >, Options, StrideType >::Ref(), Eigen::Ref< SparseVector< MatScalar, MatOptions, MatIndex >, Options, StrideType >::Ref(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix(), Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::SparseVector(), Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::SparseVector(), Eigen::IterativeSolverBase< Derived >::_solve_impl(), Eigen::SparseSolverBase< Derived >::_solve_impl(), Eigen::CholmodBase< _MatrixType, _UpLo, Derived >::_solve_impl(), Eigen::SparseMatrixBase< Derived >::cols(), Eigen::SparseMatrixBase< Derived >::dot(), Eigen::SparseMatrixBase< Derived >::eval(), Eigen::SparseCompressedBase< Derived >::innerIndexPtr(), Eigen::SparseCompressedBase< Derived >::innerIndexPtr(), Eigen::SparseCompressedBase< Derived >::innerNonZeroPtr(), Eigen::SparseCompressedBase< Derived >::innerNonZeroPtr(), Eigen::SparseCompressedBase< Derived >::innerNonZeros(), Eigen::SparseCompressedBase< Derived >::innerNonZeros(), Eigen::SparseMatrixBase< Derived >::isApprox(), Eigen::SluMatrix::Map(), Eigen::SparseMatrixBase< Derived >::markAsRValue(), Eigen::SparseCompressedBase< Derived >::nonZeros(), Eigen::SparseMatrixBase< Derived >::operator*(), Eigen::operator*(), Eigen::SparseMatrixBase< Derived >::operator*(), Eigen::operator*(), Eigen::SparseMatrixBase< Derived >::operator*(), Eigen::SparseSelfAdjointView< MatrixType, _Mode >::operator*(), Eigen::operator*(), Eigen::operator*(), Eigen::SparseMatrixBase< Derived >::operator+=(), Eigen::SparseMatrixBase< Derived >::operator-=(), Eigen::internal::sparse_matrix_block_impl< SparseMatrixType, BlockRows, BlockCols >::operator=(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::operator=(), Eigen::SparseMatrixBase< Derived >::operator=(), Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::operator=(), Eigen::SparseCompressedBase< Derived >::outerIndexPtr(), Eigen::SparseCompressedBase< Derived >::outerIndexPtr(), Eigen::internal::permute_symm_to_fullsymm(), Eigen::internal::permute_symm_to_symm(), Eigen::SparseMatrixBase< Derived >::rows(), Eigen::SparseQR< _MatrixType, _OrderingType >::solve(), Eigen::SparseMatrixBase< Derived >::toDense(), Eigen::SparseMatrixBase< Derived >::transpose(), Eigen::SparseMatrixBase< Derived >::transpose(), Eigen::SparseMatrixBase< Derived >::twistedBy(), Eigen::SparseCompressedBase< Derived >::valuePtr(), and Eigen::SparseCompressedBase< Derived >::valuePtr().

◆ diagonal() [1/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
DiagonalReturnType Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::diagonal ( )
inline
Returns
a read-write expression of the diagonal coefficients.
Warning
If the diagonal entries are written, then all diagonal entries must already exist, otherwise an assertion will be raised.
656{ return DiagonalReturnType(*this); }
Diagonal< SparseMatrix > DiagonalReturnType
Definition SparseMatrix.h:110

◆ diagonal() [2/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
const ConstDiagonalReturnType Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::diagonal ( ) const
inline
Returns
a const expression of the diagonal coefficients.
650{ return ConstDiagonalReturnType(*this); }
Diagonal< const SparseMatrix > ConstDiagonalReturnType
Definition SparseMatrix.h:111

Referenced by igl::biharmonic_coordinates(), Eigen::SimplicialLLT< _MatrixType, _UpLo, _Ordering >::determinant(), igl::eigs(), and Eigen::MatrixMarketIterator< Scalar >::matrix().

+ Here is the caller graph for this function:

◆ dot() [1/4]

template<typename Derived >
template<typename OtherDerived >
internal::traits< Derived >::Scalar Eigen::SparseMatrixBase< Derived >::dot ( const MatrixBase< OtherDerived > &  other) const
inherited
19{
22 EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
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
Index size() const
Definition SparseMatrixBase.h:176
internal::traits< Derived >::Scalar Scalar
Definition SparseMatrixBase.h:31

References eigen_assert, EIGEN_STATIC_ASSERT, EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE, and EIGEN_STATIC_ASSERT_VECTOR_ONLY.

◆ dot() [2/4]

template<typename Derived >
template<typename OtherDerived >
Scalar Eigen::SparseMatrixBase< Derived >::dot ( const MatrixBase< OtherDerived > &  other) const
inherited

◆ dot() [3/4]

template<typename Derived >
template<typename OtherDerived >
internal::traits< Derived >::Scalar Eigen::SparseMatrixBase< Derived >::dot ( const SparseMatrixBase< OtherDerived > &  other) const
inherited
44{
47 EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived)
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}

References Eigen::SparseMatrixBase< Derived >::derived(), eigen_assert, EIGEN_STATIC_ASSERT, EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE, EIGEN_STATIC_ASSERT_VECTOR_ONLY, and Eigen::SparseMatrixBase< Derived >::size().

+ Here is the call graph for this function:

◆ dot() [4/4]

template<typename Derived >
template<typename OtherDerived >
Scalar Eigen::SparseMatrixBase< Derived >::dot ( const SparseMatrixBase< OtherDerived > &  other) const
inherited

◆ eval()

template<typename Derived >
const internal::eval< Derived >::type Eigen::SparseMatrixBase< Derived >::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()); }

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

Referenced by igl::biharmonic_coordinates().

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

◆ evalTo()

template<typename Derived >
template<typename Dest >
void Eigen::SparseMatrixBase< Derived >::evalTo ( Dest &  ) const
privateinherited

◆ finalize()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::finalize ( )
inline
423 {
424 if(isCompressed())
425 {
426 StorageIndex size = internal::convert_index<StorageIndex>(m_data.size());
427 Index i = m_outerSize;
428 // find the last filled column
429 while (i>=0 && m_outerIndex[i]==0)
430 --i;
431 ++i;
432 while (i<=m_outerSize)
433 {
434 m_outerIndex[i] = size;
435 ++i;
436 }
437 }
438 }
Index size() const
Definition CompressedStorage.h:109

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::isCompressed(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::size(), and Eigen::SparseMatrixBase< Derived >::size().

Referenced by igl::repmat(), and igl::speye().

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

◆ initAssignment()

template<typename _Scalar , int _Options, typename _StorageIndex >
template<typename Other >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::initAssignment ( const Other &  other)
inlineprotected
851 {
852 resize(other.rows(), other.cols());
854 {
855 std::free(m_innerNonZeros);
856 m_innerNonZeros = 0;
857 }
858 }

Referenced by Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::operator=().

+ Here is the caller graph for this function:

◆ innerIndexPtr() [1/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
StorageIndex * Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::innerIndexPtr ( )
inline
Returns
a non-const pointer to the array of inner indices. This function is aimed at interoperability with other libraries.
See also
valuePtr(), outerIndexPtr()
161{ return m_data.indexPtr(); }
const StorageIndex * indexPtr() const
Definition CompressedStorage.h:115

References Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::indexPtr(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data.

+ Here is the call graph for this function:

◆ innerIndexPtr() [2/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
const StorageIndex * Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::innerIndexPtr ( ) const
inline
Returns
a const pointer to the array of inner indices. This function is aimed at interoperability with other libraries.
See also
valuePtr(), outerIndexPtr()
157{ return m_data.indexPtr(); }

References Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::indexPtr(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data.

Referenced by Eigen::PastixBase< Derived >::analyzePattern(), igl::AtA_cached_precompute(), Eigen::PastixBase< Derived >::factorize(), Eigen::IncompleteCholesky< Scalar, _UpLo, _OrderingType >::factorize(), Eigen::internal::minimum_degree_ordering(), Eigen::internal::permute_symm_to_symm(), and Eigen::internal::Assignment< DstXprType, SrcXprType, Functor, Diagonal2Sparse >::run().

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

◆ innerNonZeroPtr() [1/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
StorageIndex * Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::innerNonZeroPtr ( )
inline
Returns
a non-const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries.
Warning
it returns the null pointer 0 in compressed mode
179{ return m_innerNonZeros; }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros.

◆ innerNonZeroPtr() [2/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
const StorageIndex * Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::innerNonZeroPtr ( ) const
inline
Returns
a const pointer to the array of the number of non zeros of the inner vectors. This function is aimed at interoperability with other libraries.
Warning
it returns the null pointer 0 in compressed mode
175{ return m_innerNonZeros; }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros.

◆ innerNonZeros() [1/2]

Eigen::Map< IndexVector > Eigen::SparseCompressedBase< SparseMatrix< _Scalar, _Options, _StorageIndex > >::innerNonZeros ( )
inlineprotectedinherited
A matrix or vector expression mapping an existing array of data.
Definition Map.h:96
const StorageIndex * innerNonZeroPtr() const
Definition SparseCompressedBase.h:100
Index outerSize() const
Definition SparseMatrixBase.h:184

◆ innerNonZeros() [2/2]

const Eigen::Map< const IndexVector > Eigen::SparseCompressedBase< SparseMatrix< _Scalar, _Options, _StorageIndex > >::innerNonZeros ( ) const
inlineprotectedinherited

◆ innerSize()

template<typename _Scalar , int _Options, typename _StorageIndex >
Index Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::innerSize ( ) const
inline
Returns
the number of rows (resp. columns) of the matrix if the storage order column major (resp. row major)
141{ return m_innerSize; }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerSize.

◆ innerVector() [1/2]

template<typename Derived >
SparseMatrixBase< Derived >::InnerVectorReturnType Eigen::SparseMatrixBase< Derived >::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< Derived, IsRowMajor?1:Dynamic, IsRowMajor?Dynamic:1, true > InnerVectorReturnType
Definition SparseMatrixBase.h:354

◆ innerVector() [2/2]

template<typename Derived >
const SparseMatrixBase< Derived >::ConstInnerVectorReturnType Eigen::SparseMatrixBase< Derived >::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 Derived, IsRowMajor?1:Dynamic, IsRowMajor?Dynamic:1, true > ConstInnerVectorReturnType
Definition SparseMatrixBase.h:355

◆ innerVectors() [1/2]

template<typename Derived >
SparseMatrixBase< Derived >::InnerVectorsReturnType Eigen::SparseMatrixBase< Derived >::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}
Index rows() const
Definition SparseMatrixBase.h:171
Index cols() const
Definition SparseMatrixBase.h:173

◆ innerVectors() [2/2]

template<typename Derived >
const SparseMatrixBase< Derived >::ConstInnerVectorsReturnType Eigen::SparseMatrixBase< Derived >::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 _Options, typename _StorageIndex >
SparseMatrix< _Scalar, _Options, _StorageIndex >::Scalar & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insert ( Index  row,
Index  col 
)
Returns
a reference to a novel non zero coefficient with coordinates row x col. The non zero coefficient must not already exist.

If the matrix *this is in compressed mode, then *this is turned into uncompressed mode while reserving room for 2 x this->innerSize() non zeros if reserve(Index) has not been called earlier. In this case, the insertion procedure is optimized for a sequential insertion mode where elements are assumed to be inserted by increasing outer-indices.

If that's not the case, then it is strongly recommended to either use a triplet-list to assemble the matrix, or to first call reserve(const SizesType &) to reserve the appropriate number of non-zero elements per inner vector.

Assuming memory has been appropriately reserved, this function performs a sorted insertion in O(1) if the elements of each inner vector are inserted in increasing inner index order, and in O(nnz_j) for a random insertion.

1130{
1131 eigen_assert(row>=0 && row<rows() && col>=0 && col<cols());
1132
1133 const Index outer = IsRowMajor ? row : col;
1134 const Index inner = IsRowMajor ? col : row;
1135
1136 if(isCompressed())
1137 {
1138 if(nonZeros()==0)
1139 {
1140 // reserve space if not already done
1141 if(m_data.allocatedSize()==0)
1143
1144 // turn the matrix into non-compressed mode
1145 m_innerNonZeros = static_cast<StorageIndex*>(std::malloc(m_outerSize * sizeof(StorageIndex)));
1147
1148 memset(m_innerNonZeros, 0, (m_outerSize)*sizeof(StorageIndex));
1149
1150 // pack all inner-vectors to the end of the pre-allocated space
1151 // and allocate the entire free-space to the first inner-vector
1153 for(Index j=1; j<=m_outerSize; ++j)
1154 m_outerIndex[j] = end;
1155 }
1156 else
1157 {
1158 // turn the matrix into non-compressed mode
1159 m_innerNonZeros = static_cast<StorageIndex*>(std::malloc(m_outerSize * sizeof(StorageIndex)));
1161 for(Index j=0; j<m_outerSize; ++j)
1163 }
1164 }
1165
1166 // check whether we can do a fast "push back" insertion
1167 Index data_end = m_data.allocatedSize();
1168
1169 // First case: we are filling a new inner vector which is packed at the end.
1170 // We assume that all remaining inner-vectors are also empty and packed to the end.
1171 if(m_outerIndex[outer]==data_end)
1172 {
1174
1175 // pack previous empty inner-vectors to end of the used-space
1176 // and allocate the entire free-space to the current inner-vector.
1178 Index j = outer;
1179 while(j>=0 && m_innerNonZeros[j]==0)
1180 m_outerIndex[j--] = p;
1181
1182 // push back the new element
1183 ++m_innerNonZeros[outer];
1184 m_data.append(Scalar(0), inner);
1185
1186 // check for reallocation
1187 if(data_end != m_data.allocatedSize())
1188 {
1189 // m_data has been reallocated
1190 // -> move remaining inner-vectors back to the end of the free-space
1191 // so that the entire free-space is allocated to the current inner-vector.
1194 for(Index k=outer+1; k<=m_outerSize; ++k)
1195 if(m_outerIndex[k]==data_end)
1196 m_outerIndex[k] = new_end;
1197 }
1198 return m_data.value(p);
1199 }
1200
1201 // Second case: the next inner-vector is packed to the end
1202 // and the current inner-vector end match the used-space.
1203 if(m_outerIndex[outer+1]==data_end && m_outerIndex[outer]+m_innerNonZeros[outer]==m_data.size())
1204 {
1205 eigen_internal_assert(outer+1==m_outerSize || m_innerNonZeros[outer+1]==0);
1206
1207 // add space for the new element
1208 ++m_innerNonZeros[outer];
1209 m_data.resize(m_data.size()+1);
1210
1211 // check for reallocation
1212 if(data_end != m_data.allocatedSize())
1213 {
1214 // m_data has been reallocated
1215 // -> move remaining inner-vectors back to the end of the free-space
1216 // so that the entire free-space is allocated to the current inner-vector.
1219 for(Index k=outer+1; k<=m_outerSize; ++k)
1220 if(m_outerIndex[k]==data_end)
1221 m_outerIndex[k] = new_end;
1222 }
1223
1224 // and insert it at the right position (sorted insertion)
1225 Index startId = m_outerIndex[outer];
1226 Index p = m_outerIndex[outer]+m_innerNonZeros[outer]-1;
1227 while ( (p > startId) && (m_data.index(p-1) > inner) )
1228 {
1229 m_data.index(p) = m_data.index(p-1);
1230 m_data.value(p) = m_data.value(p-1);
1231 --p;
1232 }
1233
1234 m_data.index(p) = convert_index(inner);
1235 return (m_data.value(p) = 0);
1236 }
1237
1238 if(m_data.size() != m_data.allocatedSize())
1239 {
1240 // make sure the matrix is compatible to random un-compressed insertion:
1242 this->reserveInnerVectors(Array<StorageIndex,Dynamic,1>::Constant(m_outerSize, 2));
1243 }
1244
1245 return insertUncompressed(row,col);
1246}
#define eigen_internal_assert(x)
Definition Macros.h:585
Index nonZeros() const
Definition SparseCompressedBase.h:56
void reserveInnerVectors(const SizesType &reserveSizes)
Definition SparseMatrix.h:297
EIGEN_DONT_INLINE Scalar & insertUncompressed(Index row, Index col)
Definition SparseMatrix.h:1249
void reserve(Index size)
Definition CompressedStorage.h:76
Index allocatedSize() const
Definition CompressedStorage.h:110
void append(const Scalar &v, Index i)
Definition CompressedStorage.h:101

References Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::allocatedSize(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::append(), col(), eigen_assert, eigen_internal_assert, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::reserve(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::resize(), row(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::size(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

Referenced by igl::cat(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::coeffRef(), igl::group_sum_matrix(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertByOuterInner(), igl::lbs_matrix_column(), igl::lbs_matrix_column(), igl::repdiag(), igl::repmat(), and igl::speye().

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

◆ insertBack()

template<typename _Scalar , int _Options, typename _StorageIndex >
Scalar & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertBack ( Index  row,
Index  col 
)
inline
384 {
386 }
Scalar & insertBackByOuterInner(Index outer, Index inner)
Definition SparseMatrix.h:390

References col(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertBackByOuterInner(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::IsRowMajor, and row().

+ Here is the call graph for this function:

◆ insertBackByOuterInner()

template<typename _Scalar , int _Options, typename _StorageIndex >
Scalar & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertBackByOuterInner ( Index  outer,
Index  inner 
)
inline
391 {
392 eigen_assert(Index(m_outerIndex[outer+1]) == m_data.size() && "Invalid ordered insertion (invalid outer index)");
393 eigen_assert( (m_outerIndex[outer+1]-m_outerIndex[outer]==0 || m_data.index(m_data.size()-1)<inner) && "Invalid ordered insertion (invalid inner index)");
394 Index p = m_outerIndex[outer+1];
395 ++m_outerIndex[outer+1];
396 m_data.append(Scalar(0), inner);
397 return m_data.value(p);
398 }

References Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::append(), eigen_assert, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::size(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

Referenced by Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertBack().

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

◆ insertBackByOuterInnerUnordered()

template<typename _Scalar , int _Options, typename _StorageIndex >
Scalar & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertBackByOuterInnerUnordered ( Index  outer,
Index  inner 
)
inline
403 {
404 Index p = m_outerIndex[outer+1];
405 ++m_outerIndex[outer+1];
406 m_data.append(Scalar(0), inner);
407 return m_data.value(p);
408 }

References Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::append(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

+ Here is the call graph for this function:

◆ insertBackUncompressed()

template<typename _Scalar , int _Options, typename _StorageIndex >
EIGEN_STRONG_INLINE Scalar & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertBackUncompressed ( Index  row,
Index  col 
)
inline
887 {
888 const Index outer = IsRowMajor ? row : col;
889 const Index inner = IsRowMajor ? col : row;
890
892 eigen_assert(m_innerNonZeros[outer]<=(m_outerIndex[outer+1] - m_outerIndex[outer]));
893
894 Index p = m_outerIndex[outer] + m_innerNonZeros[outer]++;
895 m_data.index(p) = convert_index(inner);
896 return (m_data.value(p) = Scalar(0));
897 }

References col(), eigen_assert, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), row(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

Referenced by Eigen::internal::set_from_triplets().

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

◆ insertByOuterInner()

template<typename _Scalar , int _Options, typename _StorageIndex >
Scalar & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertByOuterInner ( Index  j,
Index  i 
)
inline
458 {
459 return insert(IsRowMajor ? j : i, IsRowMajor ? i : j);
460 }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insert(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::IsRowMajor.

Referenced by Eigen::internal::permutation_matrix_product< ExpressionType, Side, Transposed, SparseShape >::run().

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

◆ insertCompressed()

template<typename _Scalar , int _Options, typename _StorageIndex >
EIGEN_DONT_INLINE SparseMatrix< _Scalar, _Options, _StorageIndex >::Scalar & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertCompressed ( Index  row,
Index  col 
)
protected
1282{
1284
1285 const Index outer = IsRowMajor ? row : col;
1286 const Index inner = IsRowMajor ? col : row;
1287
1288 Index previousOuter = outer;
1289 if (m_outerIndex[outer+1]==0)
1290 {
1291 // we start a new inner vector
1292 while (previousOuter>=0 && m_outerIndex[previousOuter]==0)
1293 {
1294 m_outerIndex[previousOuter] = convert_index(m_data.size());
1295 --previousOuter;
1296 }
1297 m_outerIndex[outer+1] = m_outerIndex[outer];
1298 }
1299
1300 // here we have to handle the tricky case where the outerIndex array
1301 // starts with: [ 0 0 0 0 0 1 ...] and we are inserted in, e.g.,
1302 // the 2nd inner vector...
1303 bool isLastVec = (!(previousOuter==-1 && m_data.size()!=0))
1304 && (std::size_t(m_outerIndex[outer+1]) == m_data.size());
1305
1306 std::size_t startId = m_outerIndex[outer];
1307 // FIXME let's make sure sizeof(long int) == sizeof(std::size_t)
1308 std::size_t p = m_outerIndex[outer+1];
1309 ++m_outerIndex[outer+1];
1310
1311 double reallocRatio = 1;
1313 {
1314 // if there is no preallocated memory, let's reserve a minimum of 32 elements
1315 if (m_data.size()==0)
1316 {
1317 m_data.reserve(32);
1318 }
1319 else
1320 {
1321 // we need to reallocate the data, to reduce multiple reallocations
1322 // we use a smart resize algorithm based on the current filling ratio
1323 // in addition, we use double to avoid integers overflows
1324 double nnzEstimate = double(m_outerIndex[outer])*double(m_outerSize)/double(outer+1);
1325 reallocRatio = (nnzEstimate-double(m_data.size()))/double(m_data.size());
1326 // furthermore we bound the realloc ratio to:
1327 // 1) reduce multiple minor realloc when the matrix is almost filled
1328 // 2) avoid to allocate too much memory when the matrix is almost empty
1329 reallocRatio = (std::min)((std::max)(reallocRatio,1.5),8.);
1330 }
1331 }
1332 m_data.resize(m_data.size()+1,reallocRatio);
1333
1334 if (!isLastVec)
1335 {
1336 if (previousOuter==-1)
1337 {
1338 // oops wrong guess.
1339 // let's correct the outer offsets
1340 for (Index k=0; k<=(outer+1); ++k)
1341 m_outerIndex[k] = 0;
1342 Index k=outer+1;
1343 while(m_outerIndex[k]==0)
1344 m_outerIndex[k++] = 1;
1345 while (k<=m_outerSize && m_outerIndex[k]!=0)
1346 m_outerIndex[k++]++;
1347 p = 0;
1348 --k;
1349 k = m_outerIndex[k]-1;
1350 while (k>0)
1351 {
1352 m_data.index(k) = m_data.index(k-1);
1353 m_data.value(k) = m_data.value(k-1);
1354 k--;
1355 }
1356 }
1357 else
1358 {
1359 // we are not inserting into the last inner vec
1360 // update outer indices:
1361 Index j = outer+2;
1362 while (j<=m_outerSize && m_outerIndex[j]!=0)
1363 m_outerIndex[j++]++;
1364 --j;
1365 // shift data of last vecs:
1366 Index k = m_outerIndex[j]-1;
1367 while (k>=Index(p))
1368 {
1369 m_data.index(k) = m_data.index(k-1);
1370 m_data.value(k) = m_data.value(k-1);
1371 k--;
1372 }
1373 }
1374 }
1375
1376 while ( (p > startId) && (m_data.index(p-1) > inner) )
1377 {
1378 m_data.index(p) = m_data.index(p-1);
1379 m_data.value(p) = m_data.value(p-1);
1380 --p;
1381 }
1382
1383 m_data.index(p) = inner;
1384 return (m_data.value(p) = Scalar(0));
1385}

References Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::allocatedSize(), col(), eigen_assert, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::reserve(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::resize(), row(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::size(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

+ Here is the call graph for this function:

◆ insertUncompressed()

template<typename _Scalar , int _Options, typename _StorageIndex >
EIGEN_DONT_INLINE SparseMatrix< _Scalar, _Options, _StorageIndex >::Scalar & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertUncompressed ( Index  row,
Index  col 
)
protected
1250{
1252
1253 const Index outer = IsRowMajor ? row : col;
1254 const StorageIndex inner = convert_index(IsRowMajor ? col : row);
1255
1256 Index room = m_outerIndex[outer+1] - m_outerIndex[outer];
1257 StorageIndex innerNNZ = m_innerNonZeros[outer];
1258 if(innerNNZ>=room)
1259 {
1260 // this inner vector is full, we need to reallocate the whole buffer :(
1261 reserve(SingletonVector(outer,std::max<StorageIndex>(2,innerNNZ)));
1262 }
1263
1264 Index startId = m_outerIndex[outer];
1265 Index p = startId + m_innerNonZeros[outer];
1266 while ( (p > startId) && (m_data.index(p-1) > inner) )
1267 {
1268 m_data.index(p) = m_data.index(p-1);
1269 m_data.value(p) = m_data.value(p-1);
1270 --p;
1271 }
1272 eigen_assert((p<=startId || m_data.index(p-1)!=inner) && "you cannot insert an element that already exists, you must call coeffRef to this end");
1273
1274 m_innerNonZeros[outer]++;
1275
1276 m_data.index(p) = inner;
1277 return (m_data.value(p) = Scalar(0));
1278}
void reserve(Index reserveSize)
Definition SparseMatrix.h:262

References col(), eigen_assert, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), row(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

+ Here is the call graph for this function:

◆ isApprox() [1/2]

template<typename Derived >
template<typename OtherDerived >
bool Eigen::SparseMatrixBase< Derived >::isApprox ( const MatrixBase< OtherDerived > &  other,
const RealScalar prec = NumTraits<Scalar>::dummy_precision() 
) const
inlineinherited
377 { return toDense().isApprox(other,prec); }
DenseMatrixType toDense() const
Definition SparseMatrixBase.h:365

References Eigen::SparseMatrixBase< Derived >::toDense().

+ Here is the call graph for this function:

◆ isApprox() [2/2]

template<typename Derived >
template<typename OtherDerived >
bool Eigen::SparseMatrixBase< Derived >::isApprox ( const SparseMatrixBase< OtherDerived > &  other,
const RealScalar prec = NumTraits<Scalar>::dummy_precision() 
) const
inherited
18{
20 typename internal::conditional<bool(IsRowMajor)==bool(OtherDerived::IsRowMajor),
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
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T &x, const T &y)
Definition MathFunctions.h:815
conditional< Evaluate, PlainObject, typenameref_selector< T >::type >::type type
Definition XprHelper.h:452

References Eigen::SparseMatrixBase< Derived >::derived(), and Eigen::numext::mini().

+ Here is the call graph for this function:

◆ isCompressed()

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

◆ isRValue()

template<typename Derived >
bool Eigen::SparseMatrixBase< Derived >::isRValue ( ) const
inlineinherited
189{ return m_isRValue; }
bool m_isRValue
Definition SparseMatrixBase.h:394

References Eigen::SparseMatrixBase< Derived >::m_isRValue.

Referenced by Eigen::DynamicSparseMatrix< _Scalar, _Options, _StorageIndex >::operator=(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::operator=(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::operator=(), and Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::operator=().

+ Here is the caller graph for this function:

◆ isVector()

template<typename Derived >
bool Eigen::SparseMatrixBase< Derived >::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
See also
rows(), cols(), IsVectorAtCompileTime.
181{ return rows()==1 || cols()==1; }

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

+ Here is the call graph for this function:

◆ makeCompressed()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::makeCompressed ( )
inline

Turns the matrix into the compressed format.

465 {
466 if(isCompressed())
467 return;
468
470
471 Index oldStart = m_outerIndex[1];
473 for(Index j=1; j<m_outerSize; ++j)
474 {
475 Index nextOldStart = m_outerIndex[j+1];
476 Index offset = oldStart - m_outerIndex[j];
477 if(offset>0)
478 {
479 for(Index k=0; k<m_innerNonZeros[j]; ++k)
480 {
481 m_data.index(m_outerIndex[j]+k) = m_data.index(oldStart+k);
482 m_data.value(m_outerIndex[j]+k) = m_data.value(oldStart+k);
483 }
484 }
486 oldStart = nextOldStart;
487 }
488 std::free(m_innerNonZeros);
489 m_innerNonZeros = 0;
491 m_data.squeeze();
492 }
void squeeze()
Definition CompressedStorage.h:83
void offset(Slic3r::ExPolygon &sh, coord_t distance, const PolygonTag &)
Definition geometries.hpp:132

References eigen_internal_assert, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::isCompressed(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::resize(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::squeeze(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

Referenced by igl::arap_linear_block_elements(), igl::arap_linear_block_spokes(), igl::arap_linear_block_spokes_and_rims(), igl::AtA_cached_precompute(), igl::slim::build_linear_system(), igl::cat(), Eigen::PardisoLU< MatrixType >::getMatrix(), Eigen::PardisoLLT< MatrixType, _UpLo >::getMatrix(), Eigen::PardisoLDLT< MatrixType, Options >::getMatrix(), igl::group_sum_matrix(), igl::lbs_matrix_column(), igl::lbs_matrix_column(), igl::slim::pre_calc(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::prune(), igl::repdiag(), Eigen::internal::Assignment< DstXprType, SrcXprType, Functor, Diagonal2Sparse >::run(), and igl::slice_cached_precompute().

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

◆ markAsRValue()

template<typename Derived >
Derived & Eigen::SparseMatrixBase< Derived >::markAsRValue ( )
inlineinherited
190{ m_isRValue = true; return derived(); }

References Eigen::SparseMatrixBase< Derived >::derived(), and Eigen::SparseMatrixBase< Derived >::m_isRValue.

+ Here is the call graph for this function:

◆ nonZeros()

template<typename _Scalar , int _Options, typename _StorageIndex >
Index Eigen::SparseCompressedBase< Derived >::nonZeros ( ) const
inline
Returns
the number of non zero coefficients
57 {
58 if(Derived::IsVectorAtCompileTime && outerIndexPtr()==0)
59 return derived().nonZeros();
60 else if(isCompressed())
61 return outerIndexPtr()[derived().outerSize()]-outerIndexPtr()[0];
62 else if(derived().outerSize()==0)
63 return 0;
64 else
65 return innerNonZeros().sum();
66 }
Eigen::Map< IndexVector > innerNonZeros()
Definition SparseCompressedBase.h:50
StorageIndex * outerIndexPtr()
Definition SparseMatrix.h:170

Referenced by Eigen::SimplicialCholeskyBase< Derived >::_solve_impl(), igl::AtA_cached_precompute(), igl::cat(), Eigen::SimplicialCholeskyBase< Derived >::dumpMemory(), igl::edges(), igl::serialization::getByteSize(), igl::harwell_boeing(), igl::min_quad_with_fixed_precompute(), Eigen::internal::minimum_degree_ordering(), igl::matlab::mlsetmatrix(), igl::matlab::prepare_lhs_double(), igl::repdiag(), igl::repmat(), igl::matlab::MatlabWorkspace::save(), igl::serialization::serialize(), and igl::slice_cached_precompute().

+ Here is the caller graph for this function:

◆ norm()

template<typename Derived >
NumTraits< typenameinternal::traits< Derived >::Scalar >::Real Eigen::SparseMatrixBase< Derived >::norm
inlineinherited
85{
86 using std::sqrt;
87 return sqrt(squaredNorm());
88}
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Definition ArrayCwiseUnaryOps.h:152
RealScalar squaredNorm() const
Definition SparseDot.h:77

References sqrt().

Referenced by Eigen::SPQR< _MatrixType >::compute(), and Eigen::MatrixMarketIterator< Scalar >::matrix().

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

◆ operator*() [1/3]

template<typename Derived >
template<typename OtherDerived >
const Product< Derived, OtherDerived > Eigen::SparseMatrixBase< Derived >::operator* ( const DiagonalBase< OtherDerived > &  other) const
inlineinherited
298 { return Product<Derived,OtherDerived>(derived(), other.derived()); }

References Eigen::DiagonalBase< Derived >::derived(), and Eigen::SparseMatrixBase< Derived >::derived().

+ Here is the call graph for this function:

◆ operator*() [2/3]

template<typename Derived >
template<typename OtherDerived >
const Product< Derived, OtherDerived > Eigen::SparseMatrixBase< Derived >::operator* ( const MatrixBase< OtherDerived > &  other) const
inlineinherited
315 { return Product<Derived,OtherDerived>(derived(), other.derived()); }

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

+ Here is the call graph for this function:

◆ operator*() [3/3]

template<typename Derived >
template<typename OtherDerived >
const Product< Derived, OtherDerived, AliasFreeProduct > Eigen::SparseMatrixBase< Derived >::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< Derived > 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}

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

+ Here is the call graph for this function:

◆ operator*=() [1/2]

template<typename Derived >
EIGEN_STRONG_INLINE Derived & Eigen::SparseMatrixBase< Derived >::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}
Eigen::Index Index
The interface type of indices.
Definition EigenBase.h:38

◆ operator*=() [2/2]

template<typename Derived >
template<typename OtherDerived >
Derived & Eigen::SparseMatrixBase< Derived >::operator*= ( const SparseMatrixBase< OtherDerived > &  other)
inherited

◆ operator+=() [1/4]

template<typename Derived >
template<typename OtherDerived >
Derived & Eigen::SparseMatrixBase< Derived >::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}

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

+ Here is the call graph for this function:

◆ operator+=() [2/4]

template<typename Derived >
template<typename OtherDerived >
Derived & Eigen::SparseMatrixBase< Derived >::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

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

+ Here is the call graph for this function:

◆ operator+=() [3/4]

template<typename Derived >
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived & Eigen::SparseMatrixBase< Derived >::operator+= ( const SparseMatrixBase< OtherDerived > &  other)
inherited
668{
669 return derived() = derived() + other.derived();
670}

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

+ Here is the call graph for this function:

◆ operator+=() [4/4]

template<typename Derived >
template<typename OtherDerived >
Derived & Eigen::SparseMatrixBase< Derived >::operator+= ( const SparseMatrixBase< OtherDerived > &  other)
inherited

◆ operator-=() [1/4]

template<typename Derived >
template<typename OtherDerived >
Derived & Eigen::SparseMatrixBase< Derived >::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}

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

+ Here is the call graph for this function:

◆ operator-=() [2/4]

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

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

+ Here is the call graph for this function:

◆ operator-=() [3/4]

template<typename Derived >
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived & Eigen::SparseMatrixBase< Derived >::operator-= ( const SparseMatrixBase< OtherDerived > &  other)
inherited
660{
661 return derived() = derived() - other.derived();
662}

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

+ Here is the call graph for this function:

◆ operator-=() [4/4]

template<typename Derived >
template<typename OtherDerived >
Derived & Eigen::SparseMatrixBase< Derived >::operator-= ( const SparseMatrixBase< OtherDerived > &  other)
inherited

◆ operator/=()

template<typename Derived >
EIGEN_STRONG_INLINE Derived & Eigen::SparseMatrixBase< Derived >::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/4]

template<typename _Scalar , int _Options, typename _StorageIndex >
template<typename OtherDerived >
SparseMatrix & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::operator= ( const EigenBase< OtherDerived > &  other)
inline
782 { return Base::operator=(other.derived()); }

References Eigen::EigenBase< Derived >::derived(), and Eigen::SparseCompressedBase< Derived >::operator=().

+ Here is the call graph for this function:

◆ operator=() [2/4]

template<typename _Scalar , int _Options, typename _StorageIndex >
SparseMatrix & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::operator= ( const SparseMatrix< _Scalar, _Options, _StorageIndex > &  other)
inline
755 {
756 if (other.isRValue())
757 {
758 swap(other.const_cast_derived());
759 }
760 else if(this!=&other)
761 {
762 #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
763 EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
764 #endif
765 initAssignment(other);
766 if(other.isCompressed())
767 {
768 internal::smart_copy(other.m_outerIndex, other.m_outerIndex + m_outerSize + 1, m_outerIndex);
769 m_data = other.m_data;
770 }
771 else
772 {
773 Base::operator=(other);
774 }
775 }
776 return *this;
777 }
void swap(SparseMatrix &other)
Definition SparseMatrix.h:732
EIGEN_DEVICE_FUNC void smart_copy(const T *start, const T *end, T *target)
Definition Memory.h:485

References Eigen::SparseMatrixBase< Derived >::const_cast_derived(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::initAssignment(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::isCompressed(), Eigen::SparseMatrixBase< Derived >::isRValue(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize, Eigen::SparseCompressedBase< Derived >::operator=(), Eigen::internal::smart_copy(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::swap().

+ Here is the call graph for this function:

◆ operator=() [3/4]

template<typename _Scalar , int _Options, typename _StorageIndex >
template<typename OtherDerived >
EIGEN_DONT_INLINE SparseMatrix & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::operator= ( const SparseMatrixBase< OtherDerived > &  other)

◆ operator=() [4/4]

template<typename _Scalar , int _Options, typename _StorageIndex >
template<typename OtherDerived >
EIGEN_DONT_INLINE SparseMatrix< Scalar, _Options, _StorageIndex > & Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::operator= ( const SparseMatrixBase< OtherDerived > &  other)
1058{
1060 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
1061
1062 #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
1063 EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN
1064 #endif
1065
1066 const bool needToTranspose = (Flags & RowMajorBit) != (internal::evaluator<OtherDerived>::Flags & RowMajorBit);
1067 if (needToTranspose)
1068 {
1069 #ifdef EIGEN_SPARSE_TRANSPOSED_COPY_PLUGIN
1070 EIGEN_SPARSE_TRANSPOSED_COPY_PLUGIN
1071 #endif
1072 // two passes algorithm:
1073 // 1 - compute the number of coeffs per dest inner vector
1074 // 2 - do the actual copy/eval
1075 // Since each coeff of the rhs has to be evaluated twice, let's evaluate it if needed
1076 typedef typename internal::nested_eval<OtherDerived,2,typename internal::plain_matrix_type<OtherDerived>::type >::type OtherCopy;
1077 typedef typename internal::remove_all<OtherCopy>::type _OtherCopy;
1078 typedef internal::evaluator<_OtherCopy> OtherCopyEval;
1079 OtherCopy otherCopy(other.derived());
1080 OtherCopyEval otherCopyEval(otherCopy);
1081
1082 SparseMatrix dest(other.rows(),other.cols());
1083 Eigen::Map<IndexVector> (dest.m_outerIndex,dest.outerSize()).setZero();
1084
1085 // pass 1
1086 // FIXME the above copy could be merged with that pass
1087 for (Index j=0; j<otherCopy.outerSize(); ++j)
1088 for (typename OtherCopyEval::InnerIterator it(otherCopyEval, j); it; ++it)
1089 ++dest.m_outerIndex[it.index()];
1090
1091 // prefix sum
1092 StorageIndex count = 0;
1093 IndexVector positions(dest.outerSize());
1094 for (Index j=0; j<dest.outerSize(); ++j)
1095 {
1096 StorageIndex tmp = dest.m_outerIndex[j];
1097 dest.m_outerIndex[j] = count;
1098 positions[j] = count;
1099 count += tmp;
1100 }
1101 dest.m_outerIndex[dest.outerSize()] = count;
1102 // alloc
1103 dest.m_data.resize(count);
1104 // pass 2
1105 for (StorageIndex j=0; j<otherCopy.outerSize(); ++j)
1106 {
1107 for (typename OtherCopyEval::InnerIterator it(otherCopyEval, j); it; ++it)
1108 {
1109 Index pos = positions[it.index()]++;
1110 dest.m_data.index(pos) = j;
1111 dest.m_data.value(pos) = it.value();
1112 }
1113 }
1114 this->swap(dest);
1115 return *this;
1116 }
1117 else
1118 {
1119 if(other.isRValue())
1120 {
1121 initAssignment(other.derived());
1122 }
1123 // there is no special optimization
1124 return Base::operator=(other.derived());
1125 }
1126}
SparseMatrix()
Definition SparseMatrix.h:659
T type
Definition Meta.h:78
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:14

References Eigen::SparseMatrixBase< Derived >::cols(), Eigen::SparseMatrixBase< Derived >::derived(), EIGEN_STATIC_ASSERT, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), Eigen::SparseMatrixBase< Derived >::isRValue(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::outerSize(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::resize(), Eigen::RowMajorBit, Eigen::SparseMatrixBase< Derived >::rows(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

+ Here is the call graph for this function:

◆ outerIndexPtr() [1/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
StorageIndex * Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::outerIndexPtr ( )
inline
Returns
a non-const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries.
See also
valuePtr(), innerIndexPtr()
170{ return m_outerIndex; }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex.

◆ outerIndexPtr() [2/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
const StorageIndex * Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::outerIndexPtr ( ) const
inline
Returns
a const pointer to the array of the starting positions of the inner vectors. This function is aimed at interoperability with other libraries.
See also
valuePtr(), innerIndexPtr()
166{ return m_outerIndex; }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex.

Referenced by Eigen::PastixBase< Derived >::analyzePattern(), igl::AtA_cached_precompute(), Eigen::PastixBase< Derived >::factorize(), Eigen::IncompleteCholesky< Scalar, _UpLo, _OrderingType >::factorize(), Eigen::internal::minimum_degree_ordering(), and Eigen::internal::permute_symm_to_symm().

+ Here is the caller graph for this function:

◆ outerSize()

◆ prune() [1/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
template<typename KeepFunc >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::prune ( const KeepFunc &  keep = KeepFunc())
inline

Turns the matrix into compressed format, and suppresses all nonzeros which do not satisfy the predicate keep. The functor type KeepFunc must implement the following function:

bool operator() (const Index& row, const Index& col, const Scalar& value) const;
See also
prune(Scalar,RealScalar)
521 {
522 // TODO optimize the uncompressed mode to avoid moving and allocating the data twice
524
525 StorageIndex k = 0;
526 for(Index j=0; j<m_outerSize; ++j)
527 {
528 Index previousStart = m_outerIndex[j];
529 m_outerIndex[j] = k;
530 Index end = m_outerIndex[j+1];
531 for(Index i=previousStart; i<end; ++i)
532 {
533 if(keep(IsRowMajor?j:m_data.index(i), IsRowMajor?m_data.index(i):j, m_data.value(i)))
534 {
535 m_data.value(k) = m_data.value(i);
536 m_data.index(k) = m_data.index(i);
537 ++k;
538 }
539 }
540 }
542 m_data.resize(k,0);
543 }
void makeCompressed()
Definition SparseMatrix.h:464

References Eigen::end(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::IsRowMajor, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::makeCompressed(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::resize(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

+ Here is the call graph for this function:

◆ prune() [2/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::prune ( const Scalar reference,
const RealScalar epsilon = NumTraits<RealScalar>::dummy_precision() 
)
inline

Suppresses all nonzeros which are much smaller than reference under the tolerence epsilon

508 {
509 prune(default_prunning_func(reference,epsilon));
510 }
void prune(const Scalar &reference, const RealScalar &epsilon=NumTraits< RealScalar >::dummy_precision())
Definition SparseMatrix.h:507

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::prune().

Referenced by igl::min_quad_with_fixed_precompute(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::prune(), and igl::straighten_seams().

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

◆ pruned()

template<typename Derived >
const SparseView< Derived > Eigen::SparseMatrixBase< Derived >::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() [1/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
template<class SizesType >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::reserve ( const SizesType &  reserveSizes,
const typename SizesType::value_type &  enableif = typename SizesType::value_type() 
)
inline
290 {
291 EIGEN_UNUSED_VARIABLE(enableif);
292 reserveInnerVectors(reserveSizes);
293 }
#define EIGEN_UNUSED_VARIABLE(var)
Definition Macros.h:618

References EIGEN_UNUSED_VARIABLE, and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::reserveInnerVectors().

+ Here is the call graph for this function:

◆ reserve() [2/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::reserve ( Index  reserveSize)
inline

Preallocates reserveSize non zeros.

Precondition: the matrix must be in compressed mode.

263 {
264 eigen_assert(isCompressed() && "This function does not make sense in non compressed mode.");
265 m_data.reserve(reserveSize);
266 }

References eigen_assert, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::isCompressed(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::reserve().

Referenced by igl::adjacency_matrix(), igl::arap_linear_block_elements(), igl::arap_linear_block_spokes(), igl::arap_linear_block_spokes_and_rims(), igl::cat(), igl::random_points_on_mesh(), igl::repdiag(), igl::repmat(), Eigen::internal::permutation_matrix_product< ExpressionType, Side, Transposed, SparseShape >::run(), Eigen::internal::set_from_triplets(), and igl::speye().

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

◆ reserveInnerVectors()

template<typename _Scalar , int _Options, typename _StorageIndex >
template<class SizesType >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::reserveInnerVectors ( const SizesType &  reserveSizes)
inlineprotected
298 {
299 if(isCompressed())
300 {
301 Index totalReserveSize = 0;
302 // turn the matrix into non-compressed mode
303 m_innerNonZeros = static_cast<StorageIndex*>(std::malloc(m_outerSize * sizeof(StorageIndex)));
305
306 // temporarily use m_innerSizes to hold the new starting points.
307 StorageIndex* newOuterIndex = m_innerNonZeros;
308
310 for(Index j=0; j<m_outerSize; ++j)
311 {
312 newOuterIndex[j] = count;
313 count += reserveSizes[j] + (m_outerIndex[j+1]-m_outerIndex[j]);
314 totalReserveSize += reserveSizes[j];
315 }
316 m_data.reserve(totalReserveSize);
317 StorageIndex previousOuterIndex = m_outerIndex[m_outerSize];
318 for(Index j=m_outerSize-1; j>=0; --j)
319 {
320 StorageIndex innerNNZ = previousOuterIndex - m_outerIndex[j];
321 for(Index i=innerNNZ-1; i>=0; --i)
322 {
323 m_data.index(newOuterIndex[j]+i) = m_data.index(m_outerIndex[j]+i);
324 m_data.value(newOuterIndex[j]+i) = m_data.value(m_outerIndex[j]+i);
325 }
326 previousOuterIndex = m_outerIndex[j];
327 m_outerIndex[j] = newOuterIndex[j];
328 m_innerNonZeros[j] = innerNNZ;
329 }
331
333 }
334 else
335 {
336 StorageIndex* newOuterIndex = static_cast<StorageIndex*>(std::malloc((m_outerSize+1)*sizeof(StorageIndex)));
337 if (!newOuterIndex) internal::throw_std_bad_alloc();
338
340 for(Index j=0; j<m_outerSize; ++j)
341 {
342 newOuterIndex[j] = count;
343 StorageIndex alreadyReserved = (m_outerIndex[j+1]-m_outerIndex[j]) - m_innerNonZeros[j];
344 StorageIndex toReserve = std::max<StorageIndex>(reserveSizes[j], alreadyReserved);
345 count += toReserve + m_innerNonZeros[j];
346 }
347 newOuterIndex[m_outerSize] = count;
348
349 m_data.resize(count);
350 for(Index j=m_outerSize-1; j>=0; --j)
351 {
352 Index offset = newOuterIndex[j] - m_outerIndex[j];
353 if(offset>0)
354 {
355 StorageIndex innerNNZ = m_innerNonZeros[j];
356 for(Index i=innerNNZ-1; i>=0; --i)
357 {
358 m_data.index(newOuterIndex[j]+i) = m_data.index(m_outerIndex[j]+i);
359 m_data.value(newOuterIndex[j]+i) = m_data.value(m_outerIndex[j]+i);
360 }
361 }
362 }
363
364 std::swap(m_outerIndex, newOuterIndex);
365 std::free(newOuterIndex);
366 }
367
368 }

References Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::index(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::isCompressed(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::reserve(), Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::resize(), Eigen::internal::throw_std_bad_alloc(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::value().

Referenced by Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::reserve().

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

◆ resize()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::resize ( Index  rows,
Index  cols 
)
inline

Resizes the matrix to a rows x cols matrix and initializes it to zero.

This function does not free the currently allocated memory. To release as much as memory as possible, call

mat.data().squeeze();

after resizing it.

See also
reserve(), setZero()
622 {
623 const Index outerSize = IsRowMajor ? rows : cols;
625 m_data.clear();
626 if (m_outerSize != outerSize || m_outerSize==0)
627 {
628 std::free(m_outerIndex);
629 m_outerIndex = static_cast<StorageIndex*>(std::malloc((outerSize + 1) * sizeof(StorageIndex)));
631
633 }
635 {
636 std::free(m_innerNonZeros);
637 m_innerNonZeros = 0;
638 }
639 memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(StorageIndex));
640 }
void clear()
Definition CompressedStorage.h:111

References Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::clear(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::cols(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::IsRowMajor, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerSize, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::outerSize(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows(), and Eigen::internal::throw_std_bad_alloc().

Referenced by Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix(), igl::adjacency_matrix(), Eigen::IncompleteCholesky< Scalar, _UpLo, _OrderingType >::analyzePattern(), igl::arap_linear_block_elements(), igl::arap_linear_block_spokes(), igl::arap_linear_block_spokes_and_rims(), igl::PlanarizerShapeUp< DerivedV, DerivedF >::assembleSelector(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::conservativeResize(), igl::crouzeix_raviart_massmatrix(), igl::xml::serialization_xml::deserialize(), igl::serialization::deserialize(), igl::matlab::MatlabWorkspace::find(), Eigen::PardisoLLT< MatrixType, _UpLo >::getMatrix(), Eigen::PardisoLDLT< MatrixType, Options >::getMatrix(), Eigen::PastixLLT< _MatrixType, _UpLo >::grabMatrix(), Eigen::PastixLDLT< _MatrixType, _UpLo >::grabMatrix(), grad_tet(), grad_tri(), igl::group_sum_matrix(), igl::in_element(), igl::lbs_matrix_column(), igl::lbs_matrix_column(), igl::loop(), igl::normal_derivative(), Eigen::SimplicialCholeskyBase< Derived >::ordering(), Eigen::internal::permute_symm_to_symm(), igl::project_isometrically_to_plane(), igl::random_points_on_mesh(), igl::remesh_along_isoline(), igl::repdiag(), igl::repmat(), Eigen::internal::Assignment< DstXprType, SrcXprType, Functor, Diagonal2Sparse >::run(), igl::slice_tets(), igl::upsample(), and igl::vector_area_matrix().

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

◆ resizeNonZeros()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::resizeNonZeros ( Index  size)
inline
645 {
647 }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::resize(), and Eigen::SparseMatrixBase< Derived >::size().

Referenced by Eigen::internal::minimum_degree_ordering(), Eigen::internal::permute_symm_to_symm(), and Eigen::internal::Assignment< DstXprType, SrcXprType, Functor, Diagonal2Sparse >::run().

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

◆ rows()

template<typename _Scalar , int _Options, typename _StorageIndex >
Index Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows ( ) const
inline
Returns
the number of rows of the matrix
136{ return IsRowMajor ? m_outerSize : m_innerSize; }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::IsRowMajor, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerSize, and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize.

Referenced by Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::SparseMatrix(), Eigen::SimplicialCholeskyBase< Derived >::_solve_impl(), igl::active_set(), Eigen::PastixBase< Derived >::analyzePattern(), Eigen::SimplicialCholeskyBase< Derived >::analyzePattern_preordered(), igl::arap_dof_precomputation(), igl::arap_dof_recomputation(), igl::arap_rhs(), igl::AtA_cached_precompute(), igl::bfs(), igl::biharmonic_coordinates(), igl::slim::build_linear_system(), igl::cat(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::coeff(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::coeffRef(), igl::components(), Eigen::PastixBase< Derived >::compute(), Eigen::SPQR< _MatrixType >::compute(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::conservativeResize(), igl::eigs(), Eigen::PastixBase< Derived >::factorize(), Eigen::SimplicialCholeskyBase< Derived >::factorize_preordered(), igl::find_zero(), igl::harmonic(), igl::harmonic(), igl::harwell_boeing(), igl::matlab_format(), igl::max(), igl::min(), igl::min_quad_with_fixed_precompute(), igl::matlab::mlsetmatrix(), igl::mosek::mosek_linprog(), igl::mosek::mosek_quadprog(), igl::matlab::prepare_lhs_double(), igl::redux(), igl::repdiag(), igl::repmat(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::resize(), Eigen::IncompleteCholesky< Scalar, _UpLo, _OrderingType >::rows(), Eigen::IncompleteLUT< _Scalar, _StorageIndex >::rows(), Eigen::SimplicialCholeskyBase< Derived >::rows(), Eigen::SparseLU< _MatrixType, _OrderingType >::rows(), Eigen::SparseQR< _MatrixType, _OrderingType >::rows(), Eigen::SuperLUBase< _MatrixType, Derived >::rows(), Eigen::internal::Assignment< DstXprType, SrcXprType, Functor, Diagonal2Sparse >::run(), igl::matlab::MatlabWorkspace::save(), igl::serialization::serialize(), igl::xml::serialization_xml::serialize(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::setIdentity(), and igl::shapeup_solve().

◆ selfadjointView() [1/4]

template<typename Derived >
template<unsigned int UpLo>
SelfAdjointViewReturnType< UpLo >::Type Eigen::SparseMatrixBase< Derived >::selfadjointView ( )
inlineinherited

◆ selfadjointView() [2/4]

template<typename Derived >
template<unsigned int UpLo>
SparseMatrixBase< Derived >::template SelfAdjointViewReturnType< UpLo >::Type Eigen::SparseMatrixBase< Derived >::selfadjointView ( )
inherited
183{
184 return SparseSelfAdjointView<Derived, UpLo>(derived());
185}

References Eigen::EigenBase< SparseSelfAdjointView< MatrixType, _Mode > >::derived().

+ Here is the call graph for this function:

◆ selfadjointView() [3/4]

template<typename Derived >
template<unsigned int UpLo>
ConstSelfAdjointViewReturnType< UpLo >::Type Eigen::SparseMatrixBase< Derived >::selfadjointView ( ) const
inlineinherited

◆ selfadjointView() [4/4]

template<typename Derived >
template<unsigned int UpLo>
SparseMatrixBase< Derived >::template ConstSelfAdjointViewReturnType< UpLo >::Type Eigen::SparseMatrixBase< Derived >::selfadjointView ( ) const
inherited
176{
177 return SparseSelfAdjointView<const Derived, UpLo>(derived());
178}

References Eigen::EigenBase< SparseSelfAdjointView< MatrixType, _Mode > >::derived().

+ Here is the call graph for this function:

◆ setFromTriplets() [1/2]

template<typename Scalar , int _Options, typename _StorageIndex >
template<typename InputIterators >
void Eigen::SparseMatrix< Scalar, _Options, _StorageIndex >::setFromTriplets ( const InputIterators &  begin,
const InputIterators &  end 
)

Fill the matrix *this with the list of triplets defined by the iterator range begin - end.

A triplet is a tuple (i,j,value) defining a non-zero element. The input list of triplets does not have to be sorted, and can contains duplicated elements. In any case, the result is a sorted and compressed sparse matrix where the duplicates have been summed up. This is a O(n) operation, with n the number of triplet elements. The initial contents of *this is destroyed. The matrix *this must be properly resized beforehand using the SparseMatrix(Index,Index) constructor, or the resize(Index,Index) method. The sizes are not extracted from the triplet list.

The InputIterators value_type must provide the following interface:

Scalar value() const; // the value
Scalar row() const; // the row index i
Scalar col() const; // the column index j

See for instance the Eigen::Triplet template class.

Here is a typical usage example:

typedef Triplet<double> T;
std::vector<T> tripletList;
triplets.reserve(estimation_of_entries);
for(...)
{
// ...
tripletList.push_back(T(i,j,v_ij));
}
SparseMatrixType m(rows,cols);
m.setFromTriplets(tripletList.begin(), tripletList.end());
// m is ready to go!
A small structure to hold a non zero as a triplet (i,j,value).
Definition SparseUtil.h:155
Warning
The list of triplets is read multiple times (at least twice). Therefore, it is not recommended to define an abstract iterator over a complex data-structure that would be expensive to evaluate. The triplets should rather be explicitely stored into a std::vector for instance.
994{
995 internal::set_from_triplets<InputIterators, SparseMatrix<Scalar,_Options,_StorageIndex> >(begin, end, *this, internal::scalar_sum_op<Scalar,Scalar>());
996}
T * begin(Slic3r::Mat< N, M, T > &mat)
Definition Point.hpp:605

Referenced by igl::adjacency_matrix(), igl::arap_linear_block_elements(), igl::arap_linear_block_spokes(), igl::arap_linear_block_spokes_and_rims(), igl::PlanarizerShapeUp< DerivedV, DerivedF >::assembleSelector(), igl::biharmonic_coordinates(), igl::slim::build_linear_system(), igl::cat(), igl::crouzeix_raviart_massmatrix(), igl::xml::serialization_xml::deserialize(), igl::serialization::deserialize(), igl::Frame_field_deformer::extractBlock(), igl::matlab::MatlabWorkspace::find(), grad_tet(), grad_tri(), igl::in_element(), igl::copyleft::comiso::FrameInterpolator::interpolateSymmetric(), igl::loop(), igl::normal_derivative(), igl::orientable_patches(), igl::copyleft::comiso::NRosyField::prepareSystemMatrix(), igl::project_isometrically_to_plane(), igl::random_points_on_mesh(), igl::remesh_along_isoline(), igl::repdiag(), igl::shapeup_precomputation(), igl::slice_tets(), igl::upsample(), and igl::vector_area_matrix().

+ Here is the caller graph for this function:

◆ setFromTriplets() [2/2]

template<typename Scalar , int _Options, typename _StorageIndex >
template<typename InputIterators , typename DupFunctor >
void Eigen::SparseMatrix< Scalar, _Options, _StorageIndex >::setFromTriplets ( const InputIterators &  begin,
const InputIterators &  end,
DupFunctor  dup_func 
)

The same as setFromTriplets but when duplicates are met the functor dup_func is applied:

value = dup_func(OldValue, NewValue)

Here is a C++11 example keeping the latest entry only:

mat.setFromTriplets(triplets.begin(), triplets.end(), [] (const Scalar&,const Scalar &b) { return b; });
1010{
1011 internal::set_from_triplets<InputIterators, SparseMatrix<Scalar,_Options,_StorageIndex>, DupFunctor>(begin, end, *this, dup_func);
1012}

◆ setIdentity()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::setIdentity ( )
inline

Sets *this to the identity matrix. This function also turns the matrix into compressed mode, and drop any reserved memory.

745 {
746 eigen_assert(rows() == cols() && "ONLY FOR SQUARED MATRICES");
747 this->m_data.resize(rows());
748 Eigen::Map<IndexVector>(this->m_data.indexPtr(), rows()).setLinSpaced(0, StorageIndex(rows()-1));
749 Eigen::Map<ScalarVector>(this->m_data.valuePtr(), rows()).setOnes();
750 Eigen::Map<IndexVector>(this->m_outerIndex, rows()+1).setLinSpaced(0, StorageIndex(rows()));
751 std::free(m_innerNonZeros);
752 m_innerNonZeros = 0;
753 }
const Scalar * valuePtr() const
Definition CompressedStorage.h:113

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::cols(), eigen_assert, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::indexPtr(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros, Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::resize(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::rows(), and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::valuePtr().

Referenced by igl::slim::build_linear_system(), and igl::min_quad_with_fixed_precompute().

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

◆ setZero()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::setZero ( )
inline

Removes all non zeros but keep allocated memory

This function does not free the currently allocated memory. To release as much as memory as possible, call

mat.data().squeeze();

after resizing it.

See also
resize(Index,Index), data()
252 {
253 m_data.clear();
254 memset(m_outerIndex, 0, (m_outerSize+1)*sizeof(StorageIndex));
256 memset(m_innerNonZeros, 0, (m_outerSize)*sizeof(StorageIndex));
257 }

References Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::clear(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize.

Referenced by igl::xml::serialization_xml::deserialize(), and igl::serialization::deserialize().

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

◆ size()

template<typename Derived >
Index Eigen::SparseMatrixBase< Derived >::size ( ) const
inlineinherited
Returns
the number of coefficients, which is rows()*cols().
See also
rows(), cols().
176{ return rows() * cols(); }

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

Referenced by igl::active_set(), igl::cat(), igl::diag(), Eigen::SparseMatrixBase< Derived >::dot(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::finalize(), igl::invert_diag(), igl::min_quad_with_fixed_precompute(), Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::operator=(), Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::operator=(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::resizeNonZeros().

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

◆ squaredNorm()

template<typename Derived >
NumTraits< typenameinternal::traits< Derived >::Scalar >::Real Eigen::SparseMatrixBase< Derived >::squaredNorm
inlineinherited
78{
79 return numext::real((*this).cwiseAbs2().sum());
80}

◆ startVec()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::startVec ( Index  outer)
inline
413 {
414 eigen_assert(m_outerIndex[outer]==Index(m_data.size()) && "You must call startVec for each inner vector sequentially");
415 eigen_assert(m_outerIndex[outer+1]==0 && "You must call startVec for each inner vector sequentially");
416 m_outerIndex[outer+1] = m_outerIndex[outer];
417 }

References eigen_assert, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::size().

+ Here is the call graph for this function:

◆ 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()

template<typename _Scalar , int _Options, typename _Index >
internal::traits< SparseMatrix< _Scalar, _Options, _Index > >::Scalar Eigen::SparseMatrix< _Scalar, _Options, _Index >::sum

Overloaded for performance

31{
32 eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
33 if(this->isCompressed())
35 else
36 return Base::sum();
37}
Scalar sum() const
Definition SparseRedux.h:17

References Eigen::PlainObjectBase< Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >::Eigen::Map, and eigen_assert.

◆ sumupDuplicates()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::sumupDuplicates ( )
inline
448{ collapseDuplicates(internal::scalar_sum_op<Scalar,Scalar>()); }
void collapseDuplicates(DupFunctor dup_func=DupFunctor())
Definition SparseMatrix.h:1017

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::collapseDuplicates().

+ Here is the call graph for this function:

◆ swap()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::swap ( SparseMatrix< _Scalar, _Options, _StorageIndex > &  other)
inline

Swaps the content of two sparse matrices of the same type. This is a fast operation that simply swaps the underlying pointers and parameters.

733 {
734 //EIGEN_DBG_SPARSE(std::cout << "SparseMatrix:: swap\n");
735 std::swap(m_outerIndex, other.m_outerIndex);
736 std::swap(m_innerSize, other.m_innerSize);
737 std::swap(m_outerSize, other.m_outerSize);
738 std::swap(m_innerNonZeros, other.m_innerNonZeros);
739 m_data.swap(other.m_data);
740 }
void swap(CompressedStorage &other)
Definition CompressedStorage.h:62

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerNonZeros, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_innerSize, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerIndex, Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_outerSize, and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::swap().

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

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

◆ toDense()

template<typename Derived >
DenseMatrixType Eigen::SparseMatrixBase< Derived >::toDense ( ) const
inlineinherited
366 {
367 return DenseMatrixType(derived());
368 }
Matrix< Scalar, RowsAtCompileTime, ColsAtCompileTime > DenseMatrixType
Definition SparseMatrixBase.h:133

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

Referenced by Eigen::SparseMatrixBase< Derived >::isApprox().

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

◆ transpose() [1/2]

template<typename Derived >
TransposeReturnType Eigen::SparseMatrixBase< Derived >::transpose ( )
inlineinherited
349{ return TransposeReturnType(derived()); }
Transpose< Derived > TransposeReturnType
Definition SparseMatrixBase.h:110

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

Referenced by Eigen::SparseMatrixBase< Derived >::adjoint(), Eigen::IncompleteLUT< _Scalar, _StorageIndex >::analyzePattern(), igl::arap_dof_precomputation(), igl::AtA_cached_precompute(), igl::slim::build_linear_system(), igl::copyleft::comiso::PoissonSolver< DerivedV, DerivedF >::BuildLaplacianMatrix(), Eigen::PastixLU< _MatrixType, IsStrSym >::grabMatrix(), igl::hessian(), igl::hessian_energy(), igl::min_quad_with_fixed_precompute(), igl::mosek::mosek_quadprog(), igl::orientable_patches(), igl::shapeup_precomputation(), and igl::straighten_seams().

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

◆ transpose() [2/2]

template<typename Derived >
const ConstTransposeReturnType Eigen::SparseMatrixBase< Derived >::transpose ( ) const
inlineinherited
internal::add_const< Transpose< constDerived > >::type ConstTransposeReturnType
Definition SparseMatrixBase.h:111

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

+ Here is the call graph for this function:

◆ triangularView()

template<typename Derived >
template<int Mode>
const TriangularView< const Derived, Mode > Eigen::SparseMatrixBase< Derived >::triangularView
inlineinherited
183{
184 return TriangularView<const Derived, Mode>(derived());
185}

Referenced by igl::mosek::mosek_quadprog().

+ Here is the caller graph for this function:

◆ twistedBy()

template<typename Derived >
SparseSymmetricPermutationProduct< Derived, Upper|Lower > Eigen::SparseMatrixBase< Derived >::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 }

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

Referenced by Eigen::IncompleteLUT< _Scalar, _StorageIndex >::factorize(), Eigen::IncompleteCholesky< Scalar, _UpLo, _OrderingType >::factorize(), Eigen::PardisoLLT< MatrixType, _UpLo >::getMatrix(), and Eigen::PardisoLDLT< MatrixType, Options >::getMatrix().

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

◆ uncompress()

template<typename _Scalar , int _Options, typename _StorageIndex >
void Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::uncompress ( )
inline

◆ valuePtr() [1/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
Scalar * Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::valuePtr ( )
inline
Returns
a non-const pointer to the array of values. This function is aimed at interoperability with other libraries.
See also
innerIndexPtr(), outerIndexPtr()
152{ return m_data.valuePtr(); }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::valuePtr().

+ Here is the call graph for this function:

◆ valuePtr() [2/2]

template<typename _Scalar , int _Options, typename _StorageIndex >
const Scalar * Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::valuePtr ( ) const
inline
Returns
a const pointer to the array of values. This function is aimed at interoperability with other libraries.
See also
innerIndexPtr(), outerIndexPtr()
148{ return m_data.valuePtr(); }

References Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data, and Eigen::internal::CompressedStorage< _Scalar, _StorageIndex >::valuePtr().

Referenced by Eigen::PastixBase< Derived >::analyzePattern(), igl::AtA_cached(), Eigen::PastixBase< Derived >::factorize(), Eigen::IncompleteCholesky< Scalar, _UpLo, _OrderingType >::factorize(), Eigen::internal::permute_symm_to_symm(), and igl::slice_cached_precompute().

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

Friends And Related Symbol Documentation

◆ operator<<

template<typename _Scalar , int _Options, typename _StorageIndex >
std::ostream & operator<< ( std::ostream &  s,
const SparseMatrix< _Scalar, _Options, _StorageIndex > &  m 
)
friend
789 {
791 s << "Nonzero entries:\n";
792 if(m.isCompressed())
793 {
794 for (Index i=0; i<m.nonZeros(); ++i)
795 s << "(" << m.m_data.value(i) << "," << m.m_data.index(i) << ") ";
796 }
797 else
798 {
799 for (Index i=0; i<m.outerSize(); ++i)
800 {
801 Index p = m.m_outerIndex[i];
802 Index pe = m.m_outerIndex[i]+m.m_innerNonZeros[i];
803 Index k=p;
804 for (; k<pe; ++k) {
805 s << "(" << m.m_data.value(k) << "," << m.m_data.index(k) << ") ";
806 }
807 for (; k<m.m_outerIndex[i+1]; ++k) {
808 s << "(_,_) ";
809 }
810 }
811 }
812 s << std::endl;
813 s << std::endl;
814 s << "Outer pointers:\n";
815 for (Index i=0; i<m.outerSize(); ++i) {
816 s << m.m_outerIndex[i] << " ";
817 }
818 s << " $" << std::endl;
819 if(!m.isCompressed())
820 {
821 s << "Inner non zeros:\n";
822 for (Index i=0; i<m.outerSize(); ++i) {
823 s << m.m_innerNonZeros[i] << " ";
824 }
825 s << " $" << std::endl;
826 }
827 s << std::endl;
828 );
829 s << static_cast<const SparseMatrixBase<SparseMatrix>&>(m);
830 return s;
831 }
#define EIGEN_DBG_SPARSE(X)
Definition SparseUtil.h:18

◆ SparseVector< _Scalar, 0, _StorageIndex >

template<typename _Scalar , int _Options, typename _StorageIndex >
friend class SparseVector< _Scalar, 0, _StorageIndex >
friend

Member Data Documentation

◆ m_data

template<typename _Scalar , int _Options, typename _StorageIndex >
Storage Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::m_data
protected

Referenced by Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::coeff(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::coeffRef(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::conservativeResize(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::data(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::data(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::finalize(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::innerIndexPtr(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::innerIndexPtr(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertBackByOuterInner(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::insertBackByOuterInnerUnordered(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::makeCompressed(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::operator=(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::operator=(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::prune(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::reserve(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::reserveInnerVectors(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::resize(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::resizeNonZeros(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::setZero(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::startVec(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::swap(), Eigen::SparseVector< _Scalar, _Options, _StorageIndex >::swap(), Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::valuePtr(), and Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >::valuePtr().

◆ m_innerNonZeros

◆ m_innerSize

◆ m_isRValue

template<typename Derived >
bool Eigen::SparseMatrixBase< Derived >::m_isRValue
protectedinherited

◆ m_outerIndex

◆ m_outerSize


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