![]() |
Blaze 3.9
|
Modules | |
Dense Matrices | |
Sparse Matrices | |
Classes | |
class | blaze::Matrix< MT, SO > |
Base class for matrices. More... | |
Matrix global functions | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE MT::Iterator | blaze::begin (Matrix< MT, SO > &matrix, size_t i) |
Returns an iterator to the first element of row/column i. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE MT::ConstIterator | blaze::begin (const Matrix< MT, SO > &matrix, size_t i) |
Returns an iterator to the first element of row/column i. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE MT::ConstIterator | blaze::cbegin (const Matrix< MT, SO > &matrix, size_t i) |
Returns an iterator to the first element of row/column i. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE MT::Iterator | blaze::end (Matrix< MT, SO > &matrix, size_t i) |
Returns an iterator just past the last element of row/column i. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE MT::ConstIterator | blaze::end (const Matrix< MT, SO > &matrix, size_t i) |
Returns an iterator just past the last element of row/column i. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE MT::ConstIterator | blaze::cend (const Matrix< MT, SO > &matrix, size_t i) |
Returns an iterator just past the last element of row/column i. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE constexpr size_t | blaze::rows (const Matrix< MT, SO > &matrix) noexcept |
Returns the current number of rows of the matrix. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE constexpr size_t | blaze::columns (const Matrix< MT, SO > &matrix) noexcept |
Returns the current number of columns of the matrix. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE constexpr size_t | blaze::size (const Matrix< MT, SO > &matrix) noexcept |
Returns the total number of elements of the matrix. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE size_t | blaze::capacity (const Matrix< MT, SO > &matrix) noexcept |
Returns the maximum capacity of the matrix. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE size_t | blaze::capacity (const Matrix< MT, SO > &matrix, size_t i) noexcept |
Returns the current capacity of the specified row/column. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE size_t | blaze::nonZeros (const Matrix< MT, SO > &matrix) |
Returns the total number of non-zero elements in the matrix. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE size_t | blaze::nonZeros (const Matrix< MT, SO > &matrix, size_t i) |
Returns the number of non-zero elements in the specified row/column. More... | |
template<typename MT , bool SO> | |
constexpr void | blaze::reset (Matrix< MT, SO > &matrix) |
Resetting the given matrix. More... | |
template<typename MT , bool SO> | |
constexpr void | blaze::reset (Matrix< MT, SO > &&matrix) |
Resetting the given temporary matrix. More... | |
template<typename MT , bool SO> | |
constexpr void | blaze::reset (Matrix< MT, SO > &matrix, size_t i) |
Reset the specified row/column of the given matrix. More... | |
template<typename MT , bool SO> | |
constexpr void | blaze::reset (Matrix< MT, SO > &&matrix, size_t i) |
Reset the specified row/column of the given temporary matrix. More... | |
template<typename MT , bool SO> | |
constexpr void | blaze::clear (Matrix< MT, SO > &matrix) |
Clearing the given matrix. More... | |
template<typename MT , bool SO> | |
constexpr void | blaze::clear (Matrix< MT, SO > &&matrix) |
Clearing the given temporary matrix. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE void | blaze::resize (Matrix< MT, SO > &matrix, size_t m, size_t n, bool preserve) |
Changing the size of the matrix. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE void | blaze::shrinkToFit (Matrix< MT, SO > &matrix) |
Requesting the removal of unused capacity. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE void | blaze::transpose (Matrix< MT, SO > &matrix) |
In-place transpose of the given matrix. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE void | blaze::ctranspose (Matrix< MT, SO > &matrix) |
In-place conjugate transpose of the given matrix. More... | |
template<typename MT , bool SO> | |
MT::ResultType | blaze::evaluate (const Matrix< MT, SO > &matrix) |
Evaluates the given matrix expression. More... | |
template<bool B, typename MT , bool SO> | |
decltype(auto) | blaze::evaluateIf (const Matrix< MT, SO > &matrix) |
Conditional evaluation of the given matrix expression. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE constexpr bool | blaze::isEmpty (const Matrix< MT, SO > &matrix) noexcept |
Checks if the given matrix is empty. More... | |
template<typename MT , bool SO> | |
BLAZE_ALWAYS_INLINE bool | blaze::isSquare (const Matrix< MT, SO > &matrix) noexcept |
Checks if the given matrix is a square matrix. More... | |
template<typename MT1 , bool SO1, typename MT2 , bool SO2> | |
BLAZE_ALWAYS_INLINE bool | blaze::isSame (const Matrix< MT1, SO1 > &a, const Matrix< MT2, SO2 > &b) noexcept |
Returns whether the two given matrices represent the same observable state. More... | |
Matrix functions | |
template<typename MT , bool SO> | |
bool | blaze::isSymmetric (const Matrix< MT, SO > &m) |
Checks if the given matrix is symmetric. More... | |
template<typename MT , bool SO> | |
bool | blaze::isHermitian (const Matrix< MT, SO > &m) |
Checks if the given matrix is Hermitian. More... | |
template<typename MT , bool SO> | |
bool | blaze::isUniform (const Matrix< MT, SO > &m) |
Checks if the given matrix is a uniform matrix. More... | |
template<typename MT , bool SO> | |
bool | blaze::isLower (const Matrix< MT, SO > &m) |
Checks if the given matrix is a lower triangular matrix. More... | |
template<typename MT , bool SO> | |
bool | blaze::isUniLower (const Matrix< MT, SO > &m) |
Checks if the given matrix is a lower unitriangular matrix. More... | |
template<typename MT , bool SO> | |
bool | blaze::isStrictlyLower (const Matrix< MT, SO > &m) |
Checks if the given matrix is a strictly lower triangular matrix. More... | |
template<typename MT , bool SO> | |
bool | blaze::isUpper (const Matrix< MT, SO > &m) |
Checks if the given matrix is an upper triangular matrix. More... | |
template<typename MT , bool SO> | |
bool | blaze::isUniUpper (const Matrix< MT, SO > &m) |
Checks if the given matrix is an upper unitriangular matrix. More... | |
template<typename MT , bool SO> | |
bool | blaze::isStrictlyUpper (const Matrix< MT, SO > &m) |
Checks if the given matrix is a strictly upper triangular matrix. More... | |
template<typename MT , bool SO> | |
bool | blaze::isDiagonal (const Matrix< MT, SO > &m) |
Checks if the give matrix is diagonal. More... | |
template<typename MT , bool SO> | |
bool | blaze::isIdentity (const Matrix< MT, SO > &m) |
Checks if the give matrix is an identity matrix. More... | |
template<typename MT , bool SO> | |
decltype(auto) | blaze::pow2 (const Matrix< MT, SO > &m) |
Computes the square for each single element of the matrix m. More... | |
template<typename MT , bool SO> | |
decltype(auto) | blaze::pow3 (const Matrix< MT, SO > &m) |
Computes the cube for each single element of the matrix m. More... | |
template<typename MT , bool SO> | |
decltype(auto) | blaze::pow4 (const Matrix< MT, SO > &m) |
Computes the quadruple for each single element of the matrix m. More... | |
template<typename MT1 , bool SO1, typename MT2 , bool SO2> | |
decltype(auto) | blaze::schur (const Matrix< MT1, SO1 > &lhs, const Matrix< MT2, SO2 > &rhs) |
Schur product of two matrices ( ![]() | |
template<typename MT , bool SO> | |
auto | blaze::trace (const Matrix< MT, SO > &m) |
Computes the trace of the given square matrix. More... | |
template<bool RF, typename MT > | |
decltype(auto) | blaze::reverse (MT &&m) |
Reverse the rows or columns of a matrix. More... | |
Matrix operators | |
template<typename MT , bool SO> | |
std::ostream & | blaze::operator<< (std::ostream &os, const Matrix< MT, SO > &m) |
Global output operator for dense and sparse matrices. More... | |
Vector functions | |
template<typename VT , bool TF> | |
decltype(auto) | blaze::pow2 (const Vector< VT, TF > &v) |
Computes the square for each single element of the vector v. More... | |
template<typename VT , bool TF> | |
decltype(auto) | blaze::pow3 (const Vector< VT, TF > &v) |
Computes the cube for each single element of the vector v. More... | |
template<typename VT , bool TF> | |
decltype(auto) | blaze::pow4 (const Vector< VT, TF > &v) |
Computes the quadruple for each single element of the vector v. More... | |
BLAZE_ALWAYS_INLINE MT::ConstIterator blaze::begin | ( | const Matrix< MT, SO > & | matrix, |
size_t | i | ||
) |
Returns an iterator to the first element of row/column i.
matrix | The given dense or sparse matrix. |
i | The row/column index. |
This function returns a row/column iterator to the first element of row/column i. In case the given matrix is a row-major matrix the function returns an iterator to the first element of row i, in case it is a column-major matrix the function returns an iterator to the first element of column i.
BLAZE_ALWAYS_INLINE MT::Iterator blaze::begin | ( | Matrix< MT, SO > & | matrix, |
size_t | i | ||
) |
Returns an iterator to the first element of row/column i.
matrix | The given dense or sparse matrix. |
i | The row/column index. |
This function returns a row/column iterator to the first element of row/column i. In case the given matrix is a row-major matrix the function returns an iterator to the first element of row i, in case it is a column-major matrix the function returns an iterator to the first element of column i.
|
noexcept |
Returns the maximum capacity of the matrix.
matrix | The given matrix. |
|
noexcept |
Returns the current capacity of the specified row/column.
matrix | The given matrix. |
i | The index of the row/column. |
This function returns the current capacity of the specified row/column. In case the storage order is set to rowMajor the function returns the capacity of row i, in case the storage flag is set to columnMajor the function returns the capacity of column i.
BLAZE_ALWAYS_INLINE MT::ConstIterator blaze::cbegin | ( | const Matrix< MT, SO > & | matrix, |
size_t | i | ||
) |
Returns an iterator to the first element of row/column i.
matrix | The given dense or sparse matrix. |
i | The row/column index. |
This function returns a row/column iterator to the first element of row/column i. In case the given matrix is a row-major matrix the function returns an iterator to the first element of row i, in case it is a column-major matrix the function returns an iterator to the first element of column i.
BLAZE_ALWAYS_INLINE MT::ConstIterator blaze::cend | ( | const Matrix< MT, SO > & | matrix, |
size_t | i | ||
) |
Returns an iterator just past the last element of row/column i.
matrix | The given dense or sparse matrix. |
i | The row/column index. |
This function returns an row/column iterator just past the last element of row/column i. In case the given matrix is a row-major matrix the function returns an iterator just past the last element of row i, in case it is a column-major matrix the function returns an iterator just past the last element of column i.
|
constexpr |
Clearing the given temporary matrix.
matrix | The temporary matrix to be cleared. |
|
constexpr |
Clearing the given matrix.
matrix | The matrix to be cleared. |
|
constexprnoexcept |
Returns the current number of columns of the matrix.
matrix | The given matrix. |
BLAZE_ALWAYS_INLINE void blaze::ctranspose | ( | Matrix< MT, SO > & | matrix | ) |
In-place conjugate transpose of the given matrix.
matrix | The given matrix to be transposed. |
std::logic_error | Matrix cannot be transposed. |
This function transposes the given matrix in-place. The function fails if ...
In all failure cases a std::logic_error exception is thrown.
BLAZE_ALWAYS_INLINE MT::ConstIterator blaze::end | ( | const Matrix< MT, SO > & | matrix, |
size_t | i | ||
) |
Returns an iterator just past the last element of row/column i.
matrix | The given dense or sparse matrix. |
i | The row/column index. |
This function returns an row/column iterator just past the last element of row/column i. In case the given matrix is a row-major matrix the function returns an iterator just past the last element of row i, in case it is a column-major matrix the function returns an iterator just past the last element of column i.
BLAZE_ALWAYS_INLINE MT::Iterator blaze::end | ( | Matrix< MT, SO > & | matrix, |
size_t | i | ||
) |
Returns an iterator just past the last element of row/column i.
matrix | The given dense or sparse matrix. |
i | The row/column index. |
This function returns an row/column iterator just past the last element of row/column i. In case the given matrix is a row-major matrix the function returns an iterator just past the last element of row i, in case it is a column-major matrix the function returns an iterator just past the last element of column i.
|
inline |
Evaluates the given matrix expression.
matrix | The matrix to be evaluated. |
This function forces an evaluation of the given matrix expression and enables an automatic deduction of the correct result type of an operation. The following code example demonstrates its intended use for the multiplication of a lower and a strictly lower dense matrix:
In this scenario, the evaluate() function assists in deducing the exact result type of the operation via the 'auto' keyword. Please note that if evaluate() is used in this way, no temporary matrix is created and no copy operation is performed. Instead, the result is directly written to the target matrix due to the return value optimization (RVO). However, if evaluate() is used in combination with an explicit target type, a temporary will be created and a copy operation will be performed if the used type differs from the type returned from the function:
Sometimes it might be desirable to explicitly evaluate a sub-expression within a larger expression. However, please note that evaluate() is not intended to be used for this purpose. This task is more elegantly and efficiently handled by the eval() function:
In contrast to the evaluate() function, eval() can take the complete expression into account and therefore can guarantee the most efficient way to evaluate it.
|
inline |
Conditional evaluation of the given matrix expression.
matrix | The matrix to be evaluated. |
In case the given compile time condition evaluates to true, this function evaluates the the given matrix expression by means of the evaluate() function. Otherwise the function returns a reference to the given matrix expression.
|
inline |
Checks if the give matrix is diagonal.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is diagonal, i.e. if the non-diagonal elements are default elements. In case of integral or floating point data types, a diagonal matrix has the form
\f[\left(\begin{array}{*{5}{c}} aa & 0 & 0 & \cdots & 0 \\ 0 & bb & 0 & \cdots & 0 \\ 0 & 0 & cc & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & 0 \\ 0 & 0 & 0 & 0 & xx \\ \end{array}\right)\f]
or
matrices are considered as trivially diagonal. The following example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in a diagonal matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
|
constexprnoexcept |
Checks if the given matrix is empty.
matrix | The matrix to be checked. |
This function checks if the total number of elements of the given matrix is zero. If the total number of elements is zero the function returns true, otherwise it returns false.
|
inline |
Checks if the given matrix is Hermitian.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is an Hermitian matrix. The matrix is considered to be an Hermitian matrix if it is a square matrix whose conjugate transpose is equal to itself ( ), i.e. each matrix element
is equal to the complex conjugate of the element
. The following code example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in an Hermitian matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
|
inline |
Checks if the give matrix is an identity matrix.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is an identity matrix, i.e. if the diagonal elements are 1 and the non-diagonal elements are 0. In case of integral or floating point data types, an identity matrix has the form
\f[\left(\begin{array}{*{5}{c}} 1 & 0 & 0 & \cdots & 0 \\ 0 & 1 & 0 & \cdots & 0 \\ 0 & 0 & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & 0 \\ 0 & 0 & 0 & 0 & 1 \\ \end{array}\right)\f]
The following example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in an identity matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
|
inline |
Checks if the given matrix is a lower triangular matrix.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is a lower triangular matrix. The matrix is considered to be lower triangular if it is a square matrix of the form
\f[\left(\begin{array}{*{5}{c}} l_{0,0} & 0 & 0 & \cdots & 0 \\ l_{1,0} & l_{1,1} & 0 & \cdots & 0 \\ l_{2,0} & l_{2,1} & l_{2,2} & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ l_{N,0} & l_{N,1} & l_{N,2} & \cdots & l_{N,N} \\ \end{array}\right).\f]
or
matrices are considered as trivially lower triangular. The following code example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in a lower triangular matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
|
noexcept |
Returns whether the two given matrices represent the same observable state.
a | The first matrix to be tested for its state. |
b | The second matrix to be tested for its state. |
The isSame function provides an abstract interface for testing if the two given matrices represent the same observable state. This happens for instance in case a
and b
refer to the same matrix or in case a
and b
are aliases for the same matrix. In case both matrices represent the same observable state, the function returns true, other it returns false.
|
noexcept |
Checks if the given matrix is a square matrix.
matrix | The matrix to be checked. |
This function checks if the number of rows and columns of the given matrix are equal. If they are, the function returns true, otherwise it returns false.
|
inline |
Checks if the given matrix is a strictly lower triangular matrix.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is a strictly lower triangular matrix. The matrix is considered to be strictly lower triangular if it is a square matrix of the form
\f[\left(\begin{array}{*{5}{c}} 0 & 0 & 0 & \cdots & 0 \\ l_{1,0} & 0 & 0 & \cdots & 0 \\ l_{2,0} & l_{2,1} & 0 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ l_{N,0} & l_{N,1} & l_{N,2} & \cdots & 0 \\ \end{array}\right).\f]
The following code example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in a strictly lower triangular matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
|
inline |
Checks if the given matrix is a strictly upper triangular matrix.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is a strictly upper triangular matrix. The matrix is considered to be strictly upper triangular if it is a square matrix of the form
\f[\left(\begin{array}{*{5}{c}} 0 & u_{0,1} & u_{0,2} & \cdots & u_{0,N} \\ 0 & 0 & u_{1,2} & \cdots & u_{1,N} \\ 0 & 0 & 0 & \cdots & u_{2,N} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 0 \\ \end{array}\right).\f]
The following code example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in a strictly upper triangular matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
|
inline |
Checks if the given matrix is symmetric.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is symmetric. The matrix is considered to be symmetric if it is a square matrix whose transpose is equal to itself ( ). The following code example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in a symmetric matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
|
inline |
Checks if the given matrix is a uniform matrix.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is a uniform matrix. The matrix is considered to be uniform if all its elements are identical. The following code example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in a uniform matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
|
inline |
Checks if the given matrix is a lower unitriangular matrix.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is a lower unitriangular matrix. The matrix is considered to be lower unitriangular if it is a square matrix of the form
\f[\left(\begin{array}{*{5}{c}} 1 & 0 & 0 & \cdots & 0 \\ l_{1,0} & 1 & 0 & \cdots & 0 \\ l_{2,0} & l_{2,1} & 1 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ l_{N,0} & l_{N,1} & l_{N,2} & \cdots & 1 \\ \end{array}\right).\f]
The following code example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in a lower unitriangular matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
|
inline |
Checks if the given matrix is an upper unitriangular matrix.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is an upper unitriangular matrix. The matrix is considered to be upper unitriangular if it is a square matrix of the form
\f[\left(\begin{array}{*{5}{c}} 1 & u_{0,1} & u_{0,2} & \cdots & u_{0,N} \\ 0 & 1 & u_{1,2} & \cdots & u_{1,N} \\ 0 & 0 & 1 & \cdots & u_{2,N} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & 1 \\ \end{array}\right).\f]
The following code example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in an upper unitriangular matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
|
inline |
Checks if the given matrix is an upper triangular matrix.
m | The matrix to be checked. |
This function checks if the given dense or sparse matrix is an upper triangular matrix. The matrix is considered to be upper triangular if it is a square matrix of the form
\f[\left(\begin{array}{*{5}{c}} u_{0,0} & u_{0,1} & u_{0,2} & \cdots & u_{0,N} \\ 0 & u_{1,1} & u_{1,2} & \cdots & u_{1,N} \\ 0 & 0 & u_{2,2} & \cdots & u_{2,N} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & u_{N,N} \\ \end{array}\right).\f]
or
matrices are considered as trivially upper triangular. The following code example demonstrates the use of the function:
Optionally, it is possible to switch between strict semantics (blaze::strict) and relaxed semantics (blaze::relaxed):
It is also possible to check if a matrix expression results in an upper triangular matrix:
However, note that this might require the complete evaluation of the expression, including the generation of a temporary matrix.
BLAZE_ALWAYS_INLINE size_t blaze::nonZeros | ( | const Matrix< MT, SO > & | matrix | ) |
Returns the total number of non-zero elements in the matrix.
matrix | The given matrix. |
BLAZE_ALWAYS_INLINE size_t blaze::nonZeros | ( | const Matrix< MT, SO > & | matrix, |
size_t | i | ||
) |
Returns the number of non-zero elements in the specified row/column.
matrix | The given matrix. |
i | The index of the row/column. |
This function returns the current number of non-zero elements in the specified row/column. In case the storage order is set to rowMajor the function returns the number of non-zero elements in row i, in case the storage flag is set to columnMajor the function returns the number of non-zero elements in column i.
|
inline |
Global output operator for dense and sparse matrices.
os | Reference to the output stream. |
m | Reference to a constant matrix object. |
|
inline |
Computes the square for each single element of the matrix m.
m | The input matrix. |
The pow2() function computes the square for each element of the input matrix m. The function returns an expression representing this operation.
The following example demonstrates the use of the pow2() function:
|
inline |
Computes the square for each single element of the vector v.
v | The input vector. |
The pow2() function computes the square for each element of the input vector v. The function returns an expression representing this operation.
The following example demonstrates the use of the pow2() function:
|
inline |
Computes the cube for each single element of the matrix m.
m | The input matrix. |
The pow3() function computes the cube for each element of the input matrix m. The function returns an expression representing this operation.
The following example demonstrates the use of the pow3() function:
|
inline |
Computes the cube for each single element of the vector v.
v | The input vector. |
The pow3() function computes the cube for each element of the input vector v. The function returns an expression representing this operation.
The following example demonstrates the use of the pow3() function:
|
inline |
Computes the quadruple for each single element of the matrix m.
m | The input matrix. |
The pow4() function computes the quadruple for each element of the input matrix m. The function returns an expression representing this operation.
The following example demonstrates the use of the pow4() function:
|
inline |
Computes the quadruple for each single element of the vector v.
v | The input vector. |
The pow4() function computes the quadruple for each element of the input vector v. The function returns an expression representing this operation.
The following example demonstrates the use of the pow4() function:
|
constexpr |
Resetting the given temporary matrix.
matrix | The temporary matrix to be resetted. |
|
constexpr |
Reset the specified row/column of the given temporary matrix.
matrix | The temporary matrix to be resetted. |
i | The index of the row/column to be resetted. |
This function resets the values in the specified row/column of the given temporary matrix to their default value. In case the given matrix is a rowMajor matrix the function resets the values in row i, if it is a columnMajor matrix the function resets the values in column i. Note that the capacity of the row/column remains unchanged.
|
constexpr |
Resetting the given matrix.
matrix | The matrix to be resetted. |
|
constexpr |
Reset the specified row/column of the given matrix.
matrix | The matrix to be resetted. |
i | The index of the row/column to be resetted. |
This function resets the values in the specified row/column of the given matrix to their default value. In case the given matrix is a rowMajor matrix the function resets the values in row i, if it is a columnMajor matrix the function resets the values in column i. Note that the capacity of the row/column remains unchanged.
BLAZE_ALWAYS_INLINE void blaze::resize | ( | Matrix< MT, SO > & | matrix, |
size_t | m, | ||
size_t | n, | ||
bool | preserve | ||
) |
Changing the size of the matrix.
matrix | The given matrix to be resized. |
m | The new number of rows of the matrix. |
n | The new number of columns of the matrix. |
preserve | true if the old values of the matrix should be preserved, false if not. |
std::invalid_argument | Invalid resize arguments for square matrix. |
std::invalid_argument | Matrix cannot be resized. |
This function provides a unified interface to resize dense and sparse matrices. In contrast to the resize()
member function, which is only available on resizable matrix types, this function can be used on both resizable and non-resizable matrices. In case the given matrix of type MT is resizable (i.e. provides a resize
function) the type-specific resize()
member function is called. Depending on the type MT, this may result in the allocation of new dynamic memory and the invalidation of existing views (submatrices, rows, columns, ...). Note that in case the matrix is a compile time square matrix (as for instance the blaze::SymmetricMatrix adaptor, ...) the specified number of rows must be identical to the number of columns. Otherwise a std::invalid_argument exception is thrown. If the matrix type MT is non-resizable (i.e. does not provide a resize()
function) and if the specified number of rows and columns is not identical to the current number of rows and columns of the matrix, a std::invalid_argument exception is thrown.
|
inline |
Reverse the rows or columns of a matrix.
m | The matrix to be reversed. |
This function reverses the rows or matrices of a dense or sparse matrix. In case the compile time flag RF is set to blaze::rowwise, the rows of the matrix are reversed, in case RF is set to blaze::columnwise, the columns of the matrix are reversed. The following examples gives an impression of both alternatives:
|
constexprnoexcept |
Returns the current number of rows of the matrix.
matrix | The given matrix. |
|
inline |
Schur product of two matrices ( ).
lhs | The left-hand side matrix for the Schur product. |
rhs | The right-hand side matrix for the Schur product. |
This function represents the Schur product between two matrices:
The function returns an expression representing a matrix of the higher-order element type of the two involved element types VT1::ElementType and VT2::ElementType.
BLAZE_ALWAYS_INLINE void blaze::shrinkToFit | ( | Matrix< MT, SO > & | matrix | ) |
Requesting the removal of unused capacity.
matrix | The given matrix to be shrunk. |
This function tries to minimize the capacity of the matrix by removing unused capacity. Please note that in case of a shrinkable matrix, due to padding the capacity might not be reduced exactly to the number of rows times the number of columns. Please also note that in case a reallocation occurs, all iterators (including end() iterators), all pointers and references to elements of this matrix are invalidated. In case of an unshrinkable matrix the function has no effect.
|
constexprnoexcept |
Returns the total number of elements of the matrix.
matrix | The given matrix. |
|
inline |
Computes the trace of the given square matrix.
m | Reference to a constant matrix object. |
std::invalid_argument | Invalid input matrix for trace computation. |
This function computes the trace of the given square matrix, i.e. sums the elements on its diagonal:
\f[ trace(A) = a_{11} + a_{22} + ... + a_{nn} = \sum_{i=1}^{n} a_{ii} \f]
In case the given matrix is not a square matrix a std::invalid_argument exception is thrown.
BLAZE_ALWAYS_INLINE void blaze::transpose | ( | Matrix< MT, SO > & | matrix | ) |
In-place transpose of the given matrix.
matrix | The given matrix to be transposed. |
std::logic_error | Matrix cannot be transposed. |
This function transposes the given matrix in-place. The function fails if ...
In all failure cases a std::logic_error exception is thrown.