linbox
Public Member Functions
MatrixBlackbox< _Field, _Matrix, _Vector > Class Template Reference

Matrix black box. More...

#include <matrix-blackbox.h>

+ Inheritance diagram for MatrixBlackbox< _Field, _Matrix, _Vector >:
+ Collaboration diagram for MatrixBlackbox< _Field, _Matrix, _Vector >:

Public Member Functions

 MatrixBlackbox (const Field &F, Matrix &Rep)
 Constructor. More...
 
 MatrixBlackbox (const Field &F, size_t m, size_t n)
 Constructor with size. More...
 
template<class Row >
 MatrixBlackbox (const Field &F, VectorStream< Row > &stream)
 Constructor. More...
 
 MatrixBlackbox (const MatrixBlackbox &B)
 Copy constructor.
 
 ~MatrixBlackbox ()
 Destructor. More...
 
BlackboxArchetypeclone () const
 Create a clone of the matrix.
 
template<class Vector1 , class Vector2 >
Vector1 & apply (Vector1 &y, const Vector2 &x) const
 Generic matrix-vector product $ y = A x$. More...
 
Vector & apply (Vector &y, const Vector &x) const
 Matrix-vector product $y = A x$. More...
 
template<class Vector1 , class Vector2 >
Vector1 & applyTranspose (Vector1 &y, const Vector2 &x) const
 Generic transpose matrix-vector product $y = A^T x$. More...
 
Vector & applyTranspose (Vector &y, const Vector &x) const
 Transpose matrix-vector product $y = A^T x$. More...
 
size_t rowdim () const
 Retreive row dimensions of Sparsemat matrix. More...
 
size_t coldim () const
 Retreive column dimensions of Sparsemat matrix. More...
 
std::istream & read (std::istream &is)
 Read the matrix from a stream. More...
 
std::ostream & write (std::ostream &os) const
 Write the matrix to a stream. More...
 
const Field & field () const
 Return a reference to the base field.
 
Matrix & rep ()
 Return a reference to the underlying representation.
 
template<class InVector , class OutVector >
OutVector & apply (OutVector &y, const InVector &x) const
 y := Ax, matrix-vector product. More...
 
template<class InVector , class OutVector >
OutVector & apply (OutVector &y, const InVector &x, void *handle) const
 y := Ax, matrix-vector product using a handle for ... More...
 
template<class InVector , class OutVector >
OutVector & applyTranspose (OutVector &y, const InVector &x) const
 y := xA, vector-matrix product. More...
 
template<class InVector , class OutVector >
OutVector & applyTranspose (OutVector &y, const InVector &x, void *handle) const
 y := xA, vector-matrix product using a handle for ... More...
 

Detailed Description

template<class _Field, class _Matrix, class _Vector = typename LinBox::Vector<_Field>::Dense>
class LinBox::MatrixBlackbox< _Field, _Matrix, _Vector >

Matrix black box.

This class wraps a matrix meeting the MatrixArchetype interface into a black box meeting the BlackboxArchetype interface. It uses MatrixDomain to implement apply and applyTranspose.

Constructor & Destructor Documentation

◆ MatrixBlackbox() [1/3]

MatrixBlackbox ( const Field &  F,
Matrix &  Rep 
)
inline

Constructor.

Builds a black box for the matrix given by rep over the field F

Parameters
FField over which entries exist
repMatrix from which to construct the black box

◆ MatrixBlackbox() [2/3]

MatrixBlackbox ( const Field &  F,
size_t  m,
size_t  n 
)
inline

Constructor with size.

Builds a black box with the given dimensions

Parameters
FField over which entries exist
mRow dimension
nColumn dimension

◆ MatrixBlackbox() [3/3]

MatrixBlackbox ( const Field &  F,
VectorStream< Row > &  stream 
)
inline

Constructor.

Builds a black box, using the vector stream stream to fill in its entries

Parameters
FField over which entries exist
streamStream with which to generate row vectors

◆ ~MatrixBlackbox()

~MatrixBlackbox ( )
inline

Destructor.

Member Function Documentation

◆ apply() [1/4]

Vector1& apply ( Vector1 &  y,
const Vector2 &  x 
) const
inline

Generic matrix-vector product $ y = A x$.

Returns
reference to output vector y
Parameters
xinput vector
y

◆ apply() [2/4]

Vector& apply ( Vector &  y,
const Vector &  x 
) const
inline

Matrix-vector product $y = A x$.

Returns
reference to output vector y
Parameters
xinput vector
y

◆ applyTranspose() [1/4]

Vector1& applyTranspose ( Vector1 &  y,
const Vector2 &  x 
) const
inline

Generic transpose matrix-vector product $y = A^T x$.

Returns
reference to output vector y
Parameters
xinput vector
y

◆ applyTranspose() [2/4]

Vector& applyTranspose ( Vector &  y,
const Vector &  x 
) const
inline

Transpose matrix-vector product $y = A^T x$.

Returns
reference to output vector y
Parameters
xinput vector
y

◆ rowdim()

size_t rowdim ( ) const
inline

Retreive row dimensions of Sparsemat matrix.

Returns
integer number of rows of SparseMatrix0Base matrix.

◆ coldim()

size_t coldim ( ) const
inline

Retreive column dimensions of Sparsemat matrix.

Returns
integer number of columns of SparseMatrix0Base matrix.

◆ read()

std::istream& read ( std::istream &  is)
inline

Read the matrix from a stream.

Parameters
isInput stream from which to read the matrix
Returns
Reference to input stream

◆ write()

std::ostream& write ( std::ostream &  os) const
inline

Write the matrix to a stream.

Parameters
osOutput stream to which to write the matrix
Returns
Reference to output stream

◆ apply() [3/4]

OutVector& apply ( OutVector &  y,
const InVector &  x 
) const
inherited

y := Ax, matrix-vector product.

The vector x must be of size A.coldim(), where A is this blackbox. On entry to apply, the vector y must be of size A.rowdim(). Neither vector has it's size or capacity modified by apply. Apply is not responsible for the validity of the sizes, which may or may not be checked. The two vectors may not overlap in memory.

Parameters
yit's entries are overwritten and a reference to it is also returned to allow for use in nested expressions.
xit's entries are the input data.

◆ apply() [4/4]

OutVector& apply ( OutVector &  y,
const InVector &  x,
void *  handle 
) const
inherited

y := Ax, matrix-vector product using a handle for ...

The handle serves as "protection from the future". The idea is that the handle could allow the blackbox to operate more as a pure container, with the field (or other functionality such as dot product) provided through the handle.

However, there are no known current uses (2003 june).

◆ applyTranspose() [3/4]

OutVector& applyTranspose ( OutVector &  y,
const InVector &  x 
) const
inherited

y := xA, vector-matrix product.

(Or from a column vector viewpoint: y := AT x, matrix transpose times vector product. )

    The vector x must be of size A.rowdim(), where A is this blackbox.
    On entry to apply, the vector y must be of size A.coldim().
    Neither vector has it's size or capacity modified by applyTranspose.  ApplyTranspose is not
    responsible for the validity of the sizes, which may or may not be checked.
    The two vectors may not overlap in memory.
    @param y it's entries are overwritten and a reference to it is also returned to allow for
    use in nested expressions.
    @param x it's entries are the input data.

◆ applyTranspose() [4/4]

OutVector& applyTranspose ( OutVector &  y,
const InVector &  x,
void *  handle 
) const
inherited

y := xA, vector-matrix product using a handle for ...

The handle serves as "protection from the future". The idea is that the handle could allow the blackbox to operate more as a pure container, with the field (or other functionality such as dot product) provided through the handle.

However, there are no known current uses (2003 june).


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