Skip to content

BLAS 2::syr

Luc Berger edited this page Apr 23, 2024 · 1 revision

KokkosBlas::syr()

Header File: KokkosBlas2_syr.hpp

Usage: KokkosBlas::syr (space, mode, uplo, alpha, x, A);

Matrix symmetric Rank 1 update: A = A + alpha * x * x^{T,H}

Interface

template <class ExecutionSpace,
          class XViewType,
          class AViewType>
void ger(const ExecutionSpace& space,
         const char trans[],
         const char uplo[],
         const typename AViewType::const_value_type& alpha,
         const XViewType& x,
         const AViewType& A)

template <class XViewType,
          class AViewType>
void ger(const char trans[],
         const char uplo[],
         const typename AViewType::const_value_type& alpha,
         const XViewType& x,
         const AViewType& A)

Template Parameters:

  • ExecutionSpace: A Kokkos execution space
  • XViewType: A rank-1 Kokkos::View
  • AViewType: A rank-2 Kokkos::View

Arguments:

  • trans [in] "T" for transpose, "H" for conjugate transpose. All characters after the first are ignored. This works just like the BLAS routines.
  • uplo [in] "U" or "u" for upper portion, "L" or "l" for lower portion. Only the first character is taken into account.
  • alpha [in] Input coefficient of x*y
  • x [in] Input vector, as a 1-D Kokkos::View
  • A [in/out] Output matrix, as a nonconst 2-D Kokkos::View

Requirements:

  • x is a rank-1 views
  • A is a rank-2 view
  • x and A have memory space accessible from ExecutionSpace
  • A.extent(0) == x.extent(0) && A.extent(1) == A.extent(0)

Example

#include <Kokkos_Core.hpp>
#include <KokkosBlas2_syr.hpp>

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

    Kokkos::View<double**> A("A", M, M);
    Kokkos::View<double*> x("X", M);

    Kokkos::deep_copy(A, 1.0);
    Kokkos::deep_copy(x, 3.0);

    const double alpha = double(1.0);

    KokkosBlas::syr("T", "U", alpha, x, A);
  }
  Kokkos::finalize();
}
Clone this wiki locally