| 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 |
|
| 17 |
#ifndef KOKKOSBATCHED_IAMAX_SERIAL_IMPL_HPP_ |
| 18 |
#define KOKKOSBATCHED_IAMAX_SERIAL_IMPL_HPP_ |
| 19 |
|
| 20 |
/// \author Yuuichi Asahi ([email protected]) |
| 21 |
|
| 22 |
#include "KokkosBatched_Iamax_Serial_Internal.hpp" |
| 23 |
|
| 24 |
namespace KokkosBatched { |
| 25 |
|
| 26 |
template <typename XViewType> |
| 27 |
KOKKOS_INLINE_FUNCTION typename XViewType::size_type SerialIamax::invoke(const XViewType &x) { |
| 28 |
static_assert(Kokkos::is_view_v<XViewType>, "KokkosBatched::iamax: XViewType is not a Kokkos::View."); |
| 29 |
if (x.extent(0) <= 1) return 0; |
| 30 |
using size_type = typename XViewType::size_type; |
| 31 |
using value_type = typename XViewType::non_const_value_type; |
| 32 |
return KokkosBatched::Impl::SerialIamaxInternal::invoke<size_type, value_type>(x.extent(0), x.data(), x.stride(0)); |
| 33 |
} |
| 34 |
|
| 35 |
} // namespace KokkosBatched |
| 36 |
|
| 37 |
#endif // KOKKOSBATCHED_IAMAX_SERIAL_IMPL_HPP_ |