KokkosBlas::ger¶
Defined in header: KokkosBlas2_ger.hpp
template <class ExecutionSpace, class XViewType, class YViewType, class AViewType>
void ger(const ExecutionSpace& space, const char trans[],
const typename AViewType::const_value_type& alpha,
const XViewType& x, const YViewType& y, const AViewType& A);
template <class XViewType, class YViewType, class AViewType>
void ger(const char trans[], const typename AViewType::const_value_type& alpha,
const XViewType& x, const YViewType& y, const AViewType& A);
Perform a rank-1 update of matrix A by vectors x and y with scaling factor alpha
Iterate of the entries of
Aand update them with thealphascaled product of the entries ofxandyusing resources from thespaceinstance.Iterate of the entries of
Aand update them with thealphascaled product of the entries ofxandyusing resources from the default instance oftypename AViewType::execution_space.
The function will throw a runtime exception if A.extent(0) != X.extent(0) || A.extent(1) != Y.extent(0).
Parameters¶
- space:
execution space instance.
- trans:
“T” for transpose and “H” for conjugate transpose of
y, all characters after the first one are ignored.- alpha:
scaling parameter for the rank update.
- x, y:
vectors used to perform the rank update.
- A:
matrix being updated.
Type Requirements¶
execution_space must be a Kokkos execution space
XViewType must be a Kokkos View of rank 1 that satisfies
Kokkos::SpaceAccessibility<execution_space, typename XViewType::memory_space>::accessible
YViewType must be a Kokkos View of rank 1 that satisfies
Kokkos::SpaceAccessibility<execution_space, typename YViewType::memory_space>::accessible
AViewType must be a Kokkos View of rank 2 that satisfies
Kokkos::SpaceAccessibility<execution_space, typename AViewType::memory_space>::accessiblestd::is_same_v<typename AViewType::value_type, typename AViewType::non_const_value_type>
Example¶
#include <Kokkos_Core.hpp>
#include <KokkosBlas2_ger.hpp>
int main(int argc, char* argv[]) {
Kokkos::initialize(argc, argv);
{
constexpr int M = 5;
constexpr int N = 4;
Kokkos::View<double**> A("A", M, N);
Kokkos::View<double*> x("X", M);
Kokkos::View<double*> y("Y", N);
Kokkos::deep_copy(A, 1.0);
Kokkos::deep_copy(x, 3.0);
Kokkos::deep_copy(y, 1.3);
const double alpha = KokkosKernels::ArithTraits<double>::one();
KokkosBlas::ger("T", alpha, x, y, A);
}
Kokkos::finalize();
}