BLAS and LAPACK#

template<typename T, int N, int K, int M>
inline void mult(const StaticMatrix<T, N, K> &A, const StaticMatrix<T, K, M> &B, StaticMatrix<T, N, M> &C, MultParam<T> param = MultParam<T>())#
template<typename T>
inline void mult(const Matrix<T> &A, const Matrix<T> &B, Matrix<T> &C, MultParam<T> param = MultParam<T>())#
template<typename T>
inline void mult(const TransposeOp<Matrix<T>> &A, const Matrix<T> &B, Matrix<T> &C, MultParam<T> param = MultParam<T>())#
template<typename T>
inline void mult(const Matrix<T> &A, const TransposeOp<Matrix<T>> &B, Matrix<T> &C, MultParam<T> param = MultParam<T>())#
template<typename T>
inline void mult(const TransposeOp<Matrix<T>> &A, const TransposeOp<Matrix<T>> &B, Matrix<T> &C, MultParam<T> param = MultParam<T>())#
template<typename T>
inline void mult(const Matrix<T> &A, const CSRMatrix<T> &B, Matrix<T> &C, MultParam<T> param = MultParam<T>())#
template<typename T>
inline void mult(const CSRMatrix<T> &A, const Matrix<T> &B, Matrix<T> &C, MultParam<T> param = MultParam<T>())#

Calculates the matrix-matrix multiplication: \( \mathbf{C} = \alpha \mathbf{A} \mathbf{B} + \beta \mathbf{C}\).

Complexity: If A, B and C are dense, \( O(n^3) \) where n is the matrix side. If A is sparse, \( O(n^2 m) \), where m is the number of nonzeros elements in A.

Parameters:
  • A[in] input matrix A (dense, transposed dense or sparse)

  • B[in] input matrix B (dense, transposed dense or sparse)

  • C[inout] output matrix C (dense)

  • alpha[in] scale parameter for the multiplication (optional, default: 1)

  • beta[in] scale parameter for the addition (optional, default: 0)

Throws:
  • std::length_error – if `A.cols() != B.rows()`.

  • std::length_error – if `A.rows() != C.rows()` or `B.cols() != C.cols()` when `beta != 0`

template<typename T, internal::TypeLayout L>
inline void mult(const Matrix<T> &A, const Vector<T, L> &x, Vector<T, L> &y, MultParam<T> param = MultParam<T>())#
template<typename T, internal::TypeLayout L>
inline void mult(const TransposeOp<Matrix<T>> &A, const Vector<T, L> &x, Vector<T, L> &y, MultParam<T> param = MultParam<T>())#
template<typename T, internal::TypeLayout L>
inline void mult(const CSRMatrix<T> &A, const Vector<T, L> &x, Vector<T, L> &y, MultParam<T> param = MultParam<T>())#

Calculates the vector-matrix multiplication: \( \vec{y} = \alpha \mathbf{A} \vec{x} + \beta \vec{y}\).

Supported operations:

  • \( \vec{dy} = \mathbf{dA} \times \vec{dx} \)

  • \( \vec{dy} = \mathbf{dA}^T \times \vec{dx} \)

  • \( \vec{dy} = \mathbf{sA} \times \vec{dx} \) where the d and s prefix indicate a dense and sparse matrix/vector, respectively.

Complexity: If A, x and y are dense, \( O(n^2) \) where n is the matrix side. If A is sparse, \( O(n m) \), where m is the number of nonzeros elements in A.

Parameters:
  • A[in] input matrix expression A

  • x[in] input vector expression x

  • y[inout] output vector y

  • alpha[in] scale parameter for the multiplication (optional, default: 1)

  • beta[in] scale parameter for the addition (optional, default: 0)

Throws:
  • std::length_error – if `A.cols() != x.size()`.

  • std::length_error – if `A.rows() != y.size()` when `beta != 0`.

template<typename T>
struct MultParam#
#include <blas.h>

Abstract object that hold the parameters for the matrix multiplication.

Public Members

T alpha = 1.0#

Scale parameter for the multiplication (optional, default: 1)

T beta = 0.0#

Scale parameter for the addition (optional, default: 0)