-
Notifications
You must be signed in to change notification settings - Fork 99
BLAS 1::iamax
Vinh Dang edited this page Feb 17, 2020
·
12 revisions
Header File: KokkosBlas1_iamax.hpp
Usage: nrm = KokkosBlas::iamax(x);
KokkosBlas::iamax(r,x);
Return the (smallest) index of the element of the maximum magnitude of x
.
template<class XVector>
typename XVector::size_type iamax (const XVector& x);
- XVector: a rank-1
Kokkos::View
x.rank == 1
template<class ReturnVector, class XVector>
void iamax (const ReturnVector& r, const XVector& x);
- ReturnVector: a rank-0 or rank-1
Kokkos::View
- XVector: a rank-1 or rank-2
Kokkos::View
x.rank == r.rank + 1
r.extent(0) == x.extent(1)
ReturnVector::non_const_value_type == ReturnVector::value_type
ReturnVector::value_type == XVector::size_type
#include<Kokkos_Core.hpp>
#include<KokkosBlas1_nrm_inf.hpp>
int main(int argc, char* argv[]) {
Kokkos::initialize();
int N = atoi(argv[1]);
Kokkos::View<double*> x("X",N);
Kokkos::deep_copy(x,3.0);
Kokkos::View<double> x_5(x,5);
Kokkos::deep_copy(x,-7.5);
double x_nrm = KokkosBlas::nrm_inf(x);
printf("X_nrm: %lf Expected: %lf Diff: %e\n",x_nrm,7.5,x_nrm-7.5);
Kokkos::finalize();
}