linbox
|
Dense matrix representation. More...
#include <blas-matrix.h>
Data Structures | |
class | IndexedIterator |
Indexed Iterator. More... | |
struct | rebind |
Rebind operator. More... | |
Public Types | |
typedef Field::Element | Element |
Element 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 | |
typedef BlasMatrix< _Field > | Self_t |
Self type. | |
Public Member Functions | |
BlasMatrix (const _Field &F) | |
Allocates a new ![]() | |
BlasMatrix () | |
Allocates a new ![]() | |
BlasMatrix (MatrixStream< _Field > &ms) | |
Constructor from a matrix stream. More... | |
template<class Matrix > | |
BlasMatrix (const Matrix &A) | |
Generic copy constructor from either a blackbox or a matrix container. More... | |
template<class Matrix > | |
BlasMatrix (const Matrix &A, const size_t i0, const size_t j0, const size_t m, const size_t n) | |
Generic copy constructor from either a blackbox or a matrix container (allow submatrix). More... | |
template<class _Matrix > | |
BlasMatrix (const _Matrix &A, const _Field &F) | |
Constructor. More... | |
BlasMatrix (const BlasMatrix< _Field > &A) | |
Copy Constructor of a matrix (copying data). More... | |
BlasMatrix (const _Field &F, const std::vector< Element > &v, size_t m, size_t n) | |
Create a BlasMatrix from a vector of elements. More... | |
BlasMatrix (const _Field &F, const Element *v, size_t m, size_t n) | |
Create a BlasMatrix from an array of elements. More... | |
template<class StreamVector > | |
BlasMatrix (const Field &F, VectorStream< StreamVector > &stream) | |
Constructor using a finite vector stream (stream of the rows). More... | |
~BlasMatrix () | |
Destructor. | |
BlasMatrix< _Field > & | operator= (const BlasMatrix< _Field > &A) |
operator = (copying data) | |
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 (size_t m, size_t n, const Element &val=Element()) |
Resize the matrix to the given dimensions. More... | |
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. More... | |
Element & | refEntry (size_t i, size_t j) |
Get a writeable reference to the entry in the (i, j) position. More... | |
const Element & | getEntry (size_t i, size_t j) const |
Get a read-only reference to the entry in the (i, j) position. More... | |
Element & | getEntry (Element &x, size_t i, size_t j) const |
Copy the (i, j) entry into x, and return a reference to x. More... | |
BlasMatrix< _Field > | transpose (BlasMatrix< _Field > &tM) const |
Creates a transposed matrix of *this . More... | |
template<bool _IP> | |
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, enum LinBoxTag::Format f=LinBoxTag::FormatMaple) const |
Write the matrix to an output stream. More... | |
std::ostream & | write (std::ostream &os, bool mapleFormat) const |
template<class Vector > | |
Vector & | columnDensity (Vector &v) const |
Compute column density. More... | |
template<class Vector1 , class Vector2 > | |
Vector1 & | apply (Vector1 &y, const Vector2 &x) const |
template<class T > | |
BlasMatrix (const _Field &F, const uint64_t &m, const T &n) | |
Allocates a new ![]() | |
template<class T > | |
BlasMatrix (const _Field &F, const int64_t &m, const T &n) | |
Allocates a new ![]() | |
template<class T > | |
BlasMatrix (const _Field &F, const uint32_t &m, const T &n) | |
Allocates a new ![]() | |
template<class T > | |
BlasMatrix (const _Field &F, const int32_t &m, const T &n) | |
Allocates a new ![]() | |
template<class T > | |
BlasMatrix (const _Field &F, const Integer &m, const T &n) | |
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 () |
IndexedIterator | IndexedEnd () |
ConstIndexedIterator | IndexedBegin () const |
ConstIndexedIterator | IndexedEnd () const |
Row | operator[] (size_t i) |
Retrieve a reference to a row. More... | |
ConstRow | operator[] (size_t i) const |
Retrieve a reference to a row. More... | |
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 () |
RowIterator | rowEnd () |
ConstRowIterator | rowBegin () const |
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 () |
ColIterator | colEnd () |
ConstColIterator | colBegin () const |
ConstColIterator | colEnd () const |
Dense matrix representation.
A BlasMatrix is a matrix of _Field::Element
, with the structure of BLAS matrices. It is basically a vector of _Field::Element
. In the Mother model, a BlasMatrix is allocated by the user.
BlasMatrix | ( | const _Field & | F, |
const uint64_t & | m, | ||
const T & | n | ||
) |
BlasMatrix | ( | const _Field & | F, |
const int64_t & | m, | ||
const T & | n | ||
) |
BlasMatrix | ( | const _Field & | F, |
const uint32_t & | m, | ||
const T & | n | ||
) |
BlasMatrix | ( | const _Field & | F, |
const int32_t & | m, | ||
const T & | n | ||
) |
BlasMatrix | ( | const _Field & | F, |
const Integer & | m, | ||
const T & | n | ||
) |
BlasMatrix | ( | MatrixStream< _Field > & | ms | ) |
Constructor from a matrix stream.
ms | matrix stream. |
BlasMatrix | ( | const Matrix & | A | ) |
Generic copy constructor from either a blackbox or a matrix container.
A | matrix to be copied |
BlasMatrix | ( | const Matrix & | A, |
const size_t | i0, | ||
const size_t | j0, | ||
const size_t | m, | ||
const size_t | n | ||
) |
Generic copy constructor from either a blackbox or a matrix container (allow submatrix).
A | matrix to be copied |
i0 | |
j0 | |
m | rows |
n | columns |
BlasMatrix | ( | const _Matrix & | A, |
const _Field & | F | ||
) |
Constructor.
A | matrix to be copied |
F | Field |
BlasMatrix | ( | const BlasMatrix< _Field > & | A | ) |
Copy Constructor of a matrix (copying data).
A | matrix to be copied. |
BlasMatrix | ( | const _Field & | F, |
const std::vector< Element > & | v, | ||
size_t | m, | ||
size_t | n | ||
) |
Create a BlasMatrix from a vector of elements.
F | |
v | |
m | |
n |
BlasMatrix | ( | const _Field & | F, |
const Element * | v, | ||
size_t | m, | ||
size_t | n | ||
) |
Create a BlasMatrix from an array of elements.
F | |
v | |
m | |
n |
BlasMatrix | ( | const Field & | F, |
VectorStream< StreamVector > & | stream | ||
) |
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 |
Get the number of rows in the matrix.
size_t coldim | ( | ) | const |
Get the number of columns in the matrix.
size_t & getWriteStride | ( | ) |
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 |
void setEntry | ( | size_t | i, |
size_t | j, | ||
const Element & | a_ij | ||
) |
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 |
_Field::Element & refEntry | ( | size_t | i, |
size_t | j | ||
) |
Get a writeable reference to the entry in the (i, j) position.
i | Row index of entry |
j | Column index of entry |
const _Field::Element & getEntry | ( | size_t | i, |
size_t | j | ||
) | const |
Get a read-only reference to the entry in the (i, j) position.
i | Row index |
j | Column index |
_Field::Element & getEntry | ( | Element & | x, |
size_t | i, | ||
size_t | j | ||
) | const |
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< _Field > transpose | ( | BlasMatrix< _Field > & | tM | ) | const |
Creates a transposed matrix of *this
.
[in] | tM |
void transpose | ( | ) |
Transpose (inplace).
If rows and columns agree, we can transpose inplace.
void reverseRows | ( | ) |
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 | ( | ) |
Reverse the columns of a matrix.
This is done inplace. This is A <- J.A
void reverse | ( | ) |
Reverse the rows/columns of a matrix.
This is done inplace. This is A <- J.A.J
std::istream & read | ( | std::istream & | file | ) |
Read the matrix from an input stream.
The stream is in SMS or DENSE format and is autodetected.
file | Input stream from which to read |
std::ostream & write | ( | std::ostream & | os, |
enum LinBoxTag::Format | f = LinBoxTag::FormatMaple |
||
) | const |
Write the matrix to an output stream.
os | Output stream to which to write |
f | write in some format (LinBoxTag::Format). Default is Maple's. |
|
inline |
BlasMatrix< _Field >::Row operator[] | ( | size_t | i | ) |
Retrieve a reference to a row.
Since rows may also be indexed, this allows A[i][j] notation to be used.
i | Row index |
BlasMatrix< _Field >::ConstRow operator[] | ( | size_t | i | ) | const |
Retrieve a reference to a row.
Since rows may also be indexed, this allows A[i][j] notation to be used.
i | Row index |
Vector1 & apply | ( | Vector1 & | y, |
const Vector2 & | x | ||
) | const |