#include <matrix-domain.h>
Inheritance diagram for MatrixDomain:
This class encapuslated matrix-matrix and matrix-vector operations, roughly equivalent to BLAS levels 2 and 3. The arithmetic methods are parameterized by matrix type so that they may be used the same way with sparse matrices, dense matrices, and dense submatrices. Except where otherwise noted, they require the matrix inputs to meet the DenseMatrix archetype.
These methods are specialized so that they can run efficiently with different matrix representations. If a matrix has an efficient row iterator, but not an efficient column iterator, a specialization that makes use of the former will be selected. This allows a great deal of flexibility when dealing with sparse matrix arithmetic.
For all of the arithmetic operations that output matrices, it is assumed that the output matrix has an efficient row iterator. In typical use, the output matrix will be a DenseMatrixBase or a DenseSubmatrix, which has efficient row and column iterators. In particular, one should not perform these arithmetic operations outputting to a SparseMatrixBase.
There are other restrictions. See the method-specific documentation for more details.
Public Types | |
typedef std::pair< unsigned int, unsigned int > | Transposition |
typedef std::vector< Transposition > | Permutation |
Public Methods | |
MatrixDomain (const Field &F) | |
const Field & | field () const |
template<class Matrix> std::ostream & | write (std::ostream &os, const Matrix &A) const |
template<class Matrix> std::istream & | read (std::istream &is, Matrix &A) const |
template<class Matrix1, class Matrix2> Matrix1 & | copy (Matrix1 &B, const Matrix2 &A) const |
template<class Matrix1, class Matrix2> bool | areEqual (const Matrix1 &A, const Matrix2 &B) const |
template<class Matrix> bool | isZero (const Matrix &A) const |
template<class Matrix1, class Matrix2, class Matrix3> Matrix1 & | add (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const |
template<class Matrix1, class Matrix2> Matrix1 & | addin (Matrix1 &A, const Matrix2 &B) const |
template<class Matrix1, class Matrix2, class Matrix3> Matrix1 & | sub (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const |
template<class Matrix1, class Matrix2> Matrix1 & | subin (Matrix1 &A, const Matrix2 &B) const |
template<class Matrix1, class Matrix2> Matrix1 & | neg (Matrix1 &B, const Matrix2 &A) const |
template<class Matrix> Matrix & | negin (Matrix &A) const |
template<class Matrix1, class Matrix2, class Matrix3> Matrix1 & | mul (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const |
template<class Matrix1, class Matrix2> Matrix2 & | leftMulin (const Matrix1 &A, Matrix2 &B) const |
template<class Matrix1, class Matrix2> Matrix1 & | rightMulin (Matrix1 &A, const Matrix2 &B) const |
template<class Matrix1, class Matrix2> Matrix1 & | mulin (Matrix1 &A, const Matrix2 &B) const |
template<class Matrix1, class Matrix2> Matrix1 & | mul (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const |
template<class Matrix> Matrix & | mulin (Matrix &B, const typename Field::Element &a) const |
template<class Matrix1, class Matrix2, class Matrix3> Matrix1 & | axpyin (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const |
template<class Matrix1, class Matrix2> Matrix1 & | pow_apply (Matrix1 &M1, const Matrix2 &M2, unsigned long int k) const |
template<class Matrix1, class Matrix2> Matrix1 & | pow_horn (Matrix1 &M1, const Matrix2 &M2, unsigned long int k) const |
template<class Vector1, class Matrix, class Vector2> Vector1 & | vectorMul (Vector1 &w, const Matrix &A, const Vector2 &v) const |
template<class Vector1, class Matrix, class Vector2> Vector1 & | vectorAxpyin (Vector1 &y, const Matrix &A, const Vector2 &x) const |
template<class Matrix1, class Blackbox, class Matrix2> Matrix1 & | blackboxMulLeft (Matrix1 &C, const Blackbox &A, const Matrix2 &B) const |
template<class Matrix1, class Matrix2, class Blackbox> Matrix1 & | blackboxMulRight (Matrix1 &C, const Matrix2 &A, const Blackbox &B) const |
template<class Matrix, class Iterator> Matrix & | permuteRows (Matrix &A, Iterator P_start, Iterator P_end) const |
template<class Matrix, class Iterator> Matrix & | permuteColumns (Matrix &A, Iterator P_start, Iterator P_end) const |
|
|
|
A permutation is represented as a vector of pairs, each pair representing a transposition. |
|
|
|
Matrix-matrix addition C <- A + B Each of A, B, and C must support the same iterator, either row or column
|
|
Matrix-matrix in-place addition A <- A + B Each of A and B must support the same iterator, either row or column
|
|
Matrix equality Test whether the matrices A and B are equal
|
|
Matrix-matrix in-place axpy Y <- Y + A*X This function combines mul and add, eliminating the need for an additional temporary in expressions of the form $Y = Y + AX$. Only one row of additional storage is required. Y may have either efficient row iterators or efficient column iterators, and the same restrictions on A and X apply as in mul. Note that no out-of-place axpy is provided, since it gives no benefit. One may just as easily multiply into the result and call addin.
|
|
Matrix-black box left-multiply C <- A * B Both C and B must support column iterators
|
|
Matrix-black box right-multiply C <- A * B Both C and A must support row iterators
|
|
Matrix copy B <- A Copy the contents of the matrix B to the matrix A Both matrices must support the same iterators, row or column.
|
|
Retrieve the underlying field Return a reference to the field that this matrix domain object uses
|
|
Matrix equality with zero
|
|
Matrix-matrix in-place multiply on the left B <- A * B B should support both row and column iterators, and must be dense. A must support row iterators.
|
|
Matrix-scalar multiply C <- B * a Multiply B by the scalar element a and store the result in C. B and C must support the same iterators.
|
|
Matrix-matrix multiply C <- A * B C must support both row and column iterators, and the vector representations must be dense. Examples of supported matrices are DenseMatrixBase and DenseSubmatrix. Either A or B, or both, may have limited iterators. However, either A must support row iterators or B must support column iterators. If both A and B lack support for an iterator (either row or column), then C must support the same type of iterator as A and B.
|
|
Matrix-scalar in-place multiply B <- B * a Multiply B by the scalar element a in-place.
|
|
Matrix-matrix in-place multiply A <- A * B This is an alias for rightMulin
|
|
Matrix negate B <- -A Each of A and B must support the same iterator, either row or column
|
|
Matrix in-place negate A <- -A
|
|
Permute the columns of the given matrix
|
|
Permute the rows of the given matrix
|
|
|
|
|
|
Read matrix
|
|
Matrix-matrix in-place multiply on the right A <- A * B A should support both row and column iterators, and must be dense. B must support column iterators.
|
|
Matrix-matrix subtraction C <- A - B Each of A, B, and C must support the same iterator, either row or column
|
|
Matrix-matrix in-place subtraction A <- A - B Each of A and B must support the same iterator, either row or column
|
|
Matrix-vector in-place axpy y <- y + A*x This function eliminates the requirement for temporary storage when one is computing an expression of the form given above. The vectors y and x must be of the same representation (dense, sparse sequence, sparse associative, or sparse parallel), but they may be of different types. The matrix A may have any representation. Note that out-of-place axpy is not provided since it provides no benefit -- one can use mul and then addin to exactly the same effect, with no additional storage or performance cost.
|
|
Matrix-vector multiply w <- A * v The vectors v and w must be of the same representation (dense, sparse sequence, sparse associative, or sparse parallel), but they may be of different types. The matrix A may have any representation.
|
|
Print matrix.
|