diff --git a/src/factorizations/truncation.jl b/src/factorizations/truncation.jl index 5799ff3c6..19f39759c 100644 --- a/src/factorizations/truncation.jl +++ b/src/factorizations/truncation.jl @@ -225,19 +225,19 @@ function MAK.findtruncated_svd(values::SectorDict, strategy::TruncationSpace) end function MAK.findtruncated(values::SectorDict, strategy::TruncationIntersection) - inds = map(Base.Fix1(MAK.findtruncated, values), strategy) + inds = map(Base.Fix1(MAK.findtruncated, values), strategy.components) return SectorDict( c => mapreduce( - Base.Fix2(getindex, c), _ind_intersect, inds; + Base.Fix2(getindex, c), MatrixAlgebraKit._ind_intersect, inds; init = trues(length(values[c])) ) for c in intersect(map(keys, inds)...) ) end -function MAK.findtruncated_svd(Sd::SectorDict, strategy::TruncationIntersection) - inds = map(Base.Fix1(MAK.findtruncated_svd, Sd), strategy) +function MAK.findtruncated_svd(values::SectorDict, strategy::TruncationIntersection) + inds = map(Base.Fix1(MAK.findtruncated_svd, values), strategy.components) return SectorDict( c => mapreduce( - Base.Fix2(getindex, c), _ind_intersect, inds; + Base.Fix2(getindex, c), MatrixAlgebraKit._ind_intersect, inds; init = trues(length(values[c])) ) for c in intersect(map(keys, inds)...) ) diff --git a/test/factorizations.jl b/test/factorizations.jl index 15e4845d0..294cbdf60 100644 --- a/test/factorizations.jl +++ b/test/factorizations.jl @@ -260,6 +260,14 @@ for V in spacelist @test isisometry(U4) @test isisometry(Vᴴ4; side = :right) @test norm(t - U4 * S4 * Vᴴ4) <= 0.5 + + trunc = truncrank(dim(domain(S)) ÷ 2) & trunctol(; atol = λ - 10eps(λ)) + U5, S5, Vᴴ5 = @constinferred svd_trunc(t; trunc) + @test t * Vᴴ5' ≈ U5 * S5 + @test isisometry(U5) + @test isisometry(Vᴴ5; side = :right) + @test minimum(minimum, values(LinearAlgebra.diag(S5))) >= λ + @test dim(domain(S5)) ≤ dim(domain(S)) ÷ 2 end end