From 1396e087637334e5b025dd504dc22b6a76bf6e83 Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Fri, 29 May 2026 18:59:41 -0400 Subject: [PATCH 1/2] Remove redundant contractopadd!_matricize helper The `contractopadd!(::Matricize, ...)` method only forwarded its arguments to the `contractopadd!_matricize` helper, which did the actual work. The indirection added no value and was a source of confusion, so inline the helper body into the `Matricize` dispatch method and delete the helper. Co-Authored-By: Claude Opus 4.8 (1M context) --- Project.toml | 2 +- src/contract/contract_matricize.jl | 28 ++++++---------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/Project.toml b/Project.toml index 91fbc88..3fb43fe 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "TensorAlgebra" uuid = "68bd88dc-f39d-4e12-b2ca-f046b68fcc6a" -version = "0.9.3" +version = "0.9.4" authors = ["ITensor developers and contributors"] [workspace] diff --git a/src/contract/contract_matricize.jl b/src/contract/contract_matricize.jl index ed31bcf..d1cf196 100644 --- a/src/contract/contract_matricize.jl +++ b/src/contract/contract_matricize.jl @@ -7,33 +7,17 @@ function contractopadd!( op2, a2::AbstractArray, biperm2_codomain, biperm2_domain, α::Number, β::Number ) - return contractopadd!_matricize( - algorithm, - a_dest, biperm_dest_codomain, biperm_dest_domain, - op1, a1, biperm1_codomain, biperm1_domain, - op2, a2, biperm2_codomain, biperm2_domain, - α, β - ) -end - -function contractopadd!_matricize( - algorithm::Matricize, - a_dest::AbstractArray, perm_dest_codomain, perm_dest_domain, - op1, a1::AbstractArray, perm1_codomain, perm1_domain, - op2, a2::AbstractArray, perm2_codomain, perm2_domain, - α::Number, β::Number - ) - perm_dest = (perm_dest_codomain..., perm_dest_domain...) + biperm_dest = (biperm_dest_codomain..., biperm_dest_domain...) invperm_codomain, invperm_domain = - blocks(biperm(invperm(perm_dest), length(perm1_codomain))) + blocks(biperm(invperm(biperm_dest), length(biperm1_codomain))) check_input( contract!, a_dest, invperm_codomain, invperm_domain, - a1, perm1_codomain, perm1_domain, - a2, perm2_codomain, perm2_domain + a1, biperm1_codomain, biperm1_domain, + a2, biperm2_codomain, biperm2_domain ) - a1_mat = matricizeop(algorithm.fusion_style, op1, a1, perm1_codomain, perm1_domain) - a2_mat = matricizeop(algorithm.fusion_style, op2, a2, perm2_codomain, perm2_domain) + a1_mat = matricizeop(algorithm.fusion_style, op1, a1, biperm1_codomain, biperm1_domain) + a2_mat = matricizeop(algorithm.fusion_style, op2, a2, biperm2_codomain, biperm2_domain) a_dest_mat = a1_mat * a2_mat unmatricizeadd!( algorithm.fusion_style, a_dest, a_dest_mat, invperm_codomain, invperm_domain, α, β From 64cc1efd21895f5a56f3de3cc63eeb71d19e6bef Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Fri, 29 May 2026 20:13:51 -0400 Subject: [PATCH 2/2] Remove now-unused mul! import The `using LinearAlgebra: mul!` import in contract_matricize.jl is no longer referenced after the helper cleanup; the only other use of mul! in the package is qualified as `LA.mul!`. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/contract/contract_matricize.jl | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/contract/contract_matricize.jl b/src/contract/contract_matricize.jl index d1cf196..237cb0b 100644 --- a/src/contract/contract_matricize.jl +++ b/src/contract/contract_matricize.jl @@ -1,5 +1,3 @@ -using LinearAlgebra: mul! - function contractopadd!( algorithm::Matricize, a_dest::AbstractArray, biperm_dest_codomain, biperm_dest_domain,