tngmath::SparseMatrix Class Reference

The default sparse matrix class. More...

#include <sparsematrix.hpp>

Inheritance diagram for tngmath::SparseMatrix:

Inheritance graph
[legend]
Collaboration diagram for tngmath::SparseMatrix:

Collaboration graph
[legend]

List of all members.

Public Types

enum  TMatrixType { General = 0, SelfAdjoint, SelfAdjointUpperTriangular, SelfAdjointLowerTriangular }
 Defines idents/enums for the matrix types.
typedef double TRealScalar
 the data type of the coefficients (real number)

Public Member Functions

SparseMatrix __neg__ (const SparseMatrix &x) const
SparseMatrixIterator Begin () const
int Cols () const
 returns the number of columns
MatrixBase Dense () const
 converts this into a dense matrix
MatrixBase Diagonal () const
 returns the diagonal as vector
template<typename OtherDerived>
TScalar Dott (const OtherDerived &x) const
SparseMatrixIterator End () const
void EndFill ()
SparseMatrix ErasedLowerTriangular () const
 returns a matrix with erased lower triangular part
SparseMatrix ErasedUpperTriangular () const
 returns a matrix with erased upper triangular part
void EraseLowerTriangular ()
 erases the lower triangular parts
void EraseUpperTriangular ()
 erases the upper triangular parts
void Fill (int row, int col, double value)
int InnerNonZeros (int j) const
 returns the nonzeros of the j-th column
int InnerSize () const
 returns the number of inner elements
SparseMatrix LowerTriangular () const
 returns the lower triangular part
const unsigned int & matrixType () const
 returns the type of this matrix
unsigned int & matrixType ()
 returns the type of this matrix
int NonZeros () const
 returns the number of nonzeros
SparseMatrix operator* (const double &x) const
template<typename OtherDerived>
OtherDerived operator* (const OtherDerived &x) const
SparseMatrix operator+ (const SparseMatrix &x) const
SparseMatrix operator- (const SparseMatrix &x) const
SparseMatrix operator/ (const double &x) const
int OuterSize () const
 returns the number of sparse column vectors
void Print (int rows, int cols) const
void Prune (TScalar reference, TRealScalar epsilon)
 sets all elements with absolute value <= reference to zero and removes from storage
void Prune (TScalar reference)
 sets all elements with absolute value <= reference to zero and removes from storage
void Resize (int rows, int cols)
 clears and resizes to the given dimension
void ResizeNonZeros (int size)
 resizes the internal vector of nonzero elements
int Rows () const
 returns the number of rows
void setMatrixType (const unsigned int &prop)
 Let the matrix know of which type it is.
void SetZero ()
 sets the object to zero (clears it)
SparseMatrix SparseDiagonal () const
 returns the diagonal as sparse matrix
 SparseMatrix (const TIndex &nrow, const TIndex &ncol=1)
 constructs a nrow*ncol matrix
 SparseMatrix (const Base &x)
 copy constructor from Eigen objects
template<typename OtherDerived>
 SparseMatrix (const Eigen::SparseMatrixBase< OtherDerived > &x)
 copy constructor from Eigen objects
 SparseMatrix (MathSparseArrayBase< TScalar > &ar, bool keep_data=true)
 copy constructor
 SparseMatrix ()
 default constructor
void StartFill (int num=0)
void Swap (Eigen::SparseMatrix< TScalar > &other)
void Swap (tngmath::SparseMatrix &other)
 swaps the contents of this object
SparseMatrix Transpose () const
 returns the transpose
SparseMatrix UpperTriangular () const
 returns the upper triangular part
virtual ~SparseMatrix ()
 destructor

Static Public Member Functions

static SparseMatrix Identity (int rows, int cols)
 returns a sparse identity matrix

Protected Attributes

int m_last_filled_col
int m_last_filled_row
unsigned int m_matrixType
 stores the matrix type


Detailed Description

The default sparse matrix class.

It extends SparseMatrixBase. While SparseMatrixBase provides the storage scheme and assumes that the storage concerns a general matrix, SparseMatrix can define several modes for the storage type. The user can change these modes by setting a flag without changing the data (only the behaviour), these types are:


Member Function Documentation

SparseMatrix tngmath::SparseMatrix::__neg__ ( const SparseMatrix x  )  const [inline]

returns unary minus (B=-A)

template<typename OtherDerived>
TScalar tngmath::SparseMatrix::Dott ( const OtherDerived &  x  )  const [inline]

overrides the sparsematrix-densevector product Dott (x'Ax).

SparseMatrix tngmath::SparseMatrix::operator* ( const double &  x  )  const

overrides the sparsematrix-scalar product.

template<typename OtherDerived>
OtherDerived tngmath::SparseMatrix::operator* ( const OtherDerived &  x  )  const [inline]

overrides the sparsematrix-densematrix product. If the type of the sparse matrix is known (

See also:
matrixType()), then the product will be performed following the scheme.

SparseMatrix tngmath::SparseMatrix::operator+ ( const SparseMatrix x  )  const

overrides the sparsematrix-sparsematrix sum.

SparseMatrix tngmath::SparseMatrix::operator- ( const SparseMatrix x  )  const

overrides the sparsematrix-sparsematrix subtraction

SparseMatrix tngmath::SparseMatrix::operator/ ( const double &  x  )  const

overrides the sparsematrix-scalar division.

void tngmath::SparseMatrix::Print ( int  rows,
int  cols 
) const

prints the sparse matrix up to the given rows and columns (internally a temporary dense matrix will be created)


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

Generated on Wed Nov 17 17:35:51 2010 for 'tngmath' Module Programming Interface by  doxygen 1.5.6