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

Interface for a 2D matrix, to allow passing matrices and vectors across shared library boundaries. More...

#include <IMatrix.hpp>

Inheritance diagram for IMatrix< T >:
IAddressableMatrix< T > IRowOrColumnMajorMatrix< T > ISparseMatrix< T > IDenseMatrix< T > ImageMatrix< T > MappedMatrix< T, IndexT > ICompressedSparseMatrix< Sparse::value_type > ICompressedSparseMatrix< T > IDenseMatrix< T > ICompressedSparseMatrix< MatrixT::value_type > ICompressedSparseMatrix< Sparse::value_type > ICompressedSparseMatrix< T > MappedMatrix< T, IndexT >

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 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 int8 isResizable () const =0
 Check if the matrix can be freely resized. 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...
 
virtual ~IMatrix ()
 Destructor. More...
 

Detailed Description

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

Interface for a 2D matrix, to allow passing matrices and vectors across shared library boundaries.

Definition at line 28 of file IMatrix.hpp.

Member Typedef Documentation

typedef T Value

Type of values stored in the matrix.

Definition at line 33 of file IMatrix.hpp.

typedef T value_type

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

Definition at line 34 of file IMatrix.hpp.

Constructor & Destructor Documentation

virtual ~IMatrix ( )
virtual

Destructor.

Definition at line 37 of file IMatrix.hpp.

Member Function Documentation

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

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 virtual

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> const* asSparse ( ) const
pure virtual

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 virtual

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 virtual
virtual int8 isResizable ( ) const
pure virtual
virtual int8 resize ( int64  nrows,
int64  ncols 
)
pure virtual

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 virtual
virtual void setZero ( )
pure virtual

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