MTL 4: mtl::matrix Namespace Reference
Classes | |
struct | base_matrix |
Base class for other matrices, contains only very simple functionality that is used in all matrices. More... | |
class | compressed2D |
Compressed 2D matrix type. More... | |
struct | crtp_assign< mat_mat_plus_expr< E1, E2 >, Matrix > |
Assign sum by assigning first argument and adding second. More... | |
struct | crtp_assign< mat_mat_minus_expr< E1, E2 >, Matrix > |
Assign difference by assigning first argument and subtracting second. More... | |
struct | crtp_assign< mat_mat_times_expr< E1, E2 >, Matrix > |
Assign product by calling mult. More... | |
struct | crtp_assign< mat_mat_ele_times_expr< E1, E2 >, Matrix > |
Assign element-wise product. More... | |
struct | crtp_assign< Value[Rows][Cols], Matrix > |
Assign c-style 2D-array, because it's easier to initialize. More... | |
struct | crtp_assign< io::matrix_file< IFStream, OFStream >, Matrix > |
Assign content of a file to the matrix. More... | |
struct | crtp_plus_assign |
Assign-add matrix expressions by incrementally copying except for some special expressions. More... | |
struct | crtp_plus_assign< mat_mat_plus_expr< E1, E2 >, Matrix > |
Assign-add sum by adding both arguments. More... | |
struct | crtp_minus_assign |
Assign-subtract matrix expressions by decrementally copying except for some special expressions. More... | |
struct | crtp_minus_assign< mat_mat_plus_expr< E1, E2 >, Matrix > |
Assign-subtract sum by adding both arguments. More... | |
struct | crtp_minus_assign< mat_mat_minus_expr< E1, E2 >, Matrix > |
Assign-subtracting difference by subtracting first argument and adding the second one. More... | |
struct | crtp_minus_assign< mat_mat_times_expr< E1, E2 >, Matrix > |
Assign-subtract product by calling gen_mult. More... | |
struct | crtp_matrix_assign |
Base class to provide matrix assignment operators generically. More... | |
struct | mat_expr |
Base class for CRTP with matrices. More... | |
struct | dmat_expr |
Base class for CRTP with dense matrices. More... | |
struct | smat_expr |
Base class for CRTP with sparse matrices. More... | |
class | multi_vector |
Matrix constituting of set of column vectors (under development). More... | |
struct | parameters |
Type for bundling template parameters of common matrix types. More... | |
struct | recursator |
Functions | |
template<typename Matrix , typename Value > | |
void | diagonal_setup (Matrix &matrix, const Value &value) |
Setup a matrix to a multiple of the unity matrix. | |
template<typename Matrix , typename Value > | |
void | hessian_setup (Matrix &matrix, Value factor) |
Fills a matrix A with a_ij = factor * (i + j). | |
template<typename Matrix > | |
void | laplacian_setup (Matrix &matrix, unsigned m, unsigned n) |
Setup a matrix according to a Laplacian equation on a 2D-grid using a five-point-stencil. | |
template<typename Value , typename PermutationVector > | |
traits::permutation< Value >::type | permutation (const PermutationVector &v) |
Computes permutation matrix from corresponding vector. | |
template<typename Value , typename ReorderVector > | |
traits::reorder< Value >::type | reorder (const ReorderVector &v, std::size_t cols=0) |
Computes reordering matrix from corresponding vector. | |
template<typename LinOp > | |
traits::adjoint< LinOp >::type | adjoint (const LinOp &A) |
Adjoint linear operator, typically Hermitian transposed. | |
template<typename T > | |
mtl::traits::enable_if_matrix < T, T & >::type | crop (T &x) |
Remove all zero entries from a collection. | |
template<typename Matrix > | |
RealMagnitude< typename Collection< Matrix > ::value_type >::type | frobenius_norm (const Matrix &matrix) |
Frobenius norm, i.e. square root of sum of squares of all entries sqrt(sum_i sum_j(|a[i][j]|^2)). | |
template<unsigned long Unroll, typename Matrix > | |
mtl::traits::enable_if_matrix < Matrix, typename RealMagnitude< typename Collection< Matrix > ::value_type >::type >::type | infinity_norm (const Matrix &matrix) |
template<typename Factor , typename Matrix > | |
mtl::traits::enable_if_matrix < Matrix, Matrix & >::type | left_scale_inplace (const Factor &alpha, Matrix &A) |
Scale matrix c from left with scalar or matrix factor alpha ; c is altered. | |
template<typename Matrix > | |
void | lu (Matrix &LU) |
LU factorization in place (without pivoting and optimization so far). | |
template<typename Matrix , typename PermuationVector > | |
void | lu (Matrix &A, PermuationVector &P) |
LU factorization in place (with pivoting and without optimization so far). | |
template<typename Matrix > | |
Matrix | lu_f (const Matrix &A) |
LU factorization that returns the matrix. | |
template<typename A , typename B , typename C > | |
mtl::traits::enable_if_matrix < A >::type | mult (const A &a, const B &b, C &c) |
Multiplication: mult(a, b, c) computes c= a * b;. | |
template<typename A , typename B , typename C > | |
mtl::traits::enable_if_matrix < A >::type | mult_add (const A &a, const B &b, C &c) |
Multiplication: mult_add(a, b, c) computes c+= a * b;. | |
template<typename A , typename X , typename Y , typename Z > | |
void | mult (const A &a, const X &x, const Y &y, Z &z) |
Four term multiplication: mult(a, x, y, z) computes z= a * x + y;. | |
template<typename MatrixA , typename MatrixB , typename MatrixC , typename Assign > | |
void | mat_mat_mult (const MatrixA &a, const MatrixB &b, MatrixC &c, Assign, tag::dense, tag::dense, tag::dense) |
Dense matrix multiplication. | |
template<typename MatrixA , typename MatrixB , typename MatrixC , typename Assign > | |
void | mat_mat_mult (const MatrixA &a, const MatrixB &b, MatrixC &c, Assign, tag::sparse, tag::sparse, tag::sparse) |
Sparse matrix multiplication. | |
template<typename MatrixA , typename MatrixB , typename MatrixC , typename Assign > | |
void | mat_mat_mult (const MatrixA &a, const MatrixB &b, MatrixC &c, Assign, tag::sparse, tag::dense, tag::dense) |
Product of sparse times dense matrix. | |
template<unsigned long Unroll, typename Matrix > | |
mtl::traits::enable_if_matrix < Matrix, typename RealMagnitude< typename Collection< Matrix > ::value_type >::type >::type | one_norm (const Matrix &matrix) |
template<typename Op1 , typename Op2 > | |
mtl::traits::mult_result< Op1, Op2 >::type | operator* (const Op1 &op1, const Op2 &op2) |
Multiplication for all supported types of operations. | |
template<typename Op1 , typename Op2 > | |
mtl::traits::div_result< Op1, Op2 >::type | operator/ (const Op1 &op1, const Op2 &op2) |
Division of matrices and vectors by salars. | |
template<typename Matrix , typename VectorX , typename VectorY > | |
void | rank_one_update (Matrix &matrix, const VectorX &x, const VectorY &y) |
Rank-one update: rank_one_update(A, x, y) computes A+= x * conj(y)^T. | |
template<typename Matrix , typename VectorX , typename VectorY > | |
void | rank_two_update (Matrix &matrix, const VectorX &x, const VectorY &y) |
Rank-two update: rank_two_update(A, x, y) computes A+= x * conj(y)^T + y * conj(x)^T. | |
template<typename Matrix > | |
recursator< Matrix > | north_west (const recursator< Matrix > &rec) |
template<typename Matrix > | |
recursator< Matrix > | north_east (const recursator< Matrix > &rec) |
template<typename Matrix > | |
recursator< Matrix > | south_west (const recursator< Matrix > &rec) |
template<typename Matrix > | |
recursator< Matrix > | south_east (const recursator< Matrix > &rec) |
template<typename Matrix > | |
bool | is_empty (const recursator< Matrix > &rec) |
template<typename Matrix > | |
bool | is_full (const recursator< Matrix > &rec) |
template<typename Matrix > | |
recursator< Matrix >::size_type | num_rows (const recursator< Matrix > &rec) |
template<typename Matrix > | |
recursator< Matrix >::size_type | num_cols (const recursator< Matrix > &rec) |
template<typename Matrix > | |
recursator< Matrix >::size_type | size (const recursator< Matrix > &rec) |
mtl::traits::enable_if_matrix<T, T&>::type mtl::matrix::crop | ( | T & | x | ) | [inline] |
Remove all zero entries from a collection.
Does nothing for dense collections
void mtl::matrix::diagonal_setup | ( | Matrix & | matrix, | |
const Value & | value | |||
) | [inline] |
Setup a matrix to a multiple of the unity matrix.
Intended for sparse matrices but works also with dense matrices. If the value is 0 the matrix is only zeroed out, whereby a sparse matrix will be empty after this operation, i.e. the zeros on the diagonal are not explicitly stored. Another special treatment with the value 0 is that the matrix does not need to be square.
Conversely, in order to assign a value different from 0, the matrix must be square.
void mtl::matrix::hessian_setup | ( | Matrix & | matrix, | |
Value | factor | |||
) | [inline] |
mtl::traits::enable_if_matrix<Matrix, typename RealMagnitude<typename Collection<Matrix>::value_type>::type>::type mtl::matrix::infinity_norm | ( | const Matrix & | matrix | ) | [inline] |
bool mtl::matrix::is_empty | ( | const recursator< Matrix > & | rec | ) | [inline] |
Check if a recursator (i.e. its referred matrix) is empty.
bool mtl::matrix::is_full | ( | const recursator< Matrix > & | rec | ) | [inline] |
Check if a recursator (i.e. its referred matrix) fills the entire block, i.e. if the number of rows and columns are both equal to the virtual bound.
void mtl::matrix::laplacian_setup | ( | Matrix & | matrix, | |
unsigned | m, | |||
unsigned | n | |||
) | [inline] |
void mtl::matrix::mat_mat_mult | ( | const MatrixA & | a, | |
const MatrixB & | b, | |||
MatrixC & | c, | |||
Assign | , | |||
tag::sparse | , | |||
tag::dense | , | |||
tag::dense | ||||
) | [inline] |
Product of sparse times dense matrix.
This function (specialization of mult) is intended to multiply sparse matrices with multiple matrices gathered into a dense matrix. Likewise, the resulting dense matrix corresponds to multiple vectors. The default functor for this operation is:
void mtl::matrix::mat_mat_mult | ( | const MatrixA & | a, | |
const MatrixB & | b, | |||
MatrixC & | c, | |||
Assign | , | |||
tag::dense | , | |||
tag::dense | , | |||
tag::dense | ||||
) | [inline] |
Dense matrix multiplication.
The function for dense matrix multiplication defines a default multiplication functor. Alternatively the user can define his own functors for specific triplets of matrix types, see detail::dmat_dmat_mult_specialize. The default functor for dense matrix multiplication is:
Use user-defined functor if provided (assign mode can be arbitrary)
Finally substitute assign mode (consistently)
void mtl::matrix::mult | ( | const A & | a, | |
const X & | x, | |||
const Y & | y, | |||
Z & | z | |||
) | [inline] |
Four term multiplication: mult(a, x, y, z) computes z= a * x + y;.
The 4 types must be compatible, i.e. a*x must be assignable to z and z must be incrementable by y. Right now, it is not more efficient than z= a * x; z+= y. For compatibility with MTL2.
mtl::traits::enable_if_matrix<A>::type mtl::matrix::mult | ( | const A & | a, | |
const B & | b, | |||
C & | c | |||
) | [inline] |
Multiplication: mult(a, b, c) computes c= a * b;.
The 3 types must be compatible, e.g. all three matrices or b and c are column vectors and a is a matrix. The dimensions are checked at compile time.
mtl::traits::enable_if_matrix<A>::type mtl::matrix::mult_add | ( | const A & | a, | |
const B & | b, | |||
C & | c | |||
) | [inline] |
Multiplication: mult_add(a, b, c) computes c+= a * b;.
The 3 types must be compatible, e.g. all three matrices or b and c are column vectors and a is a matrix. The dimensions are checked at compile time.
recursator<Matrix> mtl::matrix::north_east | ( | const recursator< Matrix > & | rec | ) | [inline] |
Compute the north-east quadrant of a recursator (i.e. its referred matrix). The result is itself a recursator.
recursator<Matrix> mtl::matrix::north_west | ( | const recursator< Matrix > & | rec | ) | [inline] |
Compute the north-west quadrant of a recursator (i.e. its referred matrix). The result is itself a recursator.
recursator<Matrix>::size_type mtl::matrix::num_cols | ( | const recursator< Matrix > & | rec | ) | [inline] |
The number of columns that a sub-matrix would have if it was constructed.
recursator<Matrix>::size_type mtl::matrix::num_rows | ( | const recursator< Matrix > & | rec | ) | [inline] |
The number of rows that a sub-matrix would have if it was constructed.
mtl::traits::enable_if_matrix<Matrix, typename RealMagnitude<typename Collection<Matrix>::value_type>::type>::type mtl::matrix::one_norm | ( | const Matrix & | matrix | ) | [inline] |
mtl::traits::mult_result<Op1, Op2>::type mtl::matrix::operator* | ( | const Op1 & | op1, | |
const Op2 & | op2 | |||
) | [inline] |
Multiplication for all supported types of operations.
Enable-if-like technique make sure that only called when properly defined
mtl::traits::div_result<Op1,Op2>::type mtl::matrix::operator/ | ( | const Op1 & | op1, | |
const Op2 & | op2 | |||
) | [inline] |
Division of matrices and vectors by salars.
Enable-if-like technique make sure that only called when properly defined
void mtl::matrix::rank_one_update | ( | Matrix & | matrix, | |
const VectorX & | x, | |||
const VectorY & | y | |||
) | [inline] |
Rank-one update: rank_one_update(A, x, y) computes A+= x * conj(y)^T.
The current implementation works for column and row vectors (although the notation above refers to column vectors).
void mtl::matrix::rank_two_update | ( | Matrix & | matrix, | |
const VectorX & | x, | |||
const VectorY & | y | |||
) | [inline] |
Rank-two update: rank_two_update(A, x, y) computes A+= x * conj(y)^T + y * conj(x)^T.
The current implementation works for column and row vectors (although the notation above refers to column vectors).
recursator<Matrix>::size_type mtl::matrix::size | ( | const recursator< Matrix > & | rec | ) | [inline] |
The number of elements (rows times columns) that a sub-matrix would have if it was constructed.
recursator<Matrix> mtl::matrix::south_east | ( | const recursator< Matrix > & | rec | ) | [inline] |
Compute the south-east quadrant of a recursator (i.e. its referred matrix). The result is itself a recursator.
recursator<Matrix> mtl::matrix::south_west | ( | const recursator< Matrix > & | rec | ) | [inline] |
Compute the south-west quadrant of a recursator (i.e. its referred matrix). The result is itself a recursator.
mtl::matrix Namespace Reference -- MTL 4 -- Peter Gottschling and Andrew Lumsdaine
-- Generated on 24 Aug 2009 by Doxygen 1.5.9 -- Copyright 2008-09 by TU Dresden and the Trustees of Indiana University.