KokkosBlas::axpby¶
Defined in header: KokkosBlas1_axpby.hpp
template <class execution_space, class AV, class XMV, class BV, class YMV>
void axpby(const execution_space& exec_space, const AV& a, const XMV& X, const BV& b, const YMV& Y) {
template <class AV, class XMV, class BV, class YMV>
void axpby(const AV& a, const XMV& X, const BV& b, const YMV& Y) {
Scale Y by coefficient b and then add entries of X scaled by coefficient a: Y := a*X + b*Y
Compute
Y := a*X + b*Yon the providedexec_space.Compute
Y := a*X + b*Yon the default execution space instance of typeXMV::execution_space.
aandbmay each be any of the following:a scalar value
a rank-0 host-accessible
Kokkos::Viewa rank-0 device-accessible
Kokkos::Viewa rank-1 device-accessible
Kokkos::Viewwith extent 1 (the coefficient will be applied to all columns)a rank-1 device-accessible
Kokkos::Viewwith extentY.extent(1)(one coefficient per column)
- The function will throw a runtime exception if any of the following conditions are not met:
Y.extent(0) == X.extent(0) && Y.extent(1) == X.extent(1)
- If
ais a rank-1View: a.extent(0) == 1 || a.extent(0) == X.extent(1)
- If
bis a rank-1View: b.extent(0) == 1 || b.extent(0) == Y.extent(1)
Note: if b is a single coefficient to apply to all columns of Y, and b is zero,
then the values of Y on input are treated as zeros. This means that the axpby will
overwrite any NaN or infinity values in Y.
Parameters¶
- space:
execution space instance
- a:
scaling factor(s) applied to
X- X:
input vector or multi-vector
- b:
scaling factor(s) applied to
Y- Y:
output vector or multi-vector
Type Requirements¶
execution_space must be a Kokkos execution space
XMV must be a Kokkos View of rank 1 or 2 that satisfies
Kokkos::SpaceAccessibility<execution_space, typename XMV::memory_space>::accessible
YMV must be a Kokkos View that satisfies
YMV::rank == XMV::rank!std::is_const_v<typename YMV::value_type>Kokkos::SpaceAccessibility<execution_space, typename YMV::memory_space>::accessible
AV must be a scalar or a Kokkos View that satisfies one of the following:
AV::rank == 0AV::rank == 1 && Kokkos::SpaceAccessibility<execution_space, typename YMV::memory_space>::accessible
BV must be a scalar or a Kokkos View that satisfies one of the following:
BV::rank == 0BV::rank == 1 && Kokkos::SpaceAccessibility<execution_space, typename YMV::memory_space>::accessible