Site Tools


matmul

Table of Contents

Matmul

Matmul is an algorithm in high-performance computing (HPC). It is a BLAS level 2 (“Basic Linear Algebra Subprograms”) algorithm.

Definition

Matrices

Let and be square matrices over real numbers and let .

Matmul defined as a matrix multiplication that results in matrix .

Implementation

Matrix MatMul(const Matrix& a, const Matrix& b)
{
    const std::size_t i_max = a.rows();
    const std::size_t j_max = b.cols();
    const std::size_t k_max = a.cols();
    Matrix c(i_max, j_max);
    for (std::size_t i = 0; i < i_max; i++) {
        for (std::size_t j = 0; j < j_max; j++) {
            for (std::size_t k = 0; k < k_max; k++) {
                c(i, j) += a(i, k) * b(k, j);
            }
        }
    }
}
matmul.md · Last modified: