Please, help us to better know about our user community by answering the following short survey: https://forms.gle/wpyrxWi18ox9Z5ae9
Eigen  3.3.71
Eigen::SparseCompressedBase Class Reference

Detailed Description

Common base class for sparse [compressed]-{row|column}-storage format.

This class defines the common interface for all derived classes implementing the compressed sparse storage format, such as:

Public Member Functions

Map< Array< Scalar, Dynamic, 1 > > coeffs ()
 
const Map< const Array< Scalar, Dynamic, 1 > > coeffs () const
 
StorageIndex * innerIndexPtr ()
 
const StorageIndex * innerIndexPtr () const
 
StorageIndex * innerNonZeroPtr ()
 
const StorageIndex * innerNonZeroPtr () const
 
bool isCompressed () const
 
Index nonZeros () const
 
StorageIndex * outerIndexPtr ()
 
const StorageIndex * outerIndexPtr () const
 
Scalar * valuePtr ()
 
const Scalar * valuePtr () const
 

Protected Member Functions

 SparseCompressedBase ()
 

Constructor & Destructor Documentation

◆ SparseCompressedBase()

Eigen::SparseCompressedBase::SparseCompressedBase ( )
inlineprotected

Default constructor. Do nothing.

Member Function Documentation

◆ coeffs() [1/2]

Map<Array<Scalar,Dynamic,1> > Eigen::SparseCompressedBase::coeffs ( )
inline
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:

SparseMatrix<double> A(3,3);
A.insert(1,2) = 0;
A.insert(0,1) = 1;
A.insert(2,0) = 2;
A.makeCompressed();
cout << "The matrix A is:" << endl << MatrixXd(A) << endl;
cout << "it has " << A.nonZeros() << " stored non zero coefficients that are: " << A.coeffs().transpose() << endl;
A.coeffs() += 10;
cout << "After adding 10 to every stored non zero coefficient, the matrix A is:" << endl << MatrixXd(A) << endl;

and the output is:

The matrix A is:
0 1 0
0 0 0
2 0 0
it has 3 stored non zero coefficients that are: 2 1 0
After adding 10 to every stored non zero coefficient, the matrix A is:
0 11 0
0 0 10
12 0 0
See also
valuePtr(), isCompressed()

◆ coeffs() [2/2]

const Map<const Array<Scalar,Dynamic,1> > Eigen::SparseCompressedBase::coeffs ( ) const
inline
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()

◆ innerIndexPtr() [1/2]

StorageIndex* Eigen::SparseCompressedBase::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()

◆ innerIndexPtr() [2/2]

const StorageIndex* Eigen::SparseCompressedBase::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()

◆ innerNonZeroPtr() [1/2]

StorageIndex* Eigen::SparseCompressedBase::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

◆ innerNonZeroPtr() [2/2]

const StorageIndex* Eigen::SparseCompressedBase::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

◆ isCompressed()

bool Eigen::SparseCompressedBase::isCompressed ( ) const
inline
Returns
whether *this is in compressed form.

◆ nonZeros()

Index Eigen::SparseCompressedBase::nonZeros ( ) const
inline
Returns
the number of non zero coefficients

◆ outerIndexPtr() [1/2]

StorageIndex* Eigen::SparseCompressedBase::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.
Warning
it returns the null pointer 0 for SparseVector
See also
valuePtr(), innerIndexPtr()

◆ outerIndexPtr() [2/2]

const StorageIndex* Eigen::SparseCompressedBase::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.
Warning
it returns the null pointer 0 for SparseVector
See also
valuePtr(), innerIndexPtr()

◆ valuePtr() [1/2]

Scalar* Eigen::SparseCompressedBase::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()

◆ valuePtr() [2/2]

const Scalar* Eigen::SparseCompressedBase::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()

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