| 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_INNER_TRSM_DECL_HPP |
| 17 |
#define KOKKOSBATCHED_INNER_TRSM_DECL_HPP |
| 18 |
|
| 19 |
/// \author Kyungjoo Kim ([email protected]) |
| 20 |
|
| 21 |
namespace KokkosBatched { |
| 22 |
|
| 23 |
// specialized for different m and n |
| 24 |
// Solve L(m x m) X(m x n) = B(m x n) |
| 25 |
template <int bmn> |
| 26 |
struct InnerTrsmLeftLowerUnitDiag { |
| 27 |
const int _as0, _as1, _bs0, _bs1; |
| 28 |
|
| 29 |
KOKKOS_INLINE_FUNCTION |
| 30 |
InnerTrsmLeftLowerUnitDiag(const int as0, const int as1, const int bs0, const int bs1) |
| 31 |
: _as0(as0), _as1(as1), _bs0(bs0), _bs1(bs1) {} |
| 32 |
|
| 33 |
// trisolve |
| 34 |
template <typename ValueType> |
| 35 |
KOKKOS_INLINE_FUNCTION int serial_invoke(const ValueType *KOKKOS_RESTRICT A, const int n, |
| 36 |
/**/ ValueType *KOKKOS_RESTRICT B); |
| 37 |
|
| 38 |
// for remainder |
| 39 |
template <typename ValueType> |
| 40 |
KOKKOS_INLINE_FUNCTION int serial_invoke(const ValueType *KOKKOS_RESTRICT A, const int m, const int n, |
| 41 |
/**/ ValueType *KOKKOS_RESTRICT B); |
| 42 |
}; |
| 43 |
|
| 44 |
// specialized for different m and n |
| 45 |
// Solve L(m x m) X(m x n) = B(m x n) |
| 46 |
template <int bmn> |
| 47 |
struct InnerTrsmLeftLowerNonUnitDiag { |
| 48 |
const int _as0, _as1, _bs0, _bs1; |
| 49 |
|
| 50 |
KOKKOS_INLINE_FUNCTION |
| 51 |
InnerTrsmLeftLowerNonUnitDiag(const int as0, const int as1, const int bs0, const int bs1) |
| 52 |
: _as0(as0), _as1(as1), _bs0(bs0), _bs1(bs1) {} |
| 53 |
|
| 54 |
// trisolve |
| 55 |
template <typename ValueType> |
| 56 |
KOKKOS_INLINE_FUNCTION int serial_invoke(const ValueType *KOKKOS_RESTRICT A, const int n, |
| 57 |
/**/ ValueType *KOKKOS_RESTRICT B); |
| 58 |
|
| 59 |
// for remainder |
| 60 |
template <typename ValueType> |
| 61 |
KOKKOS_INLINE_FUNCTION int serial_invoke(const ValueType *KOKKOS_RESTRICT A, const int m, const int n, |
| 62 |
/**/ ValueType *KOKKOS_RESTRICT B); |
| 63 |
}; |
| 64 |
|
| 65 |
// specialized for different m and n |
| 66 |
// Solve U(m x m) X(m x n) = B(m x n) |
| 67 |
template <int bmn> |
| 68 |
struct InnerTrsmLeftUpperUnitDiag { |
| 69 |
const int _as0, _as1, _bs0, _bs1; |
| 70 |
|
| 71 |
KOKKOS_INLINE_FUNCTION |
| 72 |
InnerTrsmLeftUpperUnitDiag(const int as0, const int as1, const int bs0, const int bs1) |
| 73 |
: _as0(as0), _as1(as1), _bs0(bs0), _bs1(bs1) {} |
| 74 |
|
| 75 |
// trisolve |
| 76 |
template <typename ValueType> |
| 77 |
KOKKOS_INLINE_FUNCTION int serial_invoke(const ValueType *KOKKOS_RESTRICT A, const int n, |
| 78 |
/**/ ValueType *KOKKOS_RESTRICT B); |
| 79 |
|
| 80 |
// for remainder |
| 81 |
template <typename ValueType> |
| 82 |
KOKKOS_INLINE_FUNCTION int serial_invoke(const ValueType *KOKKOS_RESTRICT A, const int m, const int n, |
| 83 |
/**/ ValueType *KOKKOS_RESTRICT B); |
| 84 |
}; |
| 85 |
|
| 86 |
// specialized for different m and n |
| 87 |
// Solve U(m x m) X(m x n) = B(m x n) |
| 88 |
template <int bmn> |
| 89 |
struct InnerTrsmLeftUpperNonUnitDiag { |
| 90 |
const int _as0, _as1, _bs0, _bs1; |
| 91 |
|
| 92 |
KOKKOS_INLINE_FUNCTION |
| 93 |
InnerTrsmLeftUpperNonUnitDiag(const int as0, const int as1, const int bs0, const int bs1) |
| 94 |
: _as0(as0), _as1(as1), _bs0(bs0), _bs1(bs1) {} |
| 95 |
|
| 96 |
// trisolve |
| 97 |
template <typename ValueType> |
| 98 |
KOKKOS_INLINE_FUNCTION int serial_invoke(const ValueType *KOKKOS_RESTRICT A, const int n, |
| 99 |
/**/ ValueType *KOKKOS_RESTRICT B); |
| 100 |
|
| 101 |
// for remainder |
| 102 |
template <typename ValueType> |
| 103 |
KOKKOS_INLINE_FUNCTION int serial_invoke(const ValueType *KOKKOS_RESTRICT A, const int m, const int n, |
| 104 |
/**/ ValueType *KOKKOS_RESTRICT B); |
| 105 |
}; |
| 106 |
|
| 107 |
} // namespace KokkosBatched |
| 108 |
|
| 109 |
#endif |