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

Tensor-facing truncated dense singular value decompositions. More...

#include <uni20/common/trace.hpp>
#include <uni20/core/math.hpp>
#include <uni20/linalg/ops/svd.hpp>
#include <uni20/tensor/tensor.hpp>
#include <algorithm>
#include <cstddef>
#include <optional>
#include <span>
#include <type_traits>
#include <utility>
#include <vector>
Include dependency graph for ops/truncated_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::SvdTruncationInfo< Real >
 Statistics describing a completed SVD truncation. More...
 
struct  uni20::linalg::SvdTruncationPolicy< Real >
 Rank-selection policy for a truncated singular value decomposition. More...
 
struct  uni20::linalg::TruncatedSvdResult< LeftTensor, SingularValueTensor, RightAdjointTensor, TruncationInfo >
 Owning factors and statistics returned by truncated_svd. More...
 

Namespaces

namespace  uni20
 
namespace  uni20::linalg
 

Functions

template<uni20::Real Real>
auto uni20::linalg::select_svd_truncation (std::span< Real const > singular_values, SvdTruncationPolicy< Real > const &policy={}) -> SvdTruncationInfo< Real >
 Select a retained prefix from descending 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::truncated_svd (BackendSelector &&selector, MatrixTensor &&matrix, SvdTruncationPolicy< uni20::make_real_t< uni20::tensor_element_t< MatrixTensor > > > policy={}, std::optional< Precision > requested={})
 Consume an owning matrix and return a truncated reduced SVD through an explicit selector.
 
template<KernelBackendSelector BackendSelector, uni20::RankedTensorView< 2 > MatrixTensor>
auto uni20::linalg::truncated_svd (BackendSelector &&selector, MatrixTensor const &matrix, SvdTruncationPolicy< uni20::make_real_t< uni20::tensor_element_t< MatrixTensor > > > policy={}, std::optional< Precision > requested={})
 Preserve a matrix and return a truncated reduced SVD through an explicit selector.
 
template<RankedTensorView< 2 > Matrix>
auto uni20::linalg::truncated_svd (Matrix &&matrix, Precision p, SvdTruncationPolicy< make_real_t< tensor_element_t< Matrix > > > policy={})
 Compute and truncate at explicit working precision; cutoff scalars retain their precision rules.
 
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::truncated_svd (MatrixTensor &&matrix, SvdTruncationPolicy< uni20::make_real_t< uni20::tensor_element_t< MatrixTensor > > > policy={}, std::optional< Precision > requested={})
 Consume an owning matrix and return a truncated reduced SVD.
 
template<uni20::RankedTensorView< 2 > MatrixTensor>
auto uni20::linalg::truncated_svd (MatrixTensor const &matrix, SvdTruncationPolicy< uni20::make_real_t< uni20::tensor_element_t< MatrixTensor > > > policy={}, std::optional< Precision > requested={})
 Preserve a matrix and return a truncated reduced SVD.
 
template<KernelBackendSelector Selector, RankedTensorView< 2 > Matrix>
auto uni20::linalg::truncated_svd (Selector &&selector, Matrix &&matrix, Precision p, SvdTruncationPolicy< make_real_t< tensor_element_t< Matrix > > > policy={})
 Compute and truncate at explicit working precision; cutoff scalars retain their precision rules.
 

Detailed Description

Tensor-facing truncated 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.