linbox
|
Matrix black box. More...
#include <matrix-blackbox.h>
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. | |
BlackboxArchetype * | clone () const |
Create a clone of the matrix. | |
template<class Vector1 , class Vector2 > | |
Vector1 & | apply (Vector1 &y, const Vector2 &x) const |
Generic matrix-vector product ![]() | |
Vector & | apply (Vector &y, const Vector &x) const |
Matrix-vector product ![]() | |
template<class Vector1 , class Vector2 > | |
Vector1 & | applyTranspose (Vector1 &y, const Vector2 &x) const |
Generic transpose matrix-vector product ![]() | |
Vector & | applyTranspose (Vector &y, const Vector &x) const |
Transpose matrix-vector product ![]() | |
size_t | rowdim () const |
Retreive row dimensions of Sparsemat matrix. | |
size_t | coldim () const |
Retreive column dimensions of Sparsemat matrix. | |
std::istream & | read (std::istream &is) |
Read the matrix from a stream. | |
std::ostream & | write (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 ... |
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
.
MatrixBlackbox | ( | const Field & | F, |
Matrix & | Rep | ||
) | [inline] |
Constructor.
Builds a black box for the matrix given by rep
over the field F
F | Field over which entries exist |
rep | Matrix 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
F | Field over which entries exist |
m | Row dimension |
n | Column dimension |
MatrixBlackbox | ( | const Field & | F, |
VectorStream< Row > & | stream | ||
) | [inline] |
Constructor.
Builds a black box, using the vector stream stream
to fill in its entries
F | Field over which entries exist |
stream | Stream with which to generate row vectors |
~MatrixBlackbox | ( | ) | [inline] |
Destructor.
Vector1& apply | ( | Vector1 & | y, |
const Vector2 & | x | ||
) | const [inline] |
Generic matrix-vector product .
x | input vector |
y |
Vector& apply | ( | Vector & | y, |
const Vector & | x | ||
) | const [inline] |
Matrix-vector product .
x | input vector |
y |
Vector1& applyTranspose | ( | Vector1 & | y, |
const Vector2 & | x | ||
) | const [inline] |
Generic transpose matrix-vector product .
x | input vector |
y |
Vector& applyTranspose | ( | Vector & | y, |
const Vector & | x | ||
) | const [inline] |
size_t rowdim | ( | ) | const [inline] |
Retreive row dimensions of Sparsemat matrix.
Reimplemented from BlackboxArchetype.
size_t coldim | ( | ) | const [inline] |
Retreive column dimensions of Sparsemat matrix.
Reimplemented from BlackboxArchetype.
std::istream& read | ( | std::istream & | is | ) | [inline] |
Read the matrix from a stream.
is | Input stream from which to read the matrix |
std::ostream& write | ( | std::ostream & | os | ) | const [inline] |
Write the matrix to a stream.
os | Output stream to which to write the matrix |
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.
y | it's entries are overwritten and a reference to it is also returned to allow for use in nested expressions. |
x | it'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.
y | it's entries are overwritten and a reference to it is also returned to allow for use in nested expressions. |
x | it'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).