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

Destructive and value-producing exact dense singular value decompositions. More...

#include <uni20/linalg/backends/lapack/svd.hpp>
#include <uni20/linalg/blas/mdspan_matrix.hpp>
#include <uni20/linalg/decomposition_precision.hpp>
#include <uni20/linalg/dispatch.hpp>
#include <uni20/linalg/operation_tags.hpp>
#include <uni20/tensor/copy.hpp>
#include <uni20/tensor/output.hpp>
#include <uni20/tensor/tensor.hpp>
#include <algorithm>
#include <array>
#include <concepts>
#include <type_traits>
#include <utility>
Include dependency graph for ops/svd.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  uni20::linalg::SvdLeftResult< LeftTensor, SingularValueTensor >
 Owning left singular vectors and singular values returned by svd_left. More...
 
struct  uni20::linalg::SvdResult< LeftTensor, SingularValueTensor, RightAdjointTensor >
 Owning factors returned by svd. More...
 
struct  uni20::linalg::SvdRightResult< SingularValueTensor, RightAdjointTensor >
 Owning singular values and right singular vectors returned by svd_right. More...
 

Namespaces

namespace  uni20
 
namespace  uni20::linalg
 

Functions

template<KernelBackendSelector BackendSelector, uni20::MutableRankedTensorView< 1 > SingularValueTensor, uni20::MutableRankedTensorView< 2 > LeftTensor, uni20::MutableRankedTensorView< 2 > RightAdjointTensor, uni20::MutableRankedTensorView< 2 > MatrixTensor>
void uni20::linalg::singular_value_decomposition (BackendSelector &&selector, SingularValueTensor &&singular_values, LeftTensor &&left_singular_vectors, RightAdjointTensor &&right_singular_vectors_adjoint, MatrixTensor &&matrix_work, SvdOptions options={}, std::optional< Precision > requested={})
 Compute a destructive exact SVD through an explicit selector.
 
template<KernelBackendSelector Selector, MutableRankedTensorView< 1 > V, MutableRankedTensorView< 2 > L, MutableRankedTensorView< 2 > R, MutableRankedTensorView< 2 > A>
void uni20::linalg::singular_value_decomposition (Selector &&selector, V &&values, L &&left, R &&right, A &&matrix_work, Precision p, SvdOptions options={})
 Compute a destructive decomposition at explicit precision with optional output settings.
 
template<uni20::MutableRankedTensorView< 1 > SingularValueTensor, uni20::MutableRankedTensorView< 2 > LeftTensor, uni20::MutableRankedTensorView< 2 > RightAdjointTensor, uni20::MutableRankedTensorView< 2 > MatrixTensor>
void uni20::linalg::singular_value_decomposition (SingularValueTensor &&singular_values, LeftTensor &&left_singular_vectors, RightAdjointTensor &&right_singular_vectors_adjoint, MatrixTensor &&matrix_work, SvdOptions options={}, std::optional< Precision > requested={})
 Compute a destructive exact SVD using tensor storage policy.
 
template<MutableRankedTensorView< 1 > V, MutableRankedTensorView< 2 > L, MutableRankedTensorView< 2 > R, MutableRankedTensorView< 2 > A>
void uni20::linalg::singular_value_decomposition (V &&values, L &&left, R &&right, A &&matrix_work, Precision p, SvdOptions options={})
 Compute a destructive decomposition at explicit precision with optional output settings.
 
template<KernelBackendSelector BackendSelector, class MatrixTensor >
requires uni20::OwningTensor<MatrixTensor> && uni20::MutableRankedImmediateTensorView<MatrixTensor, 2> && (!std::is_lvalue_reference_v<MatrixTensor>) && (!std::is_const_v<std::remove_reference_t<MatrixTensor>>)
auto uni20::linalg::singular_values (BackendSelector &&selector, MatrixTensor &&matrix, std::optional< Precision > requested={})
 Consume an owning matrix and return its exact singular values through an explicit selector.
 
template<KernelBackendSelector BackendSelector, uni20::RankedTensorView< 2 > MatrixTensor>
auto uni20::linalg::singular_values (BackendSelector &&selector, MatrixTensor const &matrix, std::optional< Precision > requested={})
 Preserve a matrix and return its exact singular values through an explicit selector.
 
template<class MatrixTensor >
requires uni20::OwningTensor<MatrixTensor> && uni20::MutableRankedImmediateTensorView<MatrixTensor, 2> && (!std::is_lvalue_reference_v<MatrixTensor>) && (!std::is_const_v<std::remove_reference_t<MatrixTensor>>)
auto uni20::linalg::singular_values (MatrixTensor &&matrix, std::optional< Precision > requested={})
 Consume an owning matrix and return its exact singular values.
 
template<uni20::RankedTensorView< 2 > MatrixTensor>
auto uni20::linalg::singular_values (MatrixTensor const &matrix, std::optional< Precision > requested={})
 Preserve a matrix and return its exact singular values.
 
template<KernelBackendSelector BackendSelector, class MatrixTensor >
requires uni20::OwningTensor<MatrixTensor> && uni20::MutableRankedImmediateTensorView<MatrixTensor, 2> && (!std::is_lvalue_reference_v<MatrixTensor>) && (!std::is_const_v<std::remove_reference_t<MatrixTensor>>)
auto uni20::linalg::svd (BackendSelector &&selector, MatrixTensor &&matrix, SvdOptions options={}, std::optional< Precision > requested={})
 Consume an owning matrix and return its exact singular value decomposition.
 
template<KernelBackendSelector BackendSelector, uni20::RankedTensorView< 2 > MatrixTensor>
auto uni20::linalg::svd (BackendSelector &&selector, MatrixTensor const &matrix, SvdOptions options={}, std::optional< Precision > requested={})
 Preserve a matrix and return its exact singular value decomposition through an explicit selector.
 
template<RankedTensorView< 2 > Matrix>
auto uni20::linalg::svd (Matrix &&matrix, Precision p, SvdOptions options={})
 Compute SVD at explicit working precision with optional output settings.
 
template<class MatrixTensor >
requires uni20::OwningTensor<MatrixTensor> && uni20::MutableRankedImmediateTensorView<MatrixTensor, 2> && (!std::is_lvalue_reference_v<MatrixTensor>) && (!std::is_const_v<std::remove_reference_t<MatrixTensor>>)
auto uni20::linalg::svd (MatrixTensor &&matrix, SvdOptions options={}, std::optional< Precision > requested={})
 Consume an owning matrix and return its exact singular value decomposition.
 
template<uni20::RankedTensorView< 2 > MatrixTensor>
auto uni20::linalg::svd (MatrixTensor const &matrix, SvdOptions options={}, std::optional< Precision > requested={})
 Preserve a matrix and return its exact singular value decomposition.
 
template<KernelBackendSelector Selector, RankedTensorView< 2 > Matrix>
auto uni20::linalg::svd (Selector &&selector, Matrix &&matrix, Precision p, SvdOptions options={})
 Compute SVD at explicit working precision with optional output settings.
 
template<KernelBackendSelector BackendSelector, class MatrixTensor >
requires uni20::OwningTensor<MatrixTensor> && uni20::MutableRankedImmediateTensorView<MatrixTensor, 2> && (!std::is_lvalue_reference_v<MatrixTensor>) && (!std::is_const_v<std::remove_reference_t<MatrixTensor>>)
auto uni20::linalg::svd_left (BackendSelector &&selector, MatrixTensor &&matrix, SvdVectorExtent extent=SvdVectorExtent::Reduced, std::optional< Precision > requested={})
 Consume an owning matrix and return exact left singular vectors and singular values.
 
template<KernelBackendSelector BackendSelector, uni20::RankedTensorView< 2 > MatrixTensor>
auto uni20::linalg::svd_left (BackendSelector &&selector, MatrixTensor const &matrix, SvdVectorExtent extent=SvdVectorExtent::Reduced, std::optional< Precision > requested={})
 Preserve a matrix and return exact left singular vectors and singular values.
 
template<RankedTensorView< 2 > Matrix>
auto uni20::linalg::svd_left (Matrix &&matrix, Precision p, SvdVectorExtent extent=SvdVectorExtent::Reduced)
 Compute left SVD factors at explicit working precision with optional output settings.
 
template<class MatrixTensor >
requires uni20::OwningTensor<MatrixTensor> && uni20::MutableRankedImmediateTensorView<MatrixTensor, 2> && (!std::is_lvalue_reference_v<MatrixTensor>) && (!std::is_const_v<std::remove_reference_t<MatrixTensor>>)
auto uni20::linalg::svd_left (MatrixTensor &&matrix, SvdVectorExtent extent=SvdVectorExtent::Reduced, std::optional< Precision > requested={})
 Consume an owning matrix and return exact left singular vectors and singular values.
 
template<uni20::RankedTensorView< 2 > MatrixTensor>
auto uni20::linalg::svd_left (MatrixTensor const &matrix, SvdVectorExtent extent=SvdVectorExtent::Reduced, std::optional< Precision > requested={})
 Preserve a matrix and return exact left singular vectors and singular values.
 
template<KernelBackendSelector Selector, RankedTensorView< 2 > Matrix>
auto uni20::linalg::svd_left (Selector &&selector, Matrix &&matrix, Precision p, SvdVectorExtent extent=SvdVectorExtent::Reduced)
 Compute left SVD factors at explicit working precision with optional output settings.
 
template<KernelBackendSelector BackendSelector, class MatrixTensor >
requires uni20::OwningTensor<MatrixTensor> && uni20::MutableRankedImmediateTensorView<MatrixTensor, 2> && (!std::is_lvalue_reference_v<MatrixTensor>) && (!std::is_const_v<std::remove_reference_t<MatrixTensor>>)
auto uni20::linalg::svd_right (BackendSelector &&selector, MatrixTensor &&matrix, SvdVectorExtent extent=SvdVectorExtent::Reduced, std::optional< Precision > requested={})
 Consume an owning matrix and return exact singular values and right singular vectors.
 
template<KernelBackendSelector BackendSelector, uni20::RankedTensorView< 2 > MatrixTensor>
auto uni20::linalg::svd_right (BackendSelector &&selector, MatrixTensor const &matrix, SvdVectorExtent extent=SvdVectorExtent::Reduced, std::optional< Precision > requested={})
 Preserve a matrix and return exact singular values and right singular vectors.
 
template<RankedTensorView< 2 > Matrix>
auto uni20::linalg::svd_right (Matrix &&matrix, Precision p, SvdVectorExtent extent=SvdVectorExtent::Reduced)
 Compute right SVD factors at explicit working precision with optional output settings.
 
template<class MatrixTensor >
requires uni20::OwningTensor<MatrixTensor> && uni20::MutableRankedImmediateTensorView<MatrixTensor, 2> && (!std::is_lvalue_reference_v<MatrixTensor>) && (!std::is_const_v<std::remove_reference_t<MatrixTensor>>)
auto uni20::linalg::svd_right (MatrixTensor &&matrix, SvdVectorExtent extent=SvdVectorExtent::Reduced, std::optional< Precision > requested={})
 Consume an owning matrix and return exact singular values and right singular vectors.
 
template<uni20::RankedTensorView< 2 > MatrixTensor>
auto uni20::linalg::svd_right (MatrixTensor const &matrix, SvdVectorExtent extent=SvdVectorExtent::Reduced, std::optional< Precision > requested={})
 Preserve a matrix and return exact singular values and right singular vectors.
 
template<KernelBackendSelector Selector, RankedTensorView< 2 > Matrix>
auto uni20::linalg::svd_right (Selector &&selector, Matrix &&matrix, Precision p, SvdVectorExtent extent=SvdVectorExtent::Reduced)
 Compute right SVD factors at explicit working precision with optional output settings.
 

Detailed Description

Destructive and value-producing exact dense singular value decompositions.

Precision may be inferred from the input matrix or supplied explicitly. Fixed results require their native precision; runtime decompositions require finite precision. Owning results record the selected default.