Skip to content

BLAS 3::trsm

Vinh Dang edited this page Feb 18, 2020 · 20 revisions

KokkosBlas::trsm()

Header File: KokkosBlas3_trsm.hpp

Usage: KokkosBlas::trsm(side, uplo, trans, diag, alpha, A, B);

Triangular linear system solve with multiple right-hand-sides:

op(A)*X = alpha*B if side == "L" or "l"

X*op(A) = alpha*B if side == "R" or "r"

MultiVector Interface only

template<class AViewType,
         class BViewType>
void
trsm (const char side[],
      const char uplo[],
      const char trans[],
      const char diag[],
      typename BViewType::const_value_type& alpha,
      const AViewType& A,
      const BViewType& B)

Parameters:

  • AViewType: 2-D Kokkos::View
  • BViewType: 2-D Kokkos::View

Arguments:

  • side [in] "L" or "l" indicates matrix A is on the left of X, "R" or "r" indicates matrix A is on the right of X.
  • uplo [in] "U" or "u" indicates matrix A upper part is stored (the other part is not referenced), "L" or "l" indicates matrix A lower part is stored (the other part is not referenced).
  • trans [in] "N" or "n" for non-transpose, "T" or "t" for transpose, "C" or "c" for conjugate transpose.
  • diag [in] "U" or "u" indicates the diagonal of A is assumed to be unit, "N" or "n" indicated the diagonal of A is assumed to be non-unit.
  • alpha [in] Input coefficient used for multiplication with B.
  • A [in] Input matrix, as a 2-D Kokkos::View. If side == "L" or "l", matrix A is a M-by-M triangular matrix; otherwise, matrix A is a N-by-N triangular matrix.
  • B [in,out] Input/Output matrix, as a 2-D Kokkos::View. On entry, M-by-N matrix of multile RHS. On exit, overwritten with the solution X.

Requirements:

  • For a given set of side, uplo, trans, and diag, the dimensions of the matrices must align as necessary for Triangular linear system solve.

Example

#include<Kokkos_Core.hpp>
#include<KokkosBlas3_gemm.hpp>

int main(int argc, char* argv[]) {
   Kokkos::initialize();

   int M = atoi(argv[1]);
   int N = atoi(argv[2]);

   Kokkos::View<double**> A("A",M,N);
   Kokkos::View<double**> B("B",N,M);
   Kokkos::View<double**> C("C",M,M);
   
   Kokkos::deep_copy(A,1.0);
   Kokkos::deep_copy(B,2.0);

   const double alpha = double(1.0);
   const double beta = double(0.0);
   
   KokkosBlas::gemm("N","N",alpha,A,B,beta,C);

   Kokkos::finalize();
}
Clone this wiki locally