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

MatrixArchetype Class Template Reference

#include <archetype.h>

List of all members.


Detailed Description

template<class _Element>
class LinBox::MatrixArchetype< _Element >

Directly-represented matrix archetype

This archetype gives the common interface for matrices that have direct representations. The matrices are required to provide iterators to access and manipulate their entries, but not any matrix-matrix or matrix-vector arithmetic. That is, they are pure containers. As such, they are only parameterized on the element type, not on the field type.


Row of columns iterator

The row of columns iterator traverses the columns of the matrix in ascending order. Dereferencing the iterator yields a column vector in dense format

typedef Col Column
typedef ConstCol ConstColumn
ColIterator colBegin ()
ColIterator colEnd ()
ConstColIterator colBegin () const
ConstColIterator colEnd () const

Raw Indexed iterator

Like the raw iterator, the indexed iterator is a method for accessing all entries in the matrix in some unspecified order. At each position of the the indexed iterator, it also provides the row and column indices of the currently referenced entry. This is provided through it's rowIndex() and colIndex() functions.

typedef const RawIndexedIterator ConstRawIndexedIterator
RawIndexedIterator rawIndexedBegin ()
RawIndexedIterator rawIndexedEnd ()
ConstRawIndexedIterator rawIndexedBegin () const
ConstRawIndexedIterator rawIndexedEnd () const
Row operator[] (size_t i)
ConstRow operator[] (size_t i) const

Public Types

typedef _Element Element

Public Methods

 MatrixArchetype ()
 MatrixArchetype (size_t m, size_t n)
 MatrixArchetype (const MatrixArchetype &M)
MatrixArchetype & operator= (const MatrixArchetype &M)
size_t rowdim () const
size_t coldim () const
void resize (size_t m, size_t n)
Input and output
template<class Field> std::istream & read (std::istream &file, const Field &F)
template<class Field> std::ostream & write (std::ostream &os, const Field &F) const
Access to matrix elements
void setEntry (size_t i, size_t j, const Element &a_ij)
ElementrefEntry (size_t i, size_t j)
const ElementgetEntry (size_t i, size_t j) const
ElementgetEntry (Element &x, size_t i, size_t j) const
Column of rows iterator
The column of rows iterator traverses the rows of the matrix in ascending order. Dereferencing the iterator yields a row vector in dense format

RowIterator rowBegin ()
RowIterator rowEnd ()
ConstRowIterator rowBegin () const
ConstRowIterator rowEnd () const
Raw iterator
The raw iterator is a method for accessing all 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
Computing matrix information
template<class Vector> VectorcolumnDensity (Vector &v) const
MatrixArchetype & transpose (MatrixArchetype &M) const

Protected Attributes

std::vector< Element_rep
size_t _rows
size_t _cols


Member Typedef Documentation

typedef Col Column
 

typedef ConstCol ConstColumn
 

typedef const RawIndexedIterator ConstRawIndexedIterator
 

typedef _Element Element
 


Constructor & Destructor Documentation

MatrixArchetype  
 

Emptye Constructor.

MatrixArchetype size_t    m,
size_t    n
 

Constructor with size

Parameters:
m  row dimension
n  column dimension

MatrixArchetype const MatrixArchetype< _Element > &    M
 

Copy constructor


Member Function Documentation

ConstColIterator colBegin  
 

ColIterator colBegin  
 

size_t coldim  
 

Get the number of columns in the matrix

Returns:
Number of columns in matrix

ConstColIterator colEnd  
 

ColIterator colEnd  
 

Vector& columnDensity Vector   v const
 

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

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

Copy the (i, j) entry into x, and return a reference to x. 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 reference to the entry in the (i, j) position.

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

MatrixArchetype& operator= const MatrixArchetype< _Element > &    M
 

Operator =

ConstRow operator[] size_t    i const
 

Row operator[] size_t    i
 

Retrieve a reference to a row. Since rows may also be indexed, this allows A[i][j] notation to be used.

This may be omitted by an implementation if no Row type is available

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 &    file,
const Field   F
 

Read the matrix from an input stream

Parameters:
file  Input stream from which to read
F  Field over which to read

Element& refEntry size_t    i,
size_t    j
 

Get a writeable reference to the entry in the (i, j) position.

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

void resize size_t    m,
size_t    n
 

Resize the matrix to the given dimensions The state of the matrix's entries after a call to this method is undefined

This interface is optional; a matrix can omit it if it makes no sense in the context.

Parameters:
m  Number of rows
n  Number of columns

ConstRowIterator rowBegin  
 

RowIterator rowBegin  
 

size_t rowdim  
 

Get the number of rows in the matrix

Returns:
Number of rows in matrix

ConstRowIterator rowEnd  
 

RowIterator rowEnd  
 

void setEntry size_t    i,
size_t    j,
const Element   a_ij
 

Set the entry at the (i, j) position to a_ij.

Parameters:
i  Row number, 0...rowdim () - 1
j  Column number 0...coldim () - 1
a_ij  Element to set

MatrixArchetype& transpose MatrixArchetype< _Element > &    M const
 

Compute the transpose

std::ostream& write std::ostream &    os,
const Field   F
const
 

Write the matrix to an output stream

Parameters:
os  Output stream to which to write
F  Field over which to write


Member Data Documentation

size_t _cols [protected]
 

std::vector<Element> _rep [protected]
 

size_t _rows [protected]
 


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