Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Namespaces | Concepts | Functions
svd.hpp File Reference

LAPACK backend for exact dense singular value decompositions. More...

#include "common.hpp"
#include <uni20/backend/blas/blas_int.hpp>
#include <uni20/backend/lapack/lapack.hpp>
#include <uni20/common/trace.hpp>
#include <uni20/core/scalar_concepts.hpp>
#include <uni20/linalg/blas/mdspan_matrix.hpp>
#include <uni20/linalg/blas/mdspan_vector.hpp>
#include <uni20/linalg/dispatch.hpp>
#include <uni20/linalg/operation_tags.hpp>
#include <uni20/tensor/access.hpp>
#include <uni20/tensor/concepts.hpp>
#include <algorithm>
#include <concepts>
#include <cstddef>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for backends/lapack/svd.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  uni20
 
namespace  uni20::linalg
 
namespace  uni20::linalg::lapack_detail
 

Concepts

concept  uni20::linalg::lapack_detail::SvdOperation
 

Functions

template<lapack_detail::SvdOperation Operation, uni20::MutableStridedMdspecLike... Mdspans>
requires (LapackScalar<typename Mdspans::value_type> && ...) && (uni20::HostWritableMdspec<Mdspans> && ...) && requires { lapack_detail::svd_acceptance(Operation{}, std::type_identity<uni20::host_write_mdspan_t<Mdspans>>{}...); }
consteval auto uni20::linalg::kernel_accepts_types (LapackBackend const &, Operation const &, Mdspans &...)
 Report eligibility for host-accessible mdspec SVD operands.
 
template<uni20::LapackScalar Scalar, class MatrixHandle , class ValueHandle >
KernelAttempt uni20::linalg::lapack_detail::run_gesvd (char jobu, char jobvt, std::size_t rank, uni20::linalg::blas::BlasWritableMatrix< Scalar, MatrixHandle > const &matrix, uni20::linalg::blas::BlasWritableVector< uni20::make_real_t< Scalar >, ValueHandle > const &values, Scalar *left, blas_int left_leading_dimension, Scalar *right, blas_int right_leading_dimension)
 
template<class MatrixMdspan >
void uni20::linalg::lapack_detail::set_identity (MatrixMdspan &&matrix)
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
consteval auto uni20::linalg::lapack_detail::svd_acceptance (singular_values_op const &, std::type_identity< SingularValueMdspan >, std::type_identity< MatrixMdspan >)
 Report compile-time eligibility for resolved LAPACK singular values.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > LeftMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
consteval auto uni20::linalg::lapack_detail::svd_acceptance (svd_left_op const &, std::type_identity< SingularValueMdspan >, std::type_identity< LeftMdspan >, std::type_identity< MatrixMdspan >)
 Report compile-time eligibility for resolved LAPACK left singular vectors.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
consteval auto uni20::linalg::lapack_detail::svd_acceptance (svd_left_op const &, std::type_identity< SingularValueMdspan >, std::type_identity< MatrixMdspan >)
 Report compile-time eligibility for resolved input-overwriting LAPACK left singular vectors.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > LeftMdspan, uni20::MutableRankedStridedMdspanLike< 2 > RightAdjointMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
consteval auto uni20::linalg::lapack_detail::svd_acceptance (svd_op const &, std::type_identity< SingularValueMdspan >, std::type_identity< LeftMdspan >, std::type_identity< RightAdjointMdspan >, std::type_identity< MatrixMdspan >)
 Report compile-time eligibility for resolved LAPACK exact SVD.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > OtherFactorMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
consteval auto uni20::linalg::lapack_detail::svd_acceptance (svd_op const &, std::type_identity< SingularValueMdspan >, std::type_identity< OtherFactorMdspan >, std::type_identity< MatrixMdspan >)
 Report compile-time eligibility for a resolved input-overwriting LAPACK exact SVD.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
consteval auto uni20::linalg::lapack_detail::svd_acceptance (svd_right_op const &, std::type_identity< SingularValueMdspan >, std::type_identity< MatrixMdspan >)
 Report compile-time eligibility for resolved input-overwriting LAPACK right singular vectors.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > RightAdjointMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
consteval auto uni20::linalg::lapack_detail::svd_acceptance (svd_right_op const &, std::type_identity< SingularValueMdspan >, std::type_identity< RightAdjointMdspan >, std::type_identity< MatrixMdspan >)
 Report compile-time eligibility for resolved LAPACK right singular vectors.
 
template<class SingularValueMdspan , class MatrixMdspan >
consteval bool uni20::linalg::lapack_detail::svd_base_types_supported ()
 
template<class FactorMdspan , class MatrixMdspan >
consteval bool uni20::linalg::lapack_detail::svd_factor_types_supported ()
 
char uni20::linalg::lapack_detail::svd_job (SvdVectorExtent extent)
 
template<lapack_detail::SvdOperation Operation, uni20::MutableStridedMdspecLike... Mdspans>
requires (LapackScalar<typename Mdspans::value_type> && ...) && (uni20::HostWritableMdspec<Mdspans> && ...) && requires { lapack_detail::svd_acceptance(Operation{}, std::type_identity<uni20::host_write_mdspan_t<Mdspans>>{}...); }
KernelAttempt uni20::linalg::try_kernel (LapackBackend, Operation const &operation, Mdspans &... mdspans)
 Resolve host access and run a LAPACK SVD operation.
 
template<class SingularValueMdspan , class MatrixMdspan >
KernelAttempt uni20::linalg::lapack_detail::try_singular_values_kernel (char jobu, char jobvt, SingularValueMdspan &&singular_values, MatrixMdspan &&matrix_work)
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
KernelAttempt uni20::linalg::lapack_detail::try_svd (singular_values_op const &, SingularValueMdspan &singular_values, MatrixMdspan &matrix_work)
 Compute exact singular values through LAPACK gesvd.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > LeftMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
KernelAttempt uni20::linalg::lapack_detail::try_svd (svd_left_op const &op, SingularValueMdspan &singular_values, LeftMdspan &left_singular_vectors, MatrixMdspan &matrix_work)
 Compute singular values and left singular vectors through LAPACK gesvd.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
KernelAttempt uni20::linalg::lapack_detail::try_svd (svd_left_op const &op, SingularValueMdspan &singular_values, MatrixMdspan &matrix_work)
 Compute reduced left singular vectors in the matrix input allocation.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > LeftMdspan, uni20::MutableRankedStridedMdspanLike< 2 > RightAdjointMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
KernelAttempt uni20::linalg::lapack_detail::try_svd (svd_op const &op, SingularValueMdspan &singular_values, LeftMdspan &left_singular_vectors, RightAdjointMdspan &right_singular_vectors_adjoint, MatrixMdspan &matrix_work)
 Compute an exact dense SVD through LAPACK gesvd.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > OtherFactorMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
KernelAttempt uni20::linalg::lapack_detail::try_svd (svd_op const &op, SingularValueMdspan &singular_values, OtherFactorMdspan &other_factor, MatrixMdspan &matrix_work)
 Compute an exact dense SVD with one reduced factor overwriting the input allocation.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
KernelAttempt uni20::linalg::lapack_detail::try_svd (svd_right_op const &op, SingularValueMdspan &singular_values, MatrixMdspan &matrix_work)
 Compute reduced right singular vectors in the matrix input allocation.
 
template<uni20::MutableRankedStridedMdspanLike< 1 > SingularValueMdspan, uni20::MutableRankedStridedMdspanLike< 2 > RightAdjointMdspan, uni20::MutableRankedStridedMdspanLike< 2 > MatrixMdspan>
KernelAttempt uni20::linalg::lapack_detail::try_svd (svd_right_op const &op, SingularValueMdspan &singular_values, RightAdjointMdspan &right_singular_vectors_adjoint, MatrixMdspan &matrix_work)
 Compute singular values and right singular vectors through LAPACK gesvd.
 

Detailed Description

LAPACK backend for exact dense singular value decompositions.