Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

SparseMatrixBase Class Template Reference
[linbox/matrix]

#include <sparse.h>

List of all members.


Detailed Description

template<class _Element, class _Row, class Trait>
class LinBox::SparseMatrixBase< _Element, _Row, Trait >

Sparse matrix container This class acts as a generic row-wise container for sparse matrices. It is designed to provide various methods to access the entries of the matrix. In particular, it does not meet the black box archetype; see \ref{SparseMatrix} for an appropriate sparse matrix black box.
Parameters:
Element  Element type
Row  LinBox sparse vector type to use for rows of matrix


Columns of rows iterator

The columns of row iterator gives each of the rows of the matrix in ascending order. Dereferencing the iterator yields a row vector in sparse sequence format

typedef Rep::iterator RowIterator
typedef Rep::const_iterator ConstRowIterator
RowIterator rowBegin ()
RowIterator rowEnd ()
ConstRowIterator rowBegin () const
ConstRowIterator rowEnd () const

Index iterator

The index iterator gives the row, column indices of all matrix elements in the same order as the raw iterator above. Its value type is an STL pair with the row and column indices, starting at 0, in the first and second positions, respectively.

RawIndexedIterator rawIndexedBegin ()
RawIndexedIterator rawIndexedEnd ()
ConstRawIndexedIterator rawIndexedBegin () const
ConstRawIndexedIterator rawIndexedEnd () const
Row & getRow (size_t i)
Row & operator[] (size_t i)
ConstRow & operator[] (size_t i) const
template<class Vector> Vector & columnDensity (Vector &v) const
SparseMatrixBase & transpose (SparseMatrixBase &AT) const
Rep _A
size_t _m
size_t _n
class SparseMatrixWriteHelper< Element, Row >
class SparseMatrixReadWriteHelper< Element, Row >

Public Types

typedef _Element Element
typedef _Row Row
typedef const Row ConstRow
typedef std::vector< Row > Rep

Public Methods

 SparseMatrixBase (size_t m, size_t n)
 SparseMatrixBase (const SparseMatrixBase< Element, Row, Trait > &A)
 ~SparseMatrixBase ()
size_t rowdim () const
size_t coldim () const
template<class Field> std::istream & read (std::istream &is, const Field &F, FileFormatTag format=FORMAT_DETECT)
std::istream & read (std::istream &is, FileFormatTag format=FORMAT_DETECT)
template<class Field> std::ostream & write (std::ostream &os, const Field &F, FileFormatTag format=FORMAT_PRETTY) const
std::ostream & write (std::ostream &os, FileFormatTag format=FORMAT_PRETTY) const
void setEntry (size_t i, size_t j, const Element &value)
Element & refEntry (size_t i, size_t j)
const Element & getEntry (size_t i, size_t j) const
Element & getEntry (Element &x, size_t i, size_t j) const
Raw iterator
The raw iterator is a method for accessing all nonzero entries in the matrix in some unspecified order. This can be used, e.g. to reduce all matrix entries modulo a prime before passing the matrix into an algorithm.

RawIterator rawBegin ()
RawIterator rawEnd ()
ConstRawIterator rawBegin () const
ConstRawIterator rawEnd () const


Member Typedef Documentation

typedef const Row ConstRow
 

typedef Rep::const_iterator ConstRowIterator
 

typedef _Element Element
 

Reimplemented in SparseMatrix.

typedef std::vector<Row> Rep
 

typedef _Row Row
 

Reimplemented in SparseIntegerMatrix, and SparseMatrix.

typedef Rep::iterator RowIterator
 


Constructor & Destructor Documentation

SparseMatrixBase (  size_t    m,
size_t    n
) 
 

Constructor. Note: the copy constructor and operator= will work as intended because of STL's container design

Parameters:
m  row dimension
n  column dimension

SparseMatrixBase (  const SparseMatrixBase< Element, Row, Trait > &    A ) 
 

Copy constructor.

~SparseMatrixBase (    )  [inline]
 

Destructor.


Member Function Documentation

size_t coldim (    )  const [inline]
 

Retreive column dimension of matrix.

Returns:
integer number of columns of SparseMatrixBase matrix.

Reimplemented in SparseMatrix.

Vector& columnDensity (  Vector &    v )  const
 

Compute the column density, i.e. the number of entries per column

Parameters:
v  Vector in which to store column density

Element& getEntry (  Element &    x,
size_t    i,
size_t    j
)  const
 

Get an entry and store it in the given value This form is more in the Linbox style and is provided for interface compatibility with other parts of the library

Parameters:
x  Element in which to store result
i  Row index
j  Column index
Returns:
Reference to x

const Element& getEntry (  size_t    i,
size_t    j
)  const
 

Get a read-only individual entry from the matrix

Parameters:
i  Row index
j  Column index
Returns:
Const reference to matrix entry

Row& getRow (  size_t    i ) 
 

Retrieve a row as a writeable reference

Parameters:
i  Row index

ConstRow& operator[] (  size_t    i )  const
 

Retrieve a row as a read-only reference

Parameters:
i  Row index

Row& operator[] (  size_t    i ) 
 

Retrieve a row as a writeable reference

Parameters:
i  Row index

ConstRawIterator rawBegin (    ) 
 

RawIterator rawBegin (    ) 
 

ConstRawIterator rawEnd (    ) 
 

RawIterator rawEnd (    ) 
 

ConstRawIndexedIterator rawIndexedBegin (    ) 
 

RawIndexedIterator rawIndexedBegin (    ) 
 

ConstRawIndexedIterator rawIndexedEnd (    ) 
 

RawIndexedIterator rawIndexedEnd (    ) 
 

std::istream& read (  std::istream &    is,
FileFormatTag    format = FORMAT_DETECT
) 
 

Read a matrix from the given input stream using standard operators

Parameters:
is  Input stream from which to read the matrix
format  Format of input matrix

Reimplemented in SparseMatrix.

std::istream& read (  std::istream &    is,
const Field &    F,
FileFormatTag    format = FORMAT_DETECT
) 
 

Read a matrix from the given input stream using field read/write

Parameters:
is  Input stream from which to read the matrix
F  Field with which to read
format  Format of input matrix

Element& refEntry (  size_t    i,
size_t    j
) 
 

Get a writeable reference to an entry in the matrix If there is no entry at the position (i, j), then a new entry with a value of zero is inserted and a reference to it is returned.

Parameters:
i  Row index of entry
j  Column index of entry
Returns:
Reference to matrix entry

ConstRowIterator rowBegin (    ) 
 

RowIterator rowBegin (    ) 
 

size_t rowdim (    )  const [inline]
 

Retreive row dimension of the matrix.

Returns:
integer number of rows of SparseMatrixBase matrix.

Reimplemented in SparseMatrix.

ConstRowIterator rowEnd (    ) 
 

RowIterator rowEnd (    ) 
 

void setEntry (  size_t    i,
size_t    j,
const Element &    value
) 
 

Set an individual entry Setting the entry to 0 will remove it from the matrix

Parameters:
i  Row index of entry
j  Column index of entry @value Value of the new entry

SparseMatrixBase& transpose (  SparseMatrixBase< _Element, _Row, Trait > &    AT )  const
 

Construct the transpose of this matrix and place it in the matrix given

std::ostream& write (  std::ostream &    os,
FileFormatTag    format = FORMAT_PRETTY
)  const
 

Write a matrix to the given output stream using standard operators

Parameters:
os  Output stream to which to write the matrix
format  Format with which to write

Reimplemented in SparseMatrix.

std::ostream& write (  std::ostream &    os,
const Field &    F,
FileFormatTag    format = FORMAT_PRETTY
)  const
 

Write a matrix to the given output stream using field read/write

Parameters:
os  Output stream to which to write the matrix
F  Field with which to write
format  Format with which to write


Friends And Related Function Documentation

friend class SparseMatrixReadWriteHelper< Element, Row > [friend]
 

friend class SparseMatrixWriteHelper< Element, Row > [friend]
 


Member Data Documentation

Rep _A [protected]
 

size_t _m [protected]
 

size_t _n [protected]
 


Generated on Mon Jun 20 09:16:55 2005 for linbox by doxygen1.2.18