Debian Codegraph @

packages/kokkos-kernels/batched/dense/src/KokkosBatched_QR_Decl.hpp

raw
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_QR_DECL_HPP
17 #define KOKKOSBATCHED_QR_DECL_HPP
18
19 /// \author Kyungjoo Kim ([email protected])
20
21 #include "KokkosBatched_Util.hpp"
22
23 namespace KokkosBatched {
24
25 ///
26 /// Serial QR
27 ///
28
29 template <typename ArgAlgo>
30 struct SerialQR {
31 template <typename AViewType, typename tViewType, typename wViewType>
32 KOKKOS_INLINE_FUNCTION static int invoke(const AViewType &A, const tViewType &t, const wViewType &w);
33 };
34
35 ///
36 /// Team QR
37 ///
38
39 template <typename MemberType, typename ArgAlgo>
40 struct TeamQR {
41 template <typename AViewType, typename tViewType, typename wViewType>
42 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType & /*member*/, const AViewType & /*A*/,
43 const tViewType & /*t*/, const wViewType & /*w*/) {
44 /// not implemented
45 return -1;
46 }
47 };
48
49 ///
50 /// TeamVector QR
51 ///
52
53 template <typename MemberType, typename ArgAlgo>
54 struct TeamVectorQR {
55 template <typename AViewType, typename tViewType, typename wViewType>
56 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const AViewType &A, const tViewType &t,
57 const wViewType &w);
58 };
59
60 ///
61 /// Selective Interface
62 ///
63 template <typename MemberType, typename ArgMode, typename ArgAlgo>
64 struct QR {
65 template <typename AViewType, typename tViewType, typename wViewType>
66 KOKKOS_FORCEINLINE_FUNCTION static int invoke(const MemberType &member, const AViewType &A, const tViewType &t,
67 const wViewType &w) {
68 int r_val = 0;
69 if (std::is_same<ArgMode, Mode::Serial>::value) {
70 r_val = SerialQR<ArgAlgo>::invoke(A, t, w);
71 } else if (std::is_same<ArgMode, Mode::Team>::value) {
72 r_val = TeamQR<MemberType, ArgAlgo>::invoke(member, A, t, w);
73 } else if (std::is_same<ArgMode, Mode::TeamVector>::value) {
74 r_val = TeamVectorQR<MemberType, ArgAlgo>::invoke(member, A, t, w);
75 }
76 return r_val;
77 }
78 };
79
80 } // namespace KokkosBatched
81
82 #include "KokkosBatched_QR_Serial_Impl.hpp"
83 #include "KokkosBatched_QR_TeamVector_Impl.hpp"
84
85 #endif