linbox
Data Structures | Public Types | Public Member Functions | Protected Attributes
BlasSubmatrix< _Element > Class Template Reference

Dense Submatrix representation. More...

#include <blas-matrix.h>

Data Structures

class  ConstIndexedIterator
 Raw Indexed Iterator (const version). More...
class  ConstIterator
 Raw Iterators (const version). More...
class  IndexedIterator
 Raw Indexed Iterator. More...
class  Iterator
 Raw Iterators. More...

Public Types

typedef _Element Element
 Element type.
typedef BlasSubmatrix< _Element > Self_t
 Self type.
typedef'd Row Iterators.

The row iterator gives the rows of the matrix in ascending order.

Dereferencing the iterator yields a row vector in dense format

typedef BlasMatrix< Element >
::RowIterator 
RowIterator
typedef BlasMatrix< Element >
::ConstRowIterator 
ConstRowIterator
typedef BlasMatrix< Element >::Row Row
typedef BlasMatrix< Element >
::ConstRow 
ConstRow
typedef'd Column Iterators.

The columns iterator gives the columns of the matrix in ascending order.

Dereferencing the iterator yields a column vector in dense format

typedef BlasMatrix< Element >
::ColIterator 
ColIterator
typedef BlasMatrix< Element >
::ConstColIterator 
ConstColIterator
typedef BlasMatrix< Element >::Col Col
typedef BlasMatrix< Element >
::Column 
Column
typedef BlasMatrix< Element >
::ConstCol 
ConstCol

Public Member Functions

 BlasSubmatrix ()
 NULL constructor.
 BlasSubmatrix (const BlasMatrix< Element > &M, size_t rowbeg, size_t colbeg, size_t Rowdim, size_t Coldim)
 Constructor from an existing BlasMatrix and dimensions.
 BlasSubmatrix (const BlasMatrix< Element > &M)
 Constructor from an existing DenseMatrixBase.
 BlasSubmatrix (const BlasSubmatrix< Element > &SM, size_t rowbeg, size_t colbeg, size_t Rowdim, size_t Coldim)
 Constructor from an existing submatrix and dimensions.
 BlasSubmatrix (const BlasSubmatrix< Element > &SM)
 Copy constructor.
BlasSubmatrixoperator= (const BlasSubmatrix< Element > &SM)
 Assignment operator.
size_t rowdim () const
 Get the number of rows in the matrix.
size_t coldim () const
 Get the number of columns in the matrix.
size_t getStride () const
  Get the stride of the matrix.
template<class Field >
std::istream & read (std::istream &file, const Field &field)
 Read the matrix from an input stream.
template<class Field >
std::ostream & write (std::ostream &os, const Field &field, bool mapleFormat=true) const
 Write the matrix to an output stream.
std::ostream & write (std::ostream &os, bool mapleFormat=true) const
 Write the matrix to an output stream.
void setEntry (size_t i, size_t j, const Element &a_ij)
 Set the entry at (i, j).
ElementrefEntry (size_t i, size_t j)
 Get a writeable reference to an entry in the matrix.
const ElementgetEntry (size_t i, size_t j) const
 Get a read-only individual entry from the matrix.
ElementgetEntry (Element &x, size_t i, size_t j) const
 Get an entry and store it in the given value.
RowIterator rowBegin ()
 iterator to the begining of a row
RowIterator rowEnd ()
 iterator to the end of a row
ConstRowIterator rowBegin () const
 const iterator to the begining of a row
ConstRowIterator rowEnd () const
 const iterator to the end of a row
Row operator[] (size_t i)
 operator[].

Protected Attributes

BlasMatrix< Element > * _M
 Parent BlasMatrix (ie raw vector)
size_t _row
 row dimension of Submatrix
size_t _col
 col dimension of Submatrix
size_t _r0
 upper left corner row of Submatrix in _M
size_t _c0
 upper left corner row of Submatrix in _M
size_t _stride
 number of columns in _M (or stride of _M)

Detailed Description

template<class _Element>
class LinBox::BlasSubmatrix< _Element >

Dense Submatrix representation.

A BlasSubmatrix is a matrix of _Element, with the structure of BLAS matrices. It is basically a read/write view on a vector of _Element. In the Mother model, a BlasSubmatrix is not allocated.

This matrix type conforms to the same interface as BlasMatrix, except that you cannot resize it. It represents a submatrix of a dense matrix. Upon construction, one can freely manipulate the entries in the DenseSubmatrix, and the corresponding entries in the underlying BlasMatrix will be modified.


Constructor & Destructor Documentation

NULL constructor.

BlasSubmatrix ( const BlasMatrix< Element > &  M,
size_t  rowbeg,
size_t  colbeg,
size_t  Rowdim,
size_t  Coldim 
)

Constructor from an existing BlasMatrix and dimensions.

Parameters:
MPointer to BlasMatrix of which to construct submatrix
rowbegStarting row
colgebStarting column
RowdimRow dimension
ColdimColumn dimension
BlasSubmatrix ( const BlasMatrix< Element > &  M)

Constructor from an existing DenseMatrixBase.

Parameters:
MPointer to DenseMatrixBase of which to construct submatrix
BlasSubmatrix ( const BlasSubmatrix< Element > &  SM,
size_t  rowbeg,
size_t  colbeg,
size_t  Rowdim,
size_t  Coldim 
)

Constructor from an existing submatrix and dimensions.

Parameters:
SMConstant reference to BlasSubmatrix from which to construct submatrix
rowbegStarting row
colbegStarting column
RowdimRow dimension
ColdimColumn dimension
BlasSubmatrix ( const BlasSubmatrix< Element > &  SM)

Copy constructor.

Parameters:
SMSubmatrix to copy

Member Function Documentation

BlasSubmatrix< _Element > & operator= ( const BlasSubmatrix< Element > &  SM)

Assignment operator.

Assign the given submatrix to this one This is only renaming ! There is no copy because BlasSubmatrix owns nothing.

Parameters:
SMSubmatrix to assign
Returns:
Reference to this submatrix
size_t rowdim ( ) const

Get the number of rows in the matrix.

Returns:
Number of rows in matrix
size_t coldim ( ) const

Get the number of columns in the matrix.

Returns:
Number of columns in matrix
size_t getStride ( ) const

 Get the stride of the matrix.

Returns:
stride of submatrix (number of cols of dense base matrix)
std::istream & read ( std::istream &  file,
const Field &  F 
)

Read the matrix from an input stream.

Parameters:
fileInput stream from which to read
field
Bug:
reading a submatrix should not be allowed !!
std::ostream & write ( std::ostream &  os,
const Field &  field,
bool  mapleFormat = true 
) const

Write the matrix to an output stream.

Parameters:
osOutput stream to which to write
field
mapleFormatwrite in Maple(r) format ?
Warning:
matrix base does not provide this field(), maybe should? _M.field ().write (os, *pe); os << *pe; fixed by using extra field
std::ostream & write ( std::ostream &  os,
bool  mapleFormat = true 
) const

Write the matrix to an output stream.

This a raw version of write(os,F) (no field is given).

Parameters:
osOutput stream to which to write
mapleFormatwrite in Maple(r) format ?
void setEntry ( size_t  i,
size_t  j,
const Element a_ij 
)

Set the entry at (i, j).

Parameters:
iRow number, 0...rowdim () - 1
jColumn number 0...coldim () - 1
a_ijElement to set
_Element & refEntry ( size_t  i,
size_t  j 
)

Get a writeable reference to an entry in the matrix.

Parameters:
iRow index of entry
jColumn index of entry
Returns:
Reference to matrix entry
const _Element & getEntry ( size_t  i,
size_t  j 
) const

Get a read-only individual entry from the matrix.

Parameters:
iRow index
jColumn index
Returns:
Const reference to matrix entry
_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:
xElement in which to store result
iRow index
jColumn index
Returns:
Reference to x
BlasSubmatrix< _Element >::Row operator[] ( size_t  i)

operator[].

Retrieve a reference to a row

Parameters:
iRow index

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