|
| 1 | +KokkosBatched::Trsm |
| 2 | +################### |
| 3 | + |
| 4 | +Defined in header: :code:`KokkosBatched_Trsm_Decl.hpp` |
| 5 | + |
| 6 | +.. code:: c++ |
| 7 | + |
| 8 | + template <typename ArgSide, typename ArgUplo, typename ArgTrans, typename ArgDiag, typename ArgAlgo> |
| 9 | + struct SerialTrsm { |
| 10 | + template <typename ScalarType, typename AViewType, typename BViewType> |
| 11 | + KOKKOS_INLINE_FUNCTION static int invoke(const ScalarType alpha, const AViewType &A, const BViewType &B); |
| 12 | + }; |
| 13 | + |
| 14 | + template <typename MemberType, typename ArgSide, typename ArgUplo, typename ArgTrans, typename ArgDiag, |
| 15 | + typename ArgAlgo> |
| 16 | + struct TeamTrsm { |
| 17 | + template <typename ScalarType, typename AViewType, typename BViewType> |
| 18 | + KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A, |
| 19 | + const BViewType &B); |
| 20 | + }; |
| 21 | + |
| 22 | + template <typename MemberType, typename ArgSide, typename ArgUplo, typename ArgTrans, typename ArgDiag, |
| 23 | + typename ArgAlgo> |
| 24 | + struct TeamVectorTrsm { |
| 25 | + template <typename ScalarType, typename AViewType, typename BViewType> |
| 26 | + KOKKOS_INLINE_FUNCTION static int invoke(const MemberType &member, const ScalarType alpha, const AViewType &A, |
| 27 | + const BViewType &B); |
| 28 | + }; |
| 29 | + |
| 30 | + |
| 31 | +Solves a system of the linear equations :math:`op(A) \cdot X = \alpha B` or :math:`X \cdot op(A) = \alpha B` where :math:`\alpha` is a scalar, :math:`X` and :math:`B` are m-by-n matrices, :math:`A` is a unit or non-unit, upper or lower triangular matrix and |
| 32 | +:math:`op(A)` is one of :math:`A`, :math:`A^T`, or :math:`A^H`. The matrix :math:`X` is overwritten on :math:`B`. |
| 33 | + |
| 34 | +1. For a real matrix :math:`A`, :math:`op(A)` is one of :math:`A` or :math:`A^T`. |
| 35 | + This operation is equivalent to the BLAS routine ``STRSM`` or ``DTRSM`` for single or double precision. |
| 36 | + |
| 37 | +2. For a complex matrix :math:`A`, :math:`op(A)` is one of :math:`A`, :math:`A^T`, or :math:`A^H` |
| 38 | + This operation is equivalent to the BLAS routine ``CTRSM`` or ``ZTRSM`` for single or double precision. |
| 39 | + |
| 40 | +Parameters |
| 41 | +========== |
| 42 | + |
| 43 | +:member: Kokkos team member handle (only for ``TeamTrsm`` and ``TeamVectorTrsm``). |
| 44 | +:alpha: Scalar multiplier for :math:`B`. |
| 45 | +:A: Input view containing the upper or lower triangular matrix. |
| 46 | +:B: Input/output view containing the right-hand side on input and the solution on output. |
| 47 | + |
| 48 | +Type Requirements |
| 49 | +----------------- |
| 50 | + |
| 51 | +- ``MemberType`` must be a Kokkos team member handle (only for ``TeamTrsm`` and ``TeamVectorTrsm``). |
| 52 | + |
| 53 | +- ``ArgSide`` must be one of the following: |
| 54 | + - ``KokkosBatched::Side::Left`` to solve a system :math:`op(A) \cdot X = \alpha B` |
| 55 | + - ``KokkosBatched::Side::Right`` to solve a system :math:`X \cdot op(A) = \alpha B` |
| 56 | + |
| 57 | +- ``ArgUplo`` must be one of the following: |
| 58 | + - ``KokkosBatched::Uplo::Upper`` for upper triangular solve |
| 59 | + - ``KokkosBatched::Uplo::Lower`` for lower triangular solve |
| 60 | + |
| 61 | +- ``ArgTrans`` must be one of the following: |
| 62 | + - ``KokkosBatched::Trans::NoTranspose`` for :math:`op(A) = A` |
| 63 | + - ``KokkosBatched::Trans::Transpose`` for :math:`op(A) = A^T` |
| 64 | + - ``KokkosBatched::Trans::ConjTranspose`` for :math:`op(A) = A^H` |
| 65 | + |
| 66 | +- ``ArgDiag`` must be one of the following: |
| 67 | + - ``KokkosBatched::Diag::Unit`` for the unit triangular matrix :math:`A` |
| 68 | + - ``KokkosBatched::Diag::NonUnit`` for the non-unit triangular matrix :math:`A` |
| 69 | + |
| 70 | +- ``ArgAlgo`` must be one of the following: |
| 71 | + - ``KokkosBatched::Algo::trsm::Blocked`` for the blocked algorithm |
| 72 | + - ``KokkosBatched::Algo::trsm::Unblocked`` for the unblocked algorithm |
| 73 | + |
| 74 | +- ``ScalarType`` must be a built-in arithmetic type like ``float``, ``double``, ``Kokkos::complex<float>``, or ``Kokkos::complex<double>``. |
| 75 | +- ``AViewType`` must be a Kokkos `View <https://kokkos.org/kokkos-core-wiki/API/core/view/view.html>`_ of rank 2 containing the band matrix A |
| 76 | +- ``BViewType`` must be a Kokkos `View <https://kokkos.org/kokkos-core-wiki/API/core/view/view.html>`_ of rank 2 containing the right-hand side that satisfies |
| 77 | + - ``std::is_same_v<typename BViewType::value_type, typename BViewType::non_const_value_type> == true`` |
| 78 | + |
| 79 | +.. note:: |
| 80 | + |
| 81 | + Some combinations of template parameters may not be supported yet. |
| 82 | + |
| 83 | +Example |
| 84 | +======= |
| 85 | + |
| 86 | +.. literalinclude:: ../../../../../example/batched_solve/serial_trsm.cpp |
| 87 | + :language: c++ |
| 88 | + |
| 89 | +output: |
| 90 | + |
| 91 | +.. code:: |
| 92 | +
|
| 93 | + trsm works correctly! |
0 commit comments