linbox
|
Dense matrix representation for BLAS based elimination. More...
#include <blas-blackbox.h>
Public Types | |
typedef Field::Element | Element |
Element type. | |
typedef BlasBlackbox< _Field > | Self_t |
Self type. | |
typedef RawVector< Element >::Dense | Rep |
Actually a std::vector<Element> (or alike.) | |
typedef Rep::pointer | pointer |
pointer type to elements | |
typedef const pointer | const_pointer |
const pointer type | |
Public Member Functions | |
template<class StreamVector > | |
BlasBlackbox (const Field &F, VectorStream< StreamVector > &stream) | |
Constructor using a finite vector stream (stream of the rows). | |
size_t | rowdim () const |
Get the number of rows in the matrix. | |
size_t | coldim () const |
Get the number of columns in the matrix. | |
std::istream & | read (std::istream &file) |
Read the blackbox from an input stream. | |
std::ostream & | write (std::ostream &os) const |
Write the blackbox to an output stream. | |
size_t | getStride () const |
Get the stride of the matrix. | |
size_t & | getWriteStride () |
Get a reference to the stride of the matrix. | |
void | resize (size_t m, size_t n, const Element &val=Element()) |
Resize the matrix to the given dimensions. | |
pointer | getPointer () const |
. | |
pointer & | getWritePointer () |
. | |
void | setEntry (size_t i, size_t j, const Element &a_ij) |
Set the entry at the (i, j) position to a_ij. | |
Element & | refEntry (size_t i, size_t j) |
Get a writeable reference to the entry in the (i, j) position. | |
const Element & | getEntry (size_t i, size_t j) const |
Get a read-only reference to the entry in the (i, j) position. | |
Element & | getEntry (Element &x, size_t i, size_t j) const |
Copy the (i, j) entry into x, and return a reference to x. | |
BlasMatrix< Element > | transpose (BlasMatrix< Element > &tM) const |
Creates a transposed matrix of *this . | |
void | transpose () |
Transpose (inplace). | |
void | reverseRows () |
Reverse the rows of a matrix. | |
void | reverseCols () |
Reverse the columns of a matrix. | |
void | reverse () |
Reverse the rows/columns of a matrix. | |
std::istream & | read (std::istream &file, const Field &F) |
Read the matrix from an input stream. | |
std::ostream & | write (std::ostream &os, const Field &F, bool mapleFormat=true) const |
Write the matrix to an output stream. | |
std::ostream & | write (std::ostream &os, bool mapleFormat=true) const |
Write brutally the matrix to an output stream. | |
Vector & | columnDensity (Vector &v) const |
Compute column density. | |
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 | |
IndexedIterator | IndexedBegin () |
ConstIndexedIterator | IndexedBegin () const |
IndexedIterator | IndexedEnd () |
ConstIndexedIterator | IndexedEnd () const |
Row | operator[] (size_t i) |
Retrieve a reference to a row. | |
ConstRow | operator[] (size_t i) const |
Retrieve a reference to a row. | |
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 Rep::iterator, typename Rep::const_iterator > | Row |
typedef Subvector< typename Rep::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 Rep::iterator > > | Col |
typedef Subvector< Subiterator < typename Rep::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 Rep::iterator | Iterator |
typedef Rep::const_iterator | ConstIterator |
Iterator | Begin () |
ConstIterator | Begin () const |
Iterator | End () |
ConstIterator | End () const |
Dense matrix representation for BLAS based elimination.
A BlasBlackbox can be constructed from any blackbox matrix. This costs n blackbox matrix vector products in general, but is efficiently done from a DenseMatrix or SparseMatrix.
BlasBlackbox | ( | const Field & | F, |
VectorStream< StreamVector > & | stream | ||
) | [inline] |
Constructor using a finite vector stream (stream of the rows).
F | The field of entries; passed so that arithmetic may be done on elements. |
stream | A vector stream to use as a source of vectors for this matrix |
size_t rowdim | ( | ) | const [inline] |
Get the number of rows in the matrix.
Reimplemented from BlasMatrix< _Field::Element >.
size_t coldim | ( | ) | const [inline] |
Get the number of columns in the matrix.
Reimplemented from BlasMatrix< _Field::Element >.
std::istream& read | ( | std::istream & | file | ) | [inline] |
Read the blackbox from an input stream.
file | Input stream from which to read |
std::ostream& write | ( | std::ostream & | os | ) | const [inline] |
Write the blackbox to an output stream.
os | Output stream to which to write |
size_t& getWriteStride | ( | ) | [inherited] |
Get a reference to the stride of the matrix.
Modify stride this way.
Resize the matrix to the given dimensions.
The state of the matrix's entries after a call to this method is undefined
m | Number of rows |
n | Number of columns |
val |
Set the entry at the (i, j) position to a_ij.
i | Row number, 0...rowdim () - 1 |
j | Column number 0...coldim () - 1 |
a_ij | Element to set |
Get a writeable reference to the entry in the (i, j) position.
i | Row index of entry |
j | Column index of entry |
Get a read-only reference to the entry in the (i, j) position.
i | Row index |
j | Column index |
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
x | Element in which to store result |
i | Row index |
j | Column index |
BlasMatrix<Element> transpose | ( | BlasMatrix< Element > & | tM | ) | const [inherited] |
Creates a transposed matrix of *this
.
[in] | tM |
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
Read the matrix from an input stream.
The stream is in SMS or DENSE format
file | Input stream from which to read |
F | Field over which to read |
std::ostream& write | ( | std::ostream & | os, |
const Field & | F, | ||
bool | mapleFormat = true |
||
) | const [inherited] |
Write the matrix to an output stream.
os | Output stream to which to write |
F | Field over which to write |
mapleFormat | write in Maple format ? |
std::ostream& write | ( | std::ostream & | os, |
bool | mapleFormat = true |
||
) | const [inherited] |
Write brutally the matrix to an output stream.
This a raw version of write(os,F)
(no field is given).
os | Output stream to which to write |
mapleFormat | write in maple format ? |
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.
i | Row index |
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.
i | Row index |
Vector& columnDensity | ( | Vector & | v | ) | const [inherited] |
Compute column density.
v |