Debian Codegraph @

packages/kokkos-kernels/batched/dense/impl/KokkosBatched_QR_FormQ_Serial_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_SERIAL_INTERNAL_HPP
17 #define KOKKOSBATCHED_QR_FORM_Q_SERIAL_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_Serial_Internal.hpp"
25
26 namespace KokkosBatched {
27
28 ///
29 /// Serial Internal Impl
30 /// ====================
31 ///
32 /// this impl follows the flame interface of householder transformation
33 ///
34 struct SerialQR_FormQ_Internal {
35 template <typename ValueType>
36 KOKKOS_INLINE_FUNCTION static int invoke(const int m, 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 SerialSetInternal::invoke(m, value_type(1), Q, qs0 + qs1);
54 else
55 SerialSetIdentityInternal::invoke(m, Q, qs0, qs1);
56
57 return SerialApplyQ_LeftNoTransForwardInternal ::invoke(m, m, k, A, as0, as1, t, ts, Q, qs0, qs1, w);
58 }
59 };
60
61 } // end namespace KokkosBatched
62
63 #endif