|
2 | 2 | # --------- |
3 | 3 | # Generic implementation: `findtruncated` followed by indexing |
4 | 4 | function truncate!(::typeof(svd_trunc!), (U, S, Vᴴ), strategy::TruncationStrategy) |
5 | | - ind = findtruncated_sorted(diagview(S), strategy) |
| 5 | + ind = findtruncated_svd(diagview(S), strategy) |
6 | 6 | return U[:, ind], Diagonal(diagview(S)[ind]), Vᴴ[ind, :] |
7 | 7 | end |
8 | 8 | function truncate!(::typeof(eig_trunc!), (D, V), strategy::TruncationStrategy) |
|
29 | 29 | # findtruncated |
30 | 30 | # ------------- |
31 | 31 | # Generic fallback |
32 | | -function findtruncated_sorted(values::AbstractVector, strategy::TruncationStrategy) |
| 32 | +function findtruncated_svd(values::AbstractVector, strategy::TruncationStrategy) |
33 | 33 | return findtruncated(values, strategy) |
34 | 34 | end |
35 | 35 |
|
@@ -79,7 +79,7 @@ function findtruncated(values::AbstractVector, strategy::TruncationByError) |
79 | 79 | I′ = _truncerr_impl(values, I; strategy.atol, strategy.rtol, strategy.p) |
80 | 80 | return I[I′] |
81 | 81 | end |
82 | | -function findtruncated_sorted(values::AbstractVector, strategy::TruncationByError) |
| 82 | +function findtruncated_svd(values::AbstractVector, strategy::TruncationByError) |
83 | 83 | I = eachindex(values) |
84 | 84 | I′ = _truncerr_impl(values, I; strategy.atol, strategy.rtol, strategy.p) |
85 | 85 | return I[I′] |
@@ -107,8 +107,8 @@ function findtruncated(values::AbstractVector, strategy::TruncationIntersection) |
107 | 107 | return mapreduce(Base.Fix1(findtruncated, values), _ind_intersect, strategy.components; |
108 | 108 | init=trues(length(values))) |
109 | 109 | end |
110 | | -function findtruncated_sorted(values::AbstractVector, strategy::TruncationIntersection) |
111 | | - return mapreduce(Base.Fix1(findtruncated_sorted, values), _ind_intersect, |
| 110 | +function findtruncated_svd(values::AbstractVector, strategy::TruncationIntersection) |
| 111 | + return mapreduce(Base.Fix1(findtruncated_svd, values), _ind_intersect, |
112 | 112 | strategy.components; init=trues(length(values))) |
113 | 113 | end |
114 | 114 |
|
|
0 commit comments