From adc7fbee8cefca034a78537259588130d8b181a4 Mon Sep 17 00:00:00 2001 From: mtfishman Date: Fri, 12 Sep 2025 10:36:39 -0400 Subject: [PATCH 1/3] Update to TensorAlgebra 0.4 --- Project.toml | 6 +++--- src/fusiontensor/tensor_algebra_interface.jl | 5 ++--- test/Project.toml | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Project.toml b/Project.toml index 79d953e..aea1aab 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "FusionTensors" uuid = "e16ca583-1f51-4df0-8e12-57d32947d33e" authors = ["ITensor developers and contributors"] -version = "0.5.7" +version = "0.5.8" [deps] Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697" @@ -21,14 +21,14 @@ WignerSymbols = "9f57e263-0b3d-5e2e-b1be-24f2bb48858b" [compat] Accessors = "0.1.42" BlockArrays = "1.7" -BlockSparseArrays = "0.8, 0.9" +BlockSparseArrays = "0.10" GradedArrays = "0.4.14" HalfIntegers = "1.6" LRUCache = "1.6" LinearAlgebra = "1.10" Random = "1.10" Strided = "2.3" -TensorAlgebra = "0.3.8" +TensorAlgebra = "0.4" TensorProducts = "0.1.7" TypeParameterAccessors = "0.4" WignerSymbols = "2.0.0" diff --git a/src/fusiontensor/tensor_algebra_interface.jl b/src/fusiontensor/tensor_algebra_interface.jl index 3129fa5..89f3618 100644 --- a/src/fusiontensor/tensor_algebra_interface.jl +++ b/src/fusiontensor/tensor_algebra_interface.jl @@ -15,13 +15,12 @@ function TensorAlgebra.allocate_output( biperm1::BlockedPermutation{2}, a2::FusionTensor, biperm2::BlockedPermutation{2}, - α::Number=true, ) axes_dest = ( map(i -> axes(a1)[i], first(blocks(biperm1))), map(i -> axes(a2)[i], last(blocks(biperm2))), ) - return similar(a1, promote_type(eltype(a1), eltype(a2), typeof(α)), axes_dest) + return similar(a1, promote_type(eltype(a1), eltype(a2)), axes_dest) end # TBD do really I need to define these as I cannot use them in contract! and has to redefine it? @@ -32,7 +31,7 @@ end # I cannot use contract! from TensorAlgebra/src/contract/contract_matricize/contract.jl # as it calls _mul!, which I should not overload. # TBD define fallback _mul!(::AbstractArray, ::AbstractArray, ::AbstractArray) in TensorAlgebra? -function TensorAlgebra.contract!( +function TensorAlgebra.contractadd!( ::Matricize, a_dest::FusionTensor, ::BlockedPermutation{2}, diff --git a/test/Project.toml b/test/Project.toml index e2eb1d4..268e23a 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -15,13 +15,13 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] Aqua = "0.8.11" BlockArrays = "1.6" -BlockSparseArrays = "0.8, 0.9" +BlockSparseArrays = "0.10" FusionTensors = "0.5" GradedArrays = "0.4" LinearAlgebra = "1.10.0" Random = "1.10" SafeTestsets = "0.1.0" Suppressor = "0.2.8" -TensorAlgebra = "0.3" +TensorAlgebra = "0.4" TensorProducts = "0.1" Test = "1.10.0" From 1c8db08685021bc5d0ed8afc289d311f33ba5fe1 Mon Sep 17 00:00:00 2001 From: Matt Fishman Date: Thu, 25 Sep 2025 16:12:05 -0400 Subject: [PATCH 2/3] Normalize result in contract function Refactor contract function to normalize result by dim_sec. --- src/fusiontensor/array_cast.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fusiontensor/array_cast.jl b/src/fusiontensor/array_cast.jl index 56bbe1b..e505f19 100644 --- a/src/fusiontensor/array_cast.jl +++ b/src/fusiontensor/array_cast.jl @@ -151,14 +151,16 @@ function contract_fusion_trees( # \___________| \___________| # \ | # \----------------dim_sec---------------- / - return contract( + res = contract( ntuple(i -> 2 * i - 1, N), split_array_block, ntuple(identity, 2 * N), p, ntuple(i -> 2 * i, N), - 1 / dim_sec, # normalization factor ) + # normalization factor + res ./= dim_sec + return res end function contract_singlet_projector(f1::SectorFusionTree, f2::SectorFusionTree) From 3250b45f4add794d19459f080103f89c31923c9e Mon Sep 17 00:00:00 2001 From: Matt Fishman Date: Thu, 25 Sep 2025 16:14:08 -0400 Subject: [PATCH 3/3] Bump version from 0.5.8 to 0.5.9 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index aea1aab..224b4b5 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "FusionTensors" uuid = "e16ca583-1f51-4df0-8e12-57d32947d33e" authors = ["ITensor developers and contributors"] -version = "0.5.8" +version = "0.5.9" [deps] Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"