linbox
Public Member Functions
MatrixBlackbox Class Reference

Matrix black box. More...

#include <matrix-blackbox.h>

+ Inheritance diagram for MatrixBlackbox:

Public Member Functions

 MatrixBlackbox (const Field &F, Matrix &Rep)
 Constructor.
 MatrixBlackbox (const Field &F, size_t m, size_t n)
 Constructor with size.
template<class Row >
 MatrixBlackbox (const Field &F, VectorStream< Row > &stream)
 Constructor.
 MatrixBlackbox (const MatrixBlackbox &B)
 Copy constructor.
 ~MatrixBlackbox ()
 Destructor.
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$.
Vector & apply (Vector &y, const Vector &x) const
 Matrix-vector product $y = A x$.
template<class Vector1 , class Vector2 >
Vector1 & applyTranspose (Vector1 &y, const Vector2 &x) const
 Generic transpose matrix-vector product $y = A^T x$.
Vector & applyTranspose (Vector &y, const Vector &x) const
 Transpose matrix-vector product $y = A^T x$.
size_t rowdim () const
 Retreive row dimensions of Sparsemat matrix.
size_t coldim () const
 Retreive column dimensions of Sparsemat matrix.
std::istreamread (std::istream &is)
 Read the matrix from a stream.
std::ostreamwrite (std::ostream &os) const
 Write the matrix to a stream.
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.
template<class InVector , class OutVector >
OutVector & apply (OutVector &y, const InVector &x, void *handle) const
 y := Ax, matrix-vector product using a handle for ...
template<class InVector , class OutVector >
OutVector & applyTranspose (OutVector &y, const InVector &x) const
 y := xA, vector-matrix product.
template<class InVector , class OutVector >
OutVector & applyTranspose (OutVector &y, const InVector &x, void *handle) const
 y := xA, vector-matrix product using a handle for ...

Detailed Description

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 ( 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 ( 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 ( 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 ( ) [inline]

Destructor.


Member Function Documentation

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
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
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
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
size_t rowdim ( ) const [inline]

Retreive row dimensions of Sparsemat matrix.

Returns:
integer number of rows of SparseMatrix0Base matrix.

Reimplemented from BlackboxArchetype.

size_t coldim ( ) const [inline]

Retreive column dimensions of Sparsemat matrix.

Returns:
integer number of columns of SparseMatrix0Base matrix.

Reimplemented from BlackboxArchetype.

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

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.

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