Debian Codegraph @

packages/kokkos-kernels/batched/dense/impl/KokkosBatched_QR_FormQ_TeamVector_Internal.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_FORM_Q_TEAMVECTOR_INTERNAL_HPP
17 #define KOKKOSBATCHED_QR_FORM_Q_TEAMVECTOR_INTERNAL_HPP
18
19 /// \author Kyungjoo Kim ([email protected])
20
21 #include "KokkosBatched_Util.hpp"
22 #include "KokkosBlas1_set_impl.hpp"
23 #include "KokkosBatched_SetIdentity_Internal.hpp"
24 #include "KokkosBatched_ApplyQ_TeamVector_Internal.hpp"
25
26 namespace KokkosBatched {
27
28 ///
29 /// TeamVector Internal Impl
30 /// ========================
31 ///
32 /// this impl follows the flame interface of householder transformation
33 ///
34 struct TeamVectorQR_FormQ_Internal {
35 template <typename MemberType, typename ValueType>
36 KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const int m, const int n, const int k,
37 /* */ ValueType *A, const int as0, const int as1,
38 /* */ ValueType *t, const int ts,
39 /* */ ValueType *Q, const int qs0, const int qs1,
40 /* */ ValueType *w, const bool is_Q_zero = false) {
41 typedef ValueType value_type;
42
43 /// Given a matrix A that includes QR factorization
44 /// it forms a unitary matrix Q
45 /// B = Q = (H0 H1 H2 H3 ... H(k-1)) I
46 /// where
47 /// A is m x k (holding H0, H1 ... H(k-1)
48 /// t is k x 1
49 /// B is m x m
50
51 // set identity
52 if (is_Q_zero)
53 KokkosBlas::Impl::TeamVectorSetInternal::invoke(member, m, value_type(1), Q, qs0 + qs1);
54 else
55 TeamVectorSetIdentityInternal::invoke(member, m, n, Q, qs0, qs1);
56 member.team_barrier();
57
58 return TeamVectorApplyQ_LeftForwardInternal ::invoke(member, m, n, k, A, as0, as1, t, ts, Q, qs0, qs1, w);
59 }
60 };
61
62 } // end namespace KokkosBatched
63
64 #endif