| 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_DECL_HPP |
| 17 |
#define KOKKOSBATCHED_EIGENDECOMPOSITION_DECL_HPP |
| 18 |
|
| 19 |
/// \author Kyungjoo Kim ([email protected]) |
| 20 |
|
| 21 |
#include "KokkosBatched_Util.hpp" |
| 22 |
#include "KokkosBatched_Vector.hpp" |
| 23 |
|
| 24 |
namespace KokkosBatched { |
| 25 |
|
| 26 |
/// Given a general nonsymmetric matrix A (m x m), it performs |
| 27 |
/// eigendecomposition of the matrix. |
| 28 |
/// |
| 29 |
/// Parameters: |
| 30 |
/// [in] member |
| 31 |
/// Team interface only has this argument. Partial specialization can be |
| 32 |
/// applied for a different type of team member. |
| 33 |
/// [in/out]A |
| 34 |
/// Real general nonsymmetric rank 2 view A(m x m). |
| 35 |
/// A is first condensed to a upper Hessenberg form. Then, the Francis |
| 36 |
/// double shift QR algorithm is applied to compute its Schur form. |
| 37 |
/// On exit, A stores a quasi upper triangular matrix of the Schur |
| 38 |
/// decomposition. |
| 39 |
/// [out]er, [out]ei |
| 40 |
/// A real and imaginary eigenvalues, which forms er(m)+ei(m)i |
| 41 |
/// For a complex eigen pair, it stores a+bi and a-bi consecutively. |
| 42 |
/// [out]UL, [out]UR |
| 43 |
/// Left/right eigenvectors are stored in (m x m) matrices. If zero span |
| 44 |
/// view is provided, it does not compute the corresponding eigenvectors. |
| 45 |
/// However, both UL and UR cannot have zero span. If eigenvalues are only |
| 46 |
/// requested, use the Eigenvalue interface which simplifies computations |
| 47 |
/// [out]W |
| 48 |
/// 1D contiguous workspace. The minimum size is (2*m*m+5*m) where m is the |
| 49 |
/// dimension of matrix A. |
| 50 |
|
| 51 |
struct SerialEigendecomposition { |
| 52 |
template <typename AViewType, typename EViewType, typename UViewType, typename WViewType> |
| 53 |
KOKKOS_INLINE_FUNCTION static int invoke(const AViewType &A, const EViewType &er, const EViewType &ei, |
| 54 |
const UViewType &UL, const UViewType &UR, const WViewType &W); |
| 55 |
}; |
| 56 |
|
| 57 |
template <typename MemberType> |
| 58 |
struct TeamVectorEigendecomposition { |
| 59 |
template <typename AViewType, typename EViewType, typename UViewType, typename WViewType> |
| 60 |
KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const AViewType &A, const EViewType &er, |
| 61 |
const EViewType &ei, const UViewType &UL, const UViewType &UR, |
| 62 |
const WViewType &W); |
| 63 |
}; |
| 64 |
|
| 65 |
} // namespace KokkosBatched |
| 66 |
|
| 67 |
#endif |