From 9b53ddf41727f3a51363e46dce7d70c22868313b Mon Sep 17 00:00:00 2001 From: lkdvos Date: Thu, 9 Oct 2025 20:18:09 -0400 Subject: [PATCH 1/2] some more small truncation fixes --- src/factorizations/truncation.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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)...) ) From d70408038cea679ea2d3ae56c5283e37364587b4 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Fri, 10 Oct 2025 10:27:55 -0400 Subject: [PATCH 2/2] add tests --- test/factorizations.jl | 8 ++++++++ 1 file changed, 8 insertions(+) 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