linbox
Public Types | Public Member Functions | Protected Attributes
Submatrix< BlasMatrix< _Field >, VectorCategories::DenseVectorTag > Class Template Reference

Specialization for BlasMatrix. More...

#include <submatrix.h>

+ Inheritance diagram for Submatrix< BlasMatrix< _Field >, VectorCategories::DenseVectorTag >:
+ Collaboration diagram for Submatrix< BlasMatrix< _Field >, VectorCategories::DenseVectorTag >:

Public Types

typedef const BlasSubmatrix< typename BlasMatrix< _Field > ::constSelf_tconstSelf_t
 Self type (const)
 
typedef Rep::pointer pointer
 pointer type to elements
 
typedef const pointer const_pointer
 const pointer type
 
typedef Self_t subMatrixType
 Submatrix type.
 
typedef constSelf_t constSubMatrixType
 Submatrix type (const)
 
typedef BlasMatrix< _Field > ::Self_t matrixType
 non const matrix type
 
typedef BlasMatrix< _Field > ::constSelf_t constMatrixType
 matrix type (const)
 
typedef matrixType blasType
 blas matrix type
 
typedef BlasVector< Field, Rep > vectorType
 blas matrix 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 matrixType::RowIterator RowIterator
 
typedef matrixType::ConstRowIterator ConstRowIterator
 
typedef matrixType::Row Row
 
typedef matrixType::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 matrixType::ColIterator ColIterator
 
typedef matrixType::ConstColIterator ConstColIterator
 
typedef matrixType::Col Col
 
typedef matrixType::Column Column
 
typedef matrixType::ConstCol ConstCol
 

Public Member Functions

 Submatrix (const BlasMatrix< Field > *Mat, size_t row, size_t col, size_t Rowdim, size_t Coldim)
 Constructor from an existing BlasMatrix and dimensions. More...
 
 Submatrix (const BlasMatrix< Field > &Mat, size_t row, size_t col, size_t Rowdim, size_t Coldim)
 Constructor from an existing BlasMatrix and dimensions. More...
 
 Submatrix (const Submatrix< BlasMatrix< Field > > *SM, size_t row, size_t col, size_t Rowdim, size_t Coldim)
 Constructor from an existing submatrix and dimensions. More...
 
 Submatrix (const Submatrix< BlasMatrix< Field > > &SM, size_t row, size_t col, size_t Rowdim, size_t Coldim)
 Constructor from an existing submatrix and dimensions. More...
 
const Field & field () const
 get the field
 
std::istream & read (std::istream &is)
 read
 
std::ostream & write (std::ostream &os) const
 write
 
template<class Vect1 , class Vect2 >
Vect1 & apply (Vect1 &y, const Vect2 &x) const
 Generic matrix-vector apply y = A * x. More...
 
template<class Vect1 , class Vect2 >
Vect1 & applyTranspose (Vect1 &y, const Vect2 &x) const
 Generic matrix-vector transpose apply y = A^T * x This version of applyTranspose allows use of arbitrary input and output vector types. More...
 
BlasSubmatrixcopy (const Matrix &B)
 This is deep copy of the data, operator= is a shallow copy.
 
BlasSubmatrixswap (Self_t &B)
 Swap contents. Shapes must be the same.
 
BlasSubmatrixzero ()
 Overwrite with zeroes.
 
void random ()
 Overwrite with random elements.
 
size_t rowdim () const
 Get the number of rows in the matrix. More...
 
size_t coldim () const
 Get the number of columns in the matrix. More...
 
size_t getStride () const
  Get the stride of the matrix. More...
 
std::ostream & write (std::ostream &os, Tag::FileFormat f=Tag::FileFormat::MatrixMarket) const
 Write the matrix to an output stream. More...
 
pointer getPointer ()
  .
 
pointer getWritePointer ()
  .
 
const Element & setEntry (size_t i, size_t j, const Element &a_ij)
 Set the entry at (i, j). More...
 
Element & refEntry (size_t i, size_t j)
 Get a writeable reference to an entry in the matrix. More...
 
const Element & getEntry (size_t i, size_t j) const
 Get a read-only individual entry from the matrix. More...
 
Element & getEntry (Element &x, size_t i, size_t j) const
 Get an entry and store it in the given value. More...
 
RowIterator rowBegin ()
 iterator to the begining of a row
 
ConstRowIterator rowBegin () const
 const iterator to the begining of a row
 
RowIterator rowEnd ()
 iterator to the end of a row
 
ConstRowIterator rowEnd () const
 const iterator to the end of a row
 
Row operator[] (size_t i)
 operator[]. More...
 
Vector1 & apply (Vector1 &y, const Vector2 &x) const
 
Vector1 & applyTranspose (Vector1 &y, const Vector2 &x) const
 

Protected Attributes

BlasMatrix< _Field > & _Mat
 Parent BlasMatrix (ie encapsulated raw std::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 _Mat
 
size_t _c0
 upper left corner row of Submatrix in _Mat
 
size_t _stride
 number of columns in _Mat (or stride of _Mat)
 
size_t _off
 offset in _Mat, precomputed (_row*_stride+_col)
 

Detailed Description

template<class _Field>
class LinBox::Submatrix< BlasMatrix< _Field >, VectorCategories::DenseVectorTag >

Specialization for BlasMatrix.

Constructor & Destructor Documentation

◆ Submatrix() [1/4]

Submatrix ( const BlasMatrix< Field > *  Mat,
size_t  row,
size_t  col,
size_t  Rowdim,
size_t  Coldim 
)
inline

Constructor from an existing BlasMatrix and dimensions.

Parameters
MatPointer to BlasMatrix of which to construct submatrix
rowStarting row
colStarting column
RowdimRow dimension
ColdimColumn dimension

◆ Submatrix() [2/4]

Submatrix ( const BlasMatrix< Field > &  Mat,
size_t  row,
size_t  col,
size_t  Rowdim,
size_t  Coldim 
)
inline

Constructor from an existing BlasMatrix and dimensions.

Parameters
Matreference to BlasMatrix of which to construct submatrix
rowStarting row
colStarting column
RowdimRow dimension
ColdimColumn dimension

◆ Submatrix() [3/4]

Submatrix ( const Submatrix< BlasMatrix< Field > > *  SM,
size_t  row,
size_t  col,
size_t  Rowdim,
size_t  Coldim 
)
inline

Constructor from an existing submatrix and dimensions.

Parameters
SMpointer to Submatrix from which to construct submatrix
rowStarting row
colStarting column
RowdimRow dimension
ColdimColumn dimension

◆ Submatrix() [4/4]

Submatrix ( const Submatrix< BlasMatrix< Field > > &  SM,
size_t  row,
size_t  col,
size_t  Rowdim,
size_t  Coldim 
)
inline

Constructor from an existing submatrix and dimensions.

Parameters
SMreference to Submatrix from which to construct submatrix
rowStarting row
colStarting column
RowdimRow dimension
ColdimColumn dimension

Member Function Documentation

◆ apply() [1/2]

Vect1& apply ( Vect1 &  y,
const Vect2 &  x 
) const
inline

Generic matrix-vector apply y = A * x.

This version of apply allows use of arbitrary input and output vector * types.

Parameters
yOutput vector
xInput vector
Returns
Reference to output vector

◆ applyTranspose() [1/2]

Vect1& applyTranspose ( Vect1 &  y,
const Vect2 &  x 
) const
inline

Generic matrix-vector transpose apply y = A^T * x This version of applyTranspose allows use of arbitrary input and output vector types.

Parameters
yOutput vector
xInput vector
Returns
Reference to output vector

◆ rowdim()

size_t rowdim ( ) const
inherited

Get the number of rows in the matrix.

Returns
Number of rows in matrix

◆ coldim()

size_t coldim ( ) const
inherited

Get the number of columns in the matrix.

Returns
Number of columns in matrix

◆ getStride()

size_t getStride ( ) const
inherited

 Get the stride of the matrix.

Returns
stride of submatrix (number of cols of dense base matrix)

◆ write()

std::ostream & write ( std::ostream &  os,
Tag::FileFormat  f = Tag::FileFormat::MatrixMarket 
) const
inherited

Write the matrix to an output stream.

Parameters
osOutput stream to which to write
fwrite in some format (Tag::FileFormat::Format). Default is MM's.
Warning
matrix base does not provide this field(), maybe should? _Mat.field ().write (os, *pe); os << *pe; fixed by using extra field

◆ setEntry()

const LinBox::BlasSubmatrix< BlasMatrix< _Field > >::Element & setEntry ( size_t  i,
size_t  j,
const Element a_ij 
)
inherited

Set the entry at (i, j).

Parameters
iRow number, 0...rowdim () - 1
jColumn number 0...coldim () - 1
a_ijElement to set

◆ refEntry()

LinBox::BlasSubmatrix< BlasMatrix< _Field > >::Element & refEntry ( size_t  i,
size_t  j 
)
inherited

Get a writeable reference to an entry in the matrix.

Parameters
iRow index of entry
jColumn index of entry
Returns
Reference to matrix entry

◆ getEntry() [1/2]

const LinBox::BlasSubmatrix< BlasMatrix< _Field > >::Element & getEntry ( size_t  i,
size_t  j 
) const
inherited

Get a read-only individual entry from the matrix.

Parameters
iRow index
jColumn index
Returns
Const reference to matrix entry

◆ getEntry() [2/2]

LinBox::BlasSubmatrix< BlasMatrix< _Field > >::Element & getEntry ( Element x,
size_t  i,
size_t  j 
) const
inherited

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

◆ operator[]()

BlasSubmatrix< BlasMatrix< _Field > >::Row operator[] ( size_t  i)
inherited

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ apply() [2/2]

Vector1& apply ( Vector1 &  y,
const Vector2 &  x 
) const
inlineinherited
Bug:
every vector we use here should have a stride/be blas vectors so it's not really templated by Vector1 Vector2 in general

◆ applyTranspose() [2/2]

Vector1& applyTranspose ( Vector1 &  y,
const Vector2 &  x 
) const
inlineinherited
Bug:
use Matrix domain

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