| 1 |
//@HEADER |
| 2 |
// ************************************************************************ |
| 3 |
// |
| 4 |
// Kokkos v. 4.0 |
| 5 |
// Copyright (2022) National Technology & Engineering |
| 6 |
// Solutions of Sandia, LLC (NTESS). |
| 7 |
// |
| 8 |
// Under the terms of Contract DE-NA0003525 with NTESS, |
| 9 |
// the U.S. Government retains certain rights in this software. |
| 10 |
// |
| 11 |
// Part of Kokkos, under the Apache License v2.0 with LLVM Exceptions. |
| 12 |
// See https://kokkos.org/LICENSE for license information. |
| 13 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 14 |
// |
| 15 |
//@HEADER |
| 16 |
#ifndef KOKKOSBATCHED_IAMAX_HPP_ |
| 17 |
#define KOKKOSBATCHED_IAMAX_HPP_ |
| 18 |
|
| 19 |
/// \author Yuuichi Asahi ([email protected]) |
| 20 |
|
| 21 |
namespace KokkosBatched { |
| 22 |
|
| 23 |
/// \brief Serial Batched Iamax: |
| 24 |
/// Iamax finds the index of the first element having maximum absolute value. |
| 25 |
/// |
| 26 |
/// \tparam XViewType: Input view type, needs to be a 1D view |
| 27 |
/// |
| 28 |
/// \param X [in]: Input view type |
| 29 |
/// |
| 30 |
/// \return The index of the first element having maximum absolute value |
| 31 |
/// As well as Blas, this returns 0 (0 in Fortran) for an empty vector |
| 32 |
/// No nested parallel_for is used inside of the function. |
| 33 |
/// |
| 34 |
|
| 35 |
struct SerialIamax { |
| 36 |
template <typename XViewType> |
| 37 |
KOKKOS_INLINE_FUNCTION static typename XViewType::size_type invoke(const XViewType &x); |
| 38 |
}; |
| 39 |
} // namespace KokkosBatched |
| 40 |
|
| 41 |
#include "KokkosBatched_Iamax_Serial_Impl.hpp" |
| 42 |
|
| 43 |
#endif // KOKKOSBATCHED_IAMAX_HPP_ |