Debian Codegraph @

packages/kokkos-kernels/batched/dense/impl/KokkosBatched_Eigendecomposition_TeamVector_Impl.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_EIGENDECOMPOSITION_TEAMVECTOR_IMPL_HPP
17 #define KOKKOSBATCHED_EIGENDECOMPOSITION_TEAMVECTOR_IMPL_HPP
18
19 /// \author Kyungjoo Kim ([email protected])
20
21 #include "KokkosBatched_Util.hpp"
22 #include "KokkosBatched_Eigendecomposition_TeamVector_Internal.hpp"
23
24 namespace KokkosBatched {
25
26 ///
27 /// Team Impl
28 /// =========
29
30 template <typename MemberType>
31 template <typename AViewType, typename EViewType, typename UViewType, typename WViewType>
32 KOKKOS_INLINE_FUNCTION int TeamVectorEigendecomposition<MemberType>::invoke(const MemberType &member,
33 const AViewType &A, const EViewType &er,
34 const EViewType &ei, const UViewType &UL,
35 const UViewType &UR, const WViewType &W) {
36 /// view checking
37 const int m = A.extent(0);
38 assert(m == A.extent(1) && "Eigendecomposition: A is not square");
39 assert(m == er.extent(0) && "Eigendecomposition: Length of er does not match to A's dimension");
40 assert(m == ei.extent(0) && "Eigendecomposition: Length of ei does not match to A's dimension");
41 assert(m == UL.extent(0) && "Eigendecomposition: Length of UL does not match to A's dimension");
42 assert(m == UL.extent(1) && "Eigendecomposition: Width of UL does not match to A's dimension");
43 assert(m == UR.extent(0) && "Eigendecomposition: Length of UR does not match to A's dimension");
44 assert(m == UR.extent(1) && "Eigendecomposition: Width of UR does not match to A's dimension");
45 // assert(W.extent(0) >= (2*m*m+5*m) && "Eigendecomposition: workspace size is
46 // too small");
47 assert(W.stride(0) == 1 && "Eigendecomposition: Provided workspace is not contiguous");
48
49 return m ? TeamVectorEigendecompositionInternal ::invoke(member, A.extent(0), A.data(), A.stride(0), A.stride(1),
50 er.data(), er.stride(0), ei.data(), ei.stride(0), UL.data(),
51 UL.stride(0), UL.stride(1), UR.data(), UR.stride(0),
52 UR.stride(1), W.data(), W.extent(0))
53 : 0;
54 }
55
56 } // namespace KokkosBatched
57
58 #endif