linbox
Public Types | Public Member Functions | Data Fields | Protected Member Functions
TriangularBlasMatrix< _Field, _Storage > Class Template Reference

Triangular BLAS matrix. More...

#include <blas-matrix.h>

+ Inheritance diagram for TriangularBlasMatrix< _Field, _Storage >:

Public Types

typedef Field::Element Element
 Element type.
 
typedef _Storage::pointer pointer
 pointer type to elements
 
typedef const pointer const_pointer
 const pointer type
 
typedef const BlasMatrix
< _Field, _Storage > 
constSelf_t
 Self typeype.
 
typedef BlasSubmatrix< Self_tsubMatrixType
 Submatrix type.
 
typedef BlasSubmatrix
< constSelf_t
constSubMatrixType
 Submatrix type.
 
typedef Self_t matrixType
 matrix type
 
typedef constSelf_t constMatrixType
 matrix type
 
typedef Self_t blasType
 blas matrix type
 

Public Member Functions

 TriangularBlasMatrix (const Field &F, const size_t m, const size_t n, LINBOX_enum(Tag::Shape) x=Tag::Shape::Upper, LINBOX_enum(Tag::Diag) y=Tag::Diag::NonUnit)
 Constructor for a new TriangularBlasMatrix. More...
 
 TriangularBlasMatrix (const BlasMatrix< Field, Rep > &A, LINBOX_enum(Tag::Shape) x=Tag::Shape::Upper, LINBOX_enum(Tag::Diag) y=Tag::Diag::NonUnit)
 Constructor from a BlasMatrix (copy). More...
 
 TriangularBlasMatrix (BlasMatrix< Field, Rep > &A, LINBOX_enum(Tag::Shape) x=Tag::Shape::Upper, LINBOX_enum(Tag::Diag) y=Tag::Diag::NonUnit)
 Constructor from a BlasMatrix (no copy). More...
 
 TriangularBlasMatrix (const TriangularBlasMatrix< Field, Rep > &A)
 Constructor from a TriangularBlasMatrix (copy). More...
 
template<class Matrix >
 TriangularBlasMatrix (const Matrix &A, LINBOX_enum(Tag::Shape) x=Tag::Shape::Upper, LINBOX_enum(Tag::Diag) y=Tag::Diag::NonUnit)
 Generic constructor from a Matrix (no copy). More...
 
FFLAS::FFLAS_UPLO getUpLo () const
 get the shape of the matrix (upper or lower)
 
FFLAS::FFLAS_DIAG getDiag () const
 Is the diagonal implicitly unit ?
 
void init (const _Field &F, const size_t &r=0, const size_t &c=0)
 Allocates a new bare $ 0 \times 0$ matrix (unshaped, unready). More...
 
BlasMatrixcopy (const Matrix &B)
 Make this a (deep)copy of B. More...
 
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.
 
size_t & getWriteStride ()
 Get a reference to the stride of the matrix. More...
 
void resize (const size_t &m, const size_t &n, const Element &val=Element())
 Resize the matrix to the given dimensions. More...
 
pointer getPointer () const
  .
 
pointergetWritePointer ()
  .
 
void setEntry (size_t i, size_t j, const Element &a_ij)
 Set the entry at the (i, j) position to a_ij. More...
 
ElementrefEntry (size_t i, size_t j)
 Get a writeable reference to the entry in the (i, j) position. More...
 
const ElementgetEntry (size_t i, size_t j) const
 Get a read-only reference to the entry in the (i, j) position. More...
 
ElementgetEntry (Element &x, size_t i, size_t j) const
 Copy the (i, j) entry into x, and return a reference to x. More...
 
Self_t transpose (Self_t &tM) const
 Creates a transposed matrix of *this. More...
 
void transpose ()
 Transpose (inplace). More...
 
void reverseRows ()
 Reverse the rows of a matrix. More...
 
void reverseCols ()
 Reverse the columns of a matrix. More...
 
void reverse ()
 Reverse the rows/columns of a matrix. More...
 
std::istream & read (std::istream &file)
 Read the matrix from an input stream. More...
 
std::ostream & write (std::ostream &os) const
 Write the matrix in MatrixMarket format.
 
std::ostream & write (std::ostream &os, LINBOX_enum(Tag::FileFormat) f) const
 Write the matrix to an output stream. More...
 
std::ostream & write (std::ostream &os, bool mapleFormat) const
 
VectorcolumnDensity (Vector &v) const
 Compute column density. More...
 
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.

IndexedIterator IndexedBegin ()
 
ConstIndexedIterator IndexedBegin () const
 
IndexedIterator IndexedEnd ()
 
ConstIndexedIterator IndexedEnd () const
 
Row operator[] (size_t i)
 Retrieve a reference to a row. More...
 

Data Fields

pointer _ptr
 
MatrixDomain< _Field_MD
 
VectorDomain< _Field_VD
 

Protected Member Functions

 LINBOX_enum (Tag::Shape) _uplo
 upper or lower triangular
 
 LINBOX_enum (Tag::Diag) _diag
 unit or non unit diagonal
 

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

typedef Subvector< typename
_Storage::iterator, typename
_Storage::const_iterator > 
Row
 
typedef Subvector< typename
_Storage::const_iterator > 
ConstRow
 
RowIterator rowBegin ()
 
ConstRowIterator rowBegin () const
 
RowIterator rowEnd ()
 
ConstRowIterator rowEnd () const
 

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 Subvector< Subiterator
< typename _Storage::iterator > > 
Col
 
typedef Subvector< Subiterator
< typename
_Storage::const_iterator > > 
ConstCol
 
typedef Col Column
 
typedef ConstCol ConstColumn
 
ColIterator colBegin ()
 
ConstColIterator colBegin () const
 
ColIterator colEnd ()
 
ConstColIterator colEnd () const
 

Iterator

The 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.

typedef _Storage::iterator Iterator
 
typedef _Storage::const_iterator ConstIterator
 
Iterator Begin ()
 
ConstIterator Begin () const
 
Iterator End ()
 
ConstIterator End () const
 

Detailed Description

template<class _Field, class _Storage = typename Vector<_Field>::Dense>
class LinBox::TriangularBlasMatrix< _Field, _Storage >

Triangular BLAS matrix.

Constructor & Destructor Documentation

TriangularBlasMatrix ( const Field &  F,
const size_t  m,
const size_t  n,
LINBOX_enum(Tag::Shape)  x = Tag::Shape::Upper,
LINBOX_enum(Tag::Diag)  y = Tag::Diag::NonUnit 
)

Constructor for a new TriangularBlasMatrix.

Parameters
F
mrows
ncols
y(non)unit diagonal
x(upp/low)er matrix
TriangularBlasMatrix ( const BlasMatrix< Field, Rep > &  A,
LINBOX_enum(Tag::Shape)  x = Tag::Shape::Upper,
LINBOX_enum(Tag::Diag)  y = Tag::Diag::NonUnit 
)

Constructor from a BlasMatrix (copy).

Parameters
Amatrix
y(non)unit diagonal
x(upp/low)er matrix
TriangularBlasMatrix ( BlasMatrix< Field, Rep > &  A,
LINBOX_enum(Tag::Shape)  x = Tag::Shape::Upper,
LINBOX_enum(Tag::Diag)  y = Tag::Diag::NonUnit 
)

Constructor from a BlasMatrix (no copy).

Parameters
Amatrix
y(non)unit diagonal
x(upp/low)er matrix
TriangularBlasMatrix ( const TriangularBlasMatrix< Field, Rep > &  A)

Constructor from a TriangularBlasMatrix (copy).

Parameters
Amatrix
TriangularBlasMatrix ( const Matrix &  A,
LINBOX_enum(Tag::Shape)  x = Tag::Shape::Upper,
LINBOX_enum(Tag::Diag)  y = Tag::Diag::NonUnit 
)

Generic constructor from a Matrix (no copy).

Parameters
Amatrix
y(non)unit diagonal
x(upp/low)er matrix

Member Function Documentation

void init ( const _Field F,
const size_t &  r = 0,
const size_t &  c = 0 
)
inherited

Allocates a new bare $ 0 \times 0$ matrix (unshaped, unready).

(Re)allocates a new $ m \times n$ zero matrix (shaped and ready).

BlasMatrix& copy ( const Matrix B)
inlineinherited

Make this a (deep)copy of B.

Assumes same shape. make sure we actually copy

size_t rowdim ( ) const
inherited

Get the number of rows in the matrix.

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

Get the number of columns in the matrix.

Returns
Number of columns in matrix
size_t& getWriteStride ( )
inherited

Get a reference to the stride of the matrix.

Modify stride this way.

void resize ( const size_t &  m,
const size_t &  n,
const Element val = Element() 
)
inherited

Resize the matrix to the given dimensions.

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

Parameters
mNumber of rows
nNumber of columns
val
void setEntry ( size_t  i,
size_t  j,
const Element a_ij 
)
inherited

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

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

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

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

Get a read-only reference to the entry in the (i, j) position.

Parameters
iRow index
jColumn index
Returns
Const reference to matrix entry
Element& getEntry ( Element x,
size_t  i,
size_t  j 
) const
inherited

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
xElement in which to store result
iRow index
jColumn index
Returns
Reference to x
Self_t transpose ( Self_t tM) const
inherited

Creates a transposed matrix of *this.

Parameters
[in]tM
Returns
the transposed matrix of this.
void transpose ( )
inherited

Transpose (inplace).

If rows and columns agree, we can transpose inplace.

void reverseRows ( )
inherited

Reverse the rows of a matrix.

This is done inplace. Let J=antiDiag(1) (or the matrix of the reverse permutation or the matrix (i,j) = (i+j+1==m)). Then, we compute A <- J.A;

void reverseCols ( )
inherited

Reverse the columns of a matrix.

This is done inplace. This is A <- J.A

void reverse ( )
inherited

Reverse the rows/columns of a matrix.

This is done inplace. This is A <- J.A.J

std::istream& read ( std::istream &  file)
inherited

Read the matrix from an input stream.

The stream is in SMS, DENSE, or MatrixMarket format and is autodetected.

Parameters
fileInput stream from which to read
std::ostream& write ( std::ostream &  os,
LINBOX_enum(Tag::FileFormat)  f 
) const
inlineinherited

Write the matrix to an output stream.

Parameters
osOutput stream to which to write
fwrite in some format (Tag::FileFormat::Format). Default is Maple's.
std::ostream& write ( std::ostream &  os,
bool  mapleFormat 
) const
inlineinherited
Deprecated:
Only for compatiblity.
Row operator[] ( size_t  i)
inherited

Retrieve a reference to a row.

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

Parameters
iRow index
Bug:
Rows and Cols should be BlasVectors
ConstRow operator[] ( size_t  i) const
inherited

Retrieve a reference to a row.

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

Parameters
iRow index
Bug:
Rows and Cols should be BlasVectors
Vector& columnDensity ( Vector v) const
inherited

Compute column density.

Parameters
v

Field Documentation

pointer _ptr
inherited
Bug:
why public ?
MatrixDomain<_Field > _MD
inherited
Bug:
why public ?
VectorDomain<_Field > _VD
inherited
Bug:
why public ?

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