Skip to content

Commit

Permalink
Documented some gemm() functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mkatliar committed Mar 8, 2024
1 parent e087ed8 commit e281988
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/blast/math/algorithm/Gemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace blast
{

/**
* @brief Performs the matrix-matrix operation
* @brief Matrix-matrix multiplication with @a MatrixPointer arguments
*
* D := alpha*A*B + beta*C
*
Expand Down
18 changes: 14 additions & 4 deletions include/blast/math/dense/Gemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,13 @@
namespace blast
{
/**
* @brief Performs the matrix-matrix operation
* @brief Matrix-matrix multiplication for @a DenseMatrix arguments
*
* D := alpha*A*B + beta*C
*
* alpha and beta are scalars, and A, B and C are matrices, with A
* an m by k matrix, B a k by n matrix and C an m by n matrix.
*
* @param M the number of rows of the matrices A, C, and D.
* @param N the number of columns of the matrices B and C.
* @param K the number of columns of the matrix A and the number of rows of the matrix B.
* @param alpha the scalar alpha
* @param A the matrix A
* @param B the matrix B
Expand Down Expand Up @@ -59,6 +56,19 @@ namespace blast
}


/**
* @brief Matrix-matrix multiplication for @a DenseMatrix arguments
*
* D := A*B + C
*
* A, B and C are matrices, with A
* an m by k matrix, B a k by n matrix and C an m by n matrix.
*
* @param A the matrix A
* @param B the matrix B
* @param C the matrix C
* @param D the output matrix D
*/
template <
typename MT1, typename MT2, bool SO2,
typename MT3, typename MT4
Expand Down
50 changes: 46 additions & 4 deletions include/blast/math/register_matrix/Gemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@

namespace blast
{
/// @brief General matrix-matrix multiplication
/// @brief General matrix-matrix multiplication performed in-place
///
/// R += alpha * A * B
/// R += alpha * A * B,
/// where R is M by N, A is M by K, and B is K by N.
///
template <typename T, size_t M, size_t N, bool SO, typename PA, typename PB>
requires MatrixPointer<PA, T> && (PA::storageOrder == columnMajor)
Expand All @@ -33,9 +34,10 @@ namespace blast
}


/// @brief General matrix-matrix multiplication with limited size
/// @brief General matrix-matrix multiplication for a sub-matrix performed in-place
///
/// R(0:md-1, 0:nd-1) += alpha * A * B
/// R(0:md-1, 0:nd-1) += alpha * A * B,
/// where R is M by N, A is md by K, and B is K by nd.
///
template <typename T, size_t M, size_t N, bool SO, typename PA, typename PB>
requires MatrixPointer<PA, T> && (PA::storageOrder == columnMajor)
Expand All @@ -48,6 +50,16 @@ namespace blast
}


/// @brief General matrix-matrix multiplication
///
/// D = alpha * A * B + beta * C,
/// where D and C are M by N, A is M by K, and B is K by N.
///
/// The @a RegisterMatrix @a ker is used for intermediate calculations and has undefined value on return.
///
/// TODO: the @a ker argument could be removed and M, N passed as the function template parameters.
/// T and SO could be inferred from the argument types.
///
template <
typename T, size_t M, size_t N, bool SO,
typename PA, typename PB, typename PC, typename PD
Expand All @@ -69,6 +81,16 @@ namespace blast
}


/// @brief General matrix-matrix multiplication for a sub-matrix
///
/// D = alpha * A * B + beta * C,
/// where D and C are M by N, A is M by K, and B is K by N.
///
/// The @a RegisterMatrix @a ker is used for intermediate calculations and has undefined value on return.
///
/// TODO: the @a ker argument could be removed and M, N passed as the function template parameters.
/// T and SO could be inferred from the argument types.
///
template <
typename T, size_t M, size_t N, bool SO,
typename PA, typename PB, typename PC, typename PD
Expand All @@ -91,6 +113,16 @@ namespace blast
}


/// @brief Matrix-matrix multiplication
///
/// D = alpha * A * B + beta * C,
/// where D and C are M by N, A is M by K, and B is K by N.
///
/// The @a RegisterMatrix @a ker is used for intermediate calculations and has undefined value on return.
///
/// TODO: the @a ker argument could be removed and M, N passed as the function template parameters.
/// T and SO could be inferred from the argument types.
///
template <
typename T, size_t M, size_t N, bool SO,
typename PA, typename PB, typename PC, typename PD
Expand All @@ -110,6 +142,16 @@ namespace blast
}


/// @brief Matrix-matrix multiplication for a sub-matrix
///
/// D = alpha * A * B + beta * C,
/// where D and C are md by nd, A is md by K, and B is K by nd.
///
/// The @a RegisterMatrix @a ker is used for intermediate calculations and has undefined value on return.
///
/// TODO: the @a ker argument could be removed and M, N passed as the function template parameters.
/// T and SO could be inferred from the argument types.
///
template <
typename T, size_t M, size_t N, bool SO,
typename PA, typename PB, typename PC, typename PD
Expand Down

0 comments on commit e281988

Please sign in to comment.