linbox
BlasSubmatrix< _Matrix > Class Template Reference

#include <blas-submatrix.h>

+ Inheritance diagram for BlasSubmatrix< _Matrix >:

Data Structures

class  ConstIterator
 Raw Iterators (const version). More...
 
class  Iterator
 Raw Iterators. More...
 
struct  rebind
 

Public Types

typedef _Matrix::Field Field
 
typedef Field::Element Element
 Element type.
 
typedef _Matrix::Storage Storage
 
typedef _Matrix::RawStorage RawStorage
 
typedef BlasSubmatrix< _Matrix > Self_t
 Self type.
 
typedef MatrixEltPointer< _Matrix >::pointer pointer
 pointer type to elements
 
typedef MatrixEltPointer< const_Matrix >::pointer const_pointer
 const pointer type to elements
 
typedef _Matrix matrixType
 matrix type
 
typedef Self_t subMatrixType
 
typedef BlasSubmatrix< const _Matrix > constSubMatrixType
 
typedef BlasSubmatrix< typename std::remove_const< _Matrix >::type > nonconstSubMatrixType
 
typedef Storage::subVectorType subVectorType
 
typedef Storage::constSubVectorType constSubVectorType
 
typedef subVectorType Row
 
typedef subVectorType Col
 
typedef constSubVectorType ConstRow
 
typedef constSubVectorType ConstCol
 

Public Member Functions

 BlasSubmatrix (matrixType &M, size_t rowbeg, size_t colbeg, size_t Rowdim, size_t Coldim)
 Constructor from an existing BlasMatrix and dimensions.
 
 BlasSubmatrix (Self_t &SM, size_t rowbeg, size_t colbeg, size_t Rowdim, size_t Coldim)
 Constructor from an existing submatrix and dimensions.
 
 BlasSubmatrix (matrixType &M)
 Constructor from an existing BlasMatrix.
 
 BlasSubmatrix (const Field &F, pointer ptr, size_t Rowdim, size_t Coldim, size_t stride)
 Constructor from a raw pointer.
 
 BlasSubmatrix (const constSubMatrixType &M)
 Copy constructor (virtual copy)
 
 BlasSubmatrix (nonconstSubMatrixType &M)
 
 BlasSubmatrix (const nonconstSubMatrixType &M)
 
 BlasSubmatrix (Self_t &&M)=default
 Move constructor / Move operator.
 
Self_toperator= (Self_t &&M)=default
 
template<class _AnyMatrix>
Self_tcopy (const _AnyMatrix &A)
 (copying data) -> works only if dimensions are the same
 
template<class _AnyMatrix>
Self_tswap (_AnyMatrix &A)
 (swaping local data to same dimension (sub)part of A) -> works only if both dimensions of A are larger
 
Self_toperator= (const Self_t &M)=delete
 
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.
 
const Fieldfield () const
 Get the field of the BlasSubMatrix.
 
pointer getPointer ()
  
 
const_pointer getPointer () const
 
const_pointer getConstPointer () const
 
std::istream & read (std::istream &file)
 Read the matrix from an input stream.
 
std::ostream & write (std::ostream &os, Tag::FileFormat f=Tag::FileFormat::Plain) 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.
 
template<class Vector1, class Vector2>
Vector1 & apply (Vector1 &y, const Vector2 &x) const
 
std::vector< Element > & apply (std::vector< Element > &y, const std::vector< Element > &x) const
 
template<class Vector1, class Vector2>
Vector1 & applyTranspose (Vector1 &y, const Vector2 &x) const
 
std::vector< Element > & applyTranspose (std::vector< Element > &y, const std::vector< Element > &x) const
 
void zero ()
 
void random ()
 
template<class RandIter>
void random (RandIter &G)
 
template<class _AnyMatrix>
BlasSubmatrix< _Matrix > & copy (const _AnyMatrix &M)
 
template<class _AnyMatrix>
BlasSubmatrix< _Matrix > & swap (_AnyMatrix &M)
 

Protected Attributes

pointer _ptr
 pointer to the first elt of the submatrix
 
size_t _row
 row dimension of Submatrix
 
size_t _col
 col dimension of Submatrix
 
size_t _stride
 stride of the original matrix
 
const Field_field
 

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

using RowIterator = BlasMatrixIterator<Field, Storage, subVectorType>
 
using ConstRowIterator = BlasMatrixIterator<Field, Storage, constSubVectorType>
 
RowIterator rowBegin ()
 
ConstRowIterator rowBegin () const
 
RowIterator rowEnd ()
 
ConstRowIterator rowEnd () const
 

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

using ColIterator = BlasMatrixIterator<Field, Storage, subVectorType>
 operator[].
 
using ConstColIterator = BlasMatrixIterator<Field, Storage, constSubVectorType>
 operator[].
 
using IndexedIterator = BlasMatrixIndexedIterator<Field, pointer, Element>
 operator[].
 
using ConstIndexedIterator = BlasMatrixIndexedIterator<Field, const_pointer, const Element>
 operator[].
 
ColIterator colBegin ()
 operator[].
 
ConstColIterator colBegin () const
 operator[].
 
ColIterator colEnd ()
 operator[].
 
ConstColIterator colEnd () const
 operator[].
 
Iterator Begin ()
 operator[].
 
ConstIterator Begin () const
 operator[].
 
Iterator End ()
 operator[].
 
ConstIterator End () const
 operator[].
 
IndexedIterator IndexedBegin ()
 operator[].
 
ConstIndexedIterator IndexedBegin () const
 operator[].
 
IndexedIterator IndexedEnd ()
 operator[].
 
ConstIndexedIterator IndexedEnd () const
 operator[].
 
subVectorType operator[] (size_t i)
 operator[].
 
constSubVectorType operator[] (size_t i) const
 operator[].
 

Member Typedef Documentation

◆ Field

template<class _Matrix>
typedef _Matrix::Field Field

◆ Element

template<class _Matrix>
typedef Field::Element Element

Element type.

◆ Storage

template<class _Matrix>
typedef _Matrix::Storage Storage

◆ RawStorage

template<class _Matrix>
typedef _Matrix::RawStorage RawStorage

◆ Self_t

template<class _Matrix>
typedef BlasSubmatrix<_Matrix> Self_t

Self type.

◆ pointer

template<class _Matrix>
typedef MatrixEltPointer<_Matrix>::pointer pointer

pointer type to elements

◆ const_pointer

template<class _Matrix>
typedef MatrixEltPointer<const_Matrix>::pointer const_pointer

const pointer type to elements

◆ matrixType

template<class _Matrix>
typedef _Matrix matrixType

matrix type

◆ subMatrixType

template<class _Matrix>
typedef Self_t subMatrixType

◆ constSubMatrixType

template<class _Matrix>
typedef BlasSubmatrix<const _Matrix> constSubMatrixType

◆ nonconstSubMatrixType

template<class _Matrix>
typedef BlasSubmatrix<typename std::remove_const<_Matrix>::type> nonconstSubMatrixType

◆ subVectorType

template<class _Matrix>
typedef Storage::subVectorType subVectorType

◆ constSubVectorType

template<class _Matrix>
typedef Storage::constSubVectorType constSubVectorType

◆ Row

template<class _Matrix>
typedef subVectorType Row

◆ Col

template<class _Matrix>
typedef subVectorType Col

◆ ConstRow

template<class _Matrix>
typedef constSubVectorType ConstRow

◆ ConstCol

template<class _Matrix>
typedef constSubVectorType ConstCol

◆ RowIterator

template<class _Matrix>
using RowIterator = BlasMatrixIterator<Field, Storage, subVectorType>

◆ ConstRowIterator

◆ ColIterator

template<class _Matrix>
using ColIterator = BlasMatrixIterator<Field, Storage, subVectorType>

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ ConstColIterator

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ IndexedIterator

template<class _Matrix>
using IndexedIterator = BlasMatrixIndexedIterator<Field, pointer, Element>

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ ConstIndexedIterator

template<class _Matrix>
using ConstIndexedIterator = BlasMatrixIndexedIterator<Field, const_pointer, const Element>

operator[].

Retrieve a reference to a row

Parameters
iRow index

Constructor & Destructor Documentation

◆ BlasSubmatrix() [1/8]

template<class _Matrix>
BlasSubmatrix ( matrixType & 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
colbegStarting column
RowdimRow dimension
ColdimColumn dimension

◆ BlasSubmatrix() [2/8]

template<class _Matrix>
BlasSubmatrix ( Self_t & 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() [3/8]

template<class _Matrix>
BlasSubmatrix ( matrixType & M)

Constructor from an existing BlasMatrix.

Parameters
MPointer to BlasMatrix of which to construct submatrix

◆ BlasSubmatrix() [4/8]

template<class _Matrix>
BlasSubmatrix ( const Field & F,
pointer ptr,
size_t Rowdim,
size_t Coldim,
size_t stride )

Constructor from a raw pointer.

Parameters
MPointer to BlasMatrix of which to construct submatrix

◆ BlasSubmatrix() [5/8]

template<class _Matrix>
BlasSubmatrix ( const constSubMatrixType & M)

Copy constructor (virtual copy)

◆ BlasSubmatrix() [6/8]

template<class _Matrix>
BlasSubmatrix ( nonconstSubMatrixType & M)

◆ BlasSubmatrix() [7/8]

template<class _Matrix>
BlasSubmatrix ( const nonconstSubMatrixType & M)

◆ BlasSubmatrix() [8/8]

template<class _Matrix>
BlasSubmatrix ( Self_t && M)
default

Move constructor / Move operator.

Member Function Documentation

◆ operator=() [1/2]

template<class _Matrix>
Self_t & operator= ( Self_t && M)
default

◆ copy() [1/2]

template<class _Matrix>
template<class _AnyMatrix>
Self_t & copy ( const _AnyMatrix & A)

(copying data) -> works only if dimensions are the same

◆ swap() [1/2]

template<class _Matrix>
template<class _AnyMatrix>
Self_t & swap ( _AnyMatrix & A)

(swaping local data to same dimension (sub)part of A) -> works only if both dimensions of A are larger

◆ operator=() [2/2]

template<class _Matrix>
Self_t & operator= ( const Self_t & M)
delete

◆ rowdim()

template<class _Matrix>
size_t rowdim ( ) const
inline

Get the number of rows in the matrix.

Returns
Number of rows in matrix

◆ coldim()

template<class _Matrix>
size_t coldim ( ) const
inline

Get the number of columns in the matrix.

Returns
Number of columns in matrix

◆ getStride()

template<class _Matrix>
size_t getStride ( ) const
inline

Get the stride of the matrix.

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

◆ field()

template<class _Matrix>
const Field & field ( ) const
inline

Get the field of the BlasSubMatrix.

Returns
Const reference to Field

◆ getPointer() [1/2]

template<class _Matrix>
pointer getPointer ( )
inline

 

Get pointer to the matrix data (read/write access will depend on the type of the template parameter _Matrix, i.e. const or not)

◆ getPointer() [2/2]

template<class _Matrix>
const_pointer getPointer ( ) const
inline

◆ getConstPointer()

template<class _Matrix>
const_pointer getConstPointer ( ) const
inline

◆ read()

template<class _Matrix>
std::istream & read ( std::istream & file)

Read the matrix from an input stream.

Parameters
fileInput stream from which to read
Bug
reading a submatrix should not be allowed !!

◆ write()

template<class _Matrix>
std::ostream & write ( std::ostream & os,
Tag::FileFormat f = Tag::FileFormat::Plain ) const

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.

◆ setEntry()

template<class _Matrix>
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

◆ refEntry()

template<class _Matrix>
BlasSubmatrix< _Matrix >::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

◆ getEntry() [1/2]

template<class _Matrix>
const BlasSubmatrix< _Matrix >::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

◆ getEntry() [2/2]

template<class _Matrix>
BlasSubmatrix< _Matrix >::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

◆ apply() [1/2]

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

◆ apply() [2/2]

template<class _Matrix>
std::vector< Element > & apply ( std::vector< Element > & y,
const std::vector< Element > & x ) const
inline

◆ applyTranspose() [1/2]

template<class _Matrix>
template<class Vector1, class Vector2>
Vector1 & applyTranspose ( Vector1 & y,
const Vector2 & x ) const
inline
Bug

use Matrix domain

since removal of ApplyDomain this does not handle the case where Field if Givaro::Extension needed for charpoly computation

◆ applyTranspose() [2/2]

template<class _Matrix>
std::vector< Element > & applyTranspose ( std::vector< Element > & y,
const std::vector< Element > & x ) const
inline

◆ zero()

template<class _Matrix>
void zero ( )
inline

◆ random() [1/2]

template<class _Matrix>
void random ( )
inline

◆ random() [2/2]

template<class _Matrix>
template<class RandIter>
void random ( RandIter & G)
inline

◆ rowBegin() [1/2]

template<class _Matrix>
RowIterator rowBegin ( )
inline

◆ rowBegin() [2/2]

template<class _Matrix>
ConstRowIterator rowBegin ( ) const
inline

◆ rowEnd() [1/2]

template<class _Matrix>
RowIterator rowEnd ( )
inline

◆ rowEnd() [2/2]

template<class _Matrix>
ConstRowIterator rowEnd ( ) const
inline

◆ colBegin() [1/2]

template<class _Matrix>
ColIterator colBegin ( )
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ colBegin() [2/2]

template<class _Matrix>
ConstColIterator colBegin ( ) const
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ colEnd() [1/2]

template<class _Matrix>
ColIterator colEnd ( )
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ colEnd() [2/2]

template<class _Matrix>
ConstColIterator colEnd ( ) const
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ Begin() [1/2]

template<class _Matrix>
Iterator Begin ( )
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ Begin() [2/2]

template<class _Matrix>
ConstIterator Begin ( ) const
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ End() [1/2]

template<class _Matrix>
Iterator End ( )
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ End() [2/2]

template<class _Matrix>
ConstIterator End ( ) const
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ IndexedBegin() [1/2]

template<class _Matrix>
IndexedIterator IndexedBegin ( )
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ IndexedBegin() [2/2]

template<class _Matrix>
ConstIndexedIterator IndexedBegin ( ) const
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ IndexedEnd() [1/2]

template<class _Matrix>
IndexedIterator IndexedEnd ( )
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ IndexedEnd() [2/2]

template<class _Matrix>
ConstIndexedIterator IndexedEnd ( ) const
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ operator[]() [1/2]

template<class _Matrix>
subVectorType operator[] ( size_t i)
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ operator[]() [2/2]

template<class _Matrix>
constSubVectorType operator[] ( size_t i) const
inline

operator[].

Retrieve a reference to a row

Parameters
iRow index

◆ copy() [2/2]

template<class _Matrix>
template<class _AnyMatrix>
BlasSubmatrix< _Matrix > & copy ( const _AnyMatrix & M)

◆ swap() [2/2]

template<class _Matrix>
template<class _AnyMatrix>
BlasSubmatrix< _Matrix > & swap ( _AnyMatrix & M)

Field Documentation

◆ _ptr

template<class _Matrix>
pointer _ptr
protected

pointer to the first elt of the submatrix

◆ _row

template<class _Matrix>
size_t _row
protected

row dimension of Submatrix

◆ _col

template<class _Matrix>
size_t _col
protected

col dimension of Submatrix

◆ _stride

template<class _Matrix>
size_t _stride
protected

stride of the original matrix

◆ _field

template<class _Matrix>
const Field& _field
protected

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