From 4b5294d383be4c5e3282ee828ff73e9fd034d5ec Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Fri, 3 Oct 2025 19:23:13 -0400 Subject: [PATCH 1/3] update truncation deprecations --- src/auxiliary/deprecate.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/auxiliary/deprecate.jl b/src/auxiliary/deprecate.jl index 5853cad01..4fb653244 100644 --- a/src/auxiliary/deprecate.jl +++ b/src/auxiliary/deprecate.jl @@ -56,7 +56,8 @@ Base.@deprecate insertunit(P::ProductSpace, args...; kwargs...) insertleftunit(a # truncations const TruncationScheme = MatrixAlgebraKit.TruncationStrategy @deprecate truncdim(d::Int) truncrank(d) -@deprecate truncbelow(ϵ::Real) trunctol(ϵ) +@deprecate truncbelow(ϵ::Real) trunctol(; atol = ϵ) +@deprecate truncerr(ϵ::Real) truncerror(ϵ) # factorizations # -------------- From 9d5c34dab88fae12bdfa3c6c7bfb412faee1010c Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Fri, 3 Oct 2025 19:41:39 -0400 Subject: [PATCH 2/3] fix typo in depwarn --- src/auxiliary/deprecate.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/auxiliary/deprecate.jl b/src/auxiliary/deprecate.jl index 4fb653244..a37c40531 100644 --- a/src/auxiliary/deprecate.jl +++ b/src/auxiliary/deprecate.jl @@ -132,7 +132,7 @@ function rightnull(t::AbstractTensorMap, p::Index2Tuple; kwargs...) return rightnull!(permutedcopy_oftype(t, factorisation_scalartype(rightnull, t), p); kwargs...) end function leftnull!(t::AbstractTensorMap; kwargs...) - Base.depwarn("`left_null!` is deprecated, use `left_null!` instead", :leftnull!) + Base.depwarn("`leftnull!` is deprecated, use `left_null!` instead", :leftnull!) haskey(kwargs, :alg) || return left_null!(t; kwargs...) alg = kwargs[:alg] kind = _kindof(alg) From 7c7a6a0f879ea3f424c0048cc2a14dfbe2853ba5 Mon Sep 17 00:00:00 2001 From: Lukas Devos Date: Sun, 5 Oct 2025 17:59:39 -0400 Subject: [PATCH 3/3] fix `truncrank` when no value is truncated --- src/factorizations/truncation.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/factorizations/truncation.jl b/src/factorizations/truncation.jl index a2faaf50a..5799ff3c6 100644 --- a/src/factorizations/truncation.jl +++ b/src/factorizations/truncation.jl @@ -165,14 +165,13 @@ function MAK.findtruncated_svd(values::SectorDict, strategy::TruncationByOrder) I = keytype(values) truncdim = SectorDict{I, Int}(c => length(d) for (c, d) in values) totaldim = sum(dim(c) * d for (c, d) in truncdim; init = 0) - while true + while totaldim > strategy.howmany next = _findnexttruncvalue(values, truncdim; strategy.by, strategy.rev) isnothing(next) && break _, cmin = next truncdim[cmin] -= 1 totaldim -= dim(cmin) truncdim[cmin] == 0 && delete!(truncdim, cmin) - totaldim <= strategy.howmany && break end return SectorDict(c => Base.OneTo(d) for (c, d) in truncdim) end