Thea
Public Types | Public Member Functions | List of all members
ICompressedSparseMatrix< T > Class Template Referenceabstract

Interface for a 2D sparse matrix in compressed column or compressed row format. More...

#include <ICompressedSparseMatrix.hpp>

Inheritance diagram for ICompressedSparseMatrix< T >:
ISparseMatrix< T > IRowOrColumnMajorMatrix< T > IMatrix< T > IMatrix< T > VariantMatrix< T, DenseMatrixT, SparseMatrixT >

Public Types

typedef T Value
 Type of values stored in the matrix. More...
 
typedef T value_type
 Type of values stored in the matrix (STL convention). More...
 

Public Member Functions

virtual IAddressableMatrix< T > const * asAddressable () const =0
 If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access. More...
 
virtual IAddressableMatrix< T > * asAddressable ()=0
 If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access. More...
 
virtual ICompressedSparseMatrix< T > const * asCompressed () const =0
 If the matrix is stored in compressed column or row format, get a pointer to a derived interface supporting access specific to that format. More...
 
virtual ICompressedSparseMatrix< T > * asCompressed ()=0
 If the matrix is stored in compressed column or row format, get a pointer to a derived interface supporting access specific to that format. More...
 
virtual ISparseMatrix< T > const * asSparse () const =0
 If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access. More...
 
virtual ISparseMatrix< T > * asSparse ()=0
 If the matrix is sparse, get a pointer to a derived interface giving sparse-specific access. More...
 
virtual int64 cols () const =0
 Get the number of columns. More...
 
virtual int32 getInnerIndexType () const =0
 The integer type used to store inner indices, as per the values in NumericType. More...
 
virtual void const * getInnerIndices () const =0
 Get the array of inner indices. More...
 
virtual void * getInnerIndices ()=0
 Get the array of inner indices. More...
 
virtual void const * getNonZeroCounts () const =0
 Get the array of non-zero counts. More...
 
virtual void * getNonZeroCounts ()=0
 Get the array of non-zero counts. More...
 
virtual int32 getNonZeroCountType () const =0
 The integer type used to store per-segment non-zero counts, as per the values in NumericType. More...
 
virtual int32 getOuterIndexType () const =0
 The integer type used to store outer indices, as per the values in NumericType. More...
 
virtual void const * getOuterIndices () const =0
 Get the array of outer indices. More...
 
virtual void * getOuterIndices ()=0
 Get the array of outer indices. More...
 
virtual T const * getValues () const =0
 Get the array storing the non-zero values. More...
 
virtual T * getValues ()=0
 Get the array storing the non-zero values. More...
 
virtual int64 innerSize () const =0
 Get the size of the matrix along the inner dimension (rows if column-major, or columns if row-major). More...
 
virtual int8 isColumnMajor () const =0
 Is the matrix stored in column-major format? More...
 
virtual int8 isFullyCompressed () const =0
 Make sure the matrix actually is fully compressed. More...
 
virtual int8 isResizable () const =0
 Check if the matrix can be freely resized. More...
 
virtual int8 isRowMajor () const =0
 Is the matrix stored in row-major format? More...
 
virtual int64 numStoredElements () const =0
 Get the number of entries actually stored in the matrix. More...
 
virtual int64 outerSize () const =0
 Get the size of the matrix int64 the outer dimension (columns if column-major, or row if row-major). More...
 
virtual int8 resize (int64 nrows, int64 ncols)=0
 Resize the matrix to new dimensions, if isResizable() returns true. More...
 
virtual int64 rows () const =0
 Get the number of rows. More...
 
virtual void setZero ()=0
 Set all elements to zero. More...
 

Detailed Description

template<typename T>
class Thea::ICompressedSparseMatrix< T >

Interface for a 2D sparse matrix in compressed column or compressed row format.

Useful for passing matrices across shared library boundaries.

See also
Eigen::SparseMatrix

Definition at line 30 of file ICompressedSparseMatrix.hpp.

Member Typedef Documentation

typedef T Value
inherited

Type of values stored in the matrix.

Definition at line 33 of file IMatrix.hpp.

typedef T value_type
inherited

Type of values stored in the matrix (STL convention).

Definition at line 34 of file IMatrix.hpp.

Member Function Documentation

virtual IAddressableMatrix<T> const* asAddressable ( ) const
pure virtualinherited

If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access.

Else, return null.

Note
dynamic_cast does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast is dangerous.

Implemented in MappedMatrix< T, IndexT >, VariantMatrix< T, DenseMatrixT, SparseMatrixT >, MatrixWrapper< MatrixT >, MatrixWrapper< VertexMatrix >, MatrixWrapper< Dense >, MatrixWrapper< TriangleMatrix >, SparseMatrixWrapper< MatrixT >, SparseMatrixWrapper< Sparse >, and ImageMatrix< T >.

virtual IAddressableMatrix<T>* asAddressable ( )
pure virtualinherited

If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access.

Else, return null.

Note
dynamic_cast does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast is dangerous.

Implemented in MappedMatrix< T, IndexT >, VariantMatrix< T, DenseMatrixT, SparseMatrixT >, MatrixWrapper< MatrixT >, MatrixWrapper< VertexMatrix >, MatrixWrapper< Dense >, MatrixWrapper< TriangleMatrix >, SparseMatrixWrapper< MatrixT >, SparseMatrixWrapper< Sparse >, and ImageMatrix< T >.

virtual ICompressedSparseMatrix<T> const* asCompressed ( ) const
pure virtualinherited

If the matrix is stored in compressed column or row format, get a pointer to a derived interface supporting access specific to that format.

Else, return null.

Note
dynamic_cast does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast is dangerous.

Implemented in MappedMatrix< T, IndexT >, VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual ICompressedSparseMatrix<T>* asCompressed ( )
pure virtualinherited

If the matrix is stored in compressed column or row format, get a pointer to a derived interface supporting access specific to that format.

Else, return null.

Note
dynamic_cast does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast is dangerous.

Implemented in MappedMatrix< T, IndexT >, VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual ISparseMatrix<T> const* asSparse ( ) const
pure virtualinherited

If the matrix elements are addressable by (row, col) pairs, get a pointer to a derived interface supporting such access.

Else, return null.

Note
dynamic_cast does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast is dangerous.

Implemented in MappedMatrix< T, IndexT >, VariantMatrix< T, DenseMatrixT, SparseMatrixT >, MatrixWrapper< MatrixT >, MatrixWrapper< VertexMatrix >, MatrixWrapper< Dense >, MatrixWrapper< TriangleMatrix >, SparseMatrixWrapper< MatrixT >, SparseMatrixWrapper< Sparse >, and ImageMatrix< T >.

virtual ISparseMatrix<T>* asSparse ( )
pure virtualinherited

If the matrix is sparse, get a pointer to a derived interface giving sparse-specific access.

Else, return null. Note that a sparse matrix can still be addressable, e.g. if it is stored as a map of (row, col) –> value pairs.

Note
dynamic_cast does not work reliably across shared library boundaries, and relying on users to avoid it and only use static_cast is dangerous.

Implemented in MappedMatrix< T, IndexT >, VariantMatrix< T, DenseMatrixT, SparseMatrixT >, MatrixWrapper< MatrixT >, MatrixWrapper< VertexMatrix >, MatrixWrapper< Dense >, MatrixWrapper< TriangleMatrix >, SparseMatrixWrapper< MatrixT >, SparseMatrixWrapper< Sparse >, and ImageMatrix< T >.

virtual int64 cols ( ) const
pure virtualinherited
virtual int32 getInnerIndexType ( ) const
pure virtual

The integer type used to store inner indices, as per the values in NumericType.

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual void const* getInnerIndices ( ) const
pure virtual

Get the array of inner indices.

The array has numStoredElements() meaningful entries, but these may not be contiguous if isFullyCompressed() is false. Convert to the correct integer type using getInnerIndexType().

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual void* getInnerIndices ( )
pure virtual

Get the array of inner indices.

The array has numStoredElements() meaningful entries, but these may not be contiguous if isFullyCompressed() is false. Convert to the correct integer type using getInnerIndexType().

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual void const* getNonZeroCounts ( ) const
pure virtual

Get the array of non-zero counts.

Each entry is the number of actual non-zeros in the corresponding inner segment. The return value is undefined if isFullyCompressed() is true. Convert to the correct integer type using getNonZeroCountType().

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual void* getNonZeroCounts ( )
pure virtual

Get the array of non-zero counts.

Each entry is the number of actual non-zeros in the corresponding inner segment. The return value is undefined if isFullyCompressed() is true. Convert to the correct integer type using getNonZeroCountType().

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual int32 getNonZeroCountType ( ) const
pure virtual

The integer type used to store per-segment non-zero counts, as per the values in NumericType.

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual int32 getOuterIndexType ( ) const
pure virtual

The integer type used to store outer indices, as per the values in NumericType.

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual void const* getOuterIndices ( ) const
pure virtual

Get the array of outer indices.

The array has outerSize() + 1 entries. Convert to the correct integer type using getOuterIndexType().

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual void* getOuterIndices ( )
pure virtual

Get the array of outer indices.

The array has outerSize() + 1 entries: if isFullyCompressed() is true, the last entry is the total number of non-zeros in the matrix. Convert to the correct integer type using getOuterIndexType().

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual T const* getValues ( ) const
pure virtual

Get the array storing the non-zero values.

The array has numStoredElements() meaningful entries, but these may not be contiguous if isFullyCompressed() is false.

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual T* getValues ( )
pure virtual

Get the array storing the non-zero values.

The array has numStoredElements() meaningful entries, but these may not be contiguous if isFullyCompressed() is false.

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual int64 innerSize ( ) const
pure virtual

Get the size of the matrix along the inner dimension (rows if column-major, or columns if row-major).

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual int8 isColumnMajor ( ) const
pure virtualinherited
virtual int8 isFullyCompressed ( ) const
pure virtual

Make sure the matrix actually is fully compressed.

If not, it will be stored in Eigen's custom format which allows gaps between non-zeros. In the latter case, the array returned by getNonZeroCounts() contains the number of actual non-zeros in each inner segment.

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual int8 isResizable ( ) const
pure virtualinherited
virtual int8 isRowMajor ( ) const
pure virtualinherited
virtual int64 numStoredElements ( ) const
pure virtualinherited

Get the number of entries actually stored in the matrix.

These are often called "non-zeros", though they may actually have the numeric value 0.

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, MappedMatrix< T, IndexT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual int64 outerSize ( ) const
pure virtual

Get the size of the matrix int64 the outer dimension (columns if column-major, or row if row-major).

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, SparseMatrixWrapper< MatrixT >, and SparseMatrixWrapper< Sparse >.

virtual int8 resize ( int64  nrows,
int64  ncols 
)
pure virtualinherited

Resize the matrix to new dimensions, if isResizable() returns true.

Else, if the new dimensions are identical to the old dimensions, do nothing and return true, else return false. If the dimensions are changed, existing entries will in general not be preserved in the resized matrix.

Returns
True if the final dimensions of the matrix are identical to the desired dimensions, else false.

Implemented in VariantMatrix< T, DenseMatrixT, SparseMatrixT >, MappedMatrix< T, IndexT >, MatrixWrapper< MatrixT >, MatrixWrapper< VertexMatrix >, MatrixWrapper< Dense >, MatrixWrapper< TriangleMatrix >, SparseMatrixWrapper< MatrixT >, SparseMatrixWrapper< Sparse >, and ImageMatrix< T >.

virtual int64 rows ( ) const
pure virtualinherited
virtual void setZero ( )
pure virtualinherited

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