KokkosLapack::svd¶
Defined in header: KokkosLapack_svd.hpp
template <class ExecutionSpace, class AMatrix, class SVector, class UMatrix, class VMatrix>
void svd(const ExecutionSpace& space, const char jobu[], const char jobvt[], const AMatrix& A,
const SVector& S, const UMatrix& U, const VMatrix& Vt);
template <class AMatrix, class SVector, class UMatrix, class VMatrix>
void svd(const char jobu[], const char jobvt[], const AMatrix& A,
const SVector& S, const UMatrix& U, const VMatrix& Vt);
Compute the singular value decomposition of matrix A which can be written as
Note
The function will compute the transpose of the right singular vectors Vt for computational efficiency.
Compute the singular value decomposition of
AintoS,UandVtusing the resources associated with space.Same as 1. but using the resources associated with
AMatrix::execution_space().
Parameters¶
- space:
execution space instance.
- jobu, jobvt:
characters used to control the calculation of left (jobu) and right (jobvt) singular vectors.
Ameans all the singular vectors are computed,Smeans the first \(min(m, n)\) vectors will be computed inU,Omeans the first \(min(m, n)\) vectors will be computed and overwritten inA,Nmeans no singular vectors will be computed.- A:
the matrix on which the singular value decomposition will be computed.
- S:
the
min(m, n)singular values ofAin decreasing order.- U, Vt:
the left and right singular vectors of
Acomputed according to thejobuandjobvtflags.
Type Requirements¶
ExecutionSpace must be a Kokkos execution space
the three matrix types
AMatrix,UMatrixandVMatrixhave the same requirements:Kokkos::is_view_v<AMatrix> && AMatrix::rank() == 2 && Kokkos::SpaceAccessibility<ExecutionSpace, typename AMatrix::memory_space>::accessibleKokkos::is_view_v<UMatrix> && UMatrix::rank() == 2 && Kokkos::SpaceAccessibility<ExecutionSpace, typename UMatrix::memory_space>::accessibleKokkos::is_view_v<VMatrix> && VMatrix::rank() == 2 && Kokkos::SpaceAccessibility<ExecutionSpace, typename VMatrix::memory_space>::accessible
the vector of singular values has the following requirements:
Kokkos::is_view_v<SVector> && SVector::rank() == 1 && Kokkos::SpaceAccessibility<ExecutionSpace, typename SVector::memory_space>::accessiblestd::is_same_v<typename SVector::array_layout, Kokkos::LayoutStride> && S.span_is_contiguous()only contiguous strided spans are allowed.
Note
Should check that the ouput view SVector, UMatrix and VMatrix are storing non-const data.