Eigen  3.3.3
Eigen::SparseCompressedBase< Derived > Class Template Reference

Detailed Description

template<typename Derived>
class Eigen::SparseCompressedBase< Derived >

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:

+ Inheritance diagram for Eigen::SparseCompressedBase< Derived >:

List of all members.

Public Member Functions

const Map< const Array< Scalar,
Dynamic, 1 > > 
coeffs () const
Map< Array< Scalar, Dynamic, 1 > > coeffs ()
const StorageIndexinnerIndexPtr () const
StorageIndexinnerIndexPtr ()
const StorageIndexinnerNonZeroPtr () const
StorageIndexinnerNonZeroPtr ()
bool isCompressed () const
Index nonZeros () const
const StorageIndexouterIndexPtr () const
StorageIndexouterIndexPtr ()
const Scalar * valuePtr () const
Scalar * valuePtr ()

Protected Member Functions

 SparseCompressedBase ()

Constructor & Destructor Documentation

template<typename Derived>
Eigen::SparseCompressedBase< Derived >::SparseCompressedBase ( ) [inline, protected]

Default constructor. Do nothing.


Member Function Documentation

template<typename Derived>
const Map<const Array<Scalar,Dynamic,1> > Eigen::SparseCompressedBase< Derived >::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()
template<typename Derived>
Map<Array<Scalar,Dynamic,1> > Eigen::SparseCompressedBase< Derived >::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()
template<typename Derived>
const StorageIndex* Eigen::SparseCompressedBase< Derived >::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

Reimplemented in Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >, Eigen::SparseMatrix< Scalar >, Eigen::SparseMatrix< Scalar, ColMajor, StorageIndex >, Eigen::SparseMatrix< Scalar, ColMajor, int >, Eigen::SparseMatrix< Scalar, RowMajor, StorageIndex >, Eigen::SparseMapBase< Derived, ReadOnlyAccessors >, and Eigen::SparseVector< _Scalar, _Options, _StorageIndex >.

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

Reimplemented in Eigen::SparseMatrix< _Scalar, _Options, _StorageIndex >, Eigen::SparseMatrix< Scalar >, Eigen::SparseMatrix< Scalar, ColMajor, StorageIndex >, Eigen::SparseMatrix< Scalar, ColMajor, int >, Eigen::SparseMatrix< Scalar, RowMajor, StorageIndex >, Eigen::SparseMapBase< Derived, WriteAccessors >, and Eigen::SparseVector< _Scalar, _Options, _StorageIndex >.

template<typename Derived>
bool Eigen::SparseCompressedBase< Derived >::isCompressed ( ) const [inline]
Returns:
whether *this is in compressed form.

Reimplemented in Eigen::SparseMapBase< Derived, ReadOnlyAccessors >.

template<typename Derived>
Index Eigen::SparseCompressedBase< Derived >::nonZeros ( ) const [inline]
Returns:
the number of non zero coefficients

Reimplemented in Eigen::SparseVector< _Scalar, _Options, _StorageIndex >, and Eigen::SparseMapBase< Derived, ReadOnlyAccessors >.

template<typename Derived>
const StorageIndex* Eigen::SparseCompressedBase< Derived >::outerIndexPtr ( ) const [inline]
template<typename Derived>
StorageIndex* Eigen::SparseCompressedBase< Derived >::outerIndexPtr ( ) [inline]

The documentation for this class was generated from the following file:
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends