From 911eb6a1cee3816644a5265e910c8ee6ed817a84 Mon Sep 17 00:00:00 2001 From: CompatHelper Julia Date: Fri, 10 Oct 2025 00:54:35 +0000 Subject: [PATCH 1/6] CompatHelper: bump compat for GradedArrays in [weakdeps] to 0.5, (keep existing compat) --- Project.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 2ae50cc..152cd60 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "QuantumOperatorDefinitions" uuid = "826dd319-6fd5-459a-a990-3a4f214664bf" authors = ["ITensor developers and contributors"] -version = "0.2.9" +version = "0.2.10" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -19,7 +19,7 @@ QuantumOperatorDefinitionsITensorBaseExt = ["ITensorBase", "GradedArrays", "Name [compat] BlockArrays = "1.3.0" -GradedArrays = "0.4" +GradedArrays = "0.4, 0.5" ITensorBase = "0.2, 0.3" LinearAlgebra = "1.10" NamedDimsArrays = "0.7, 0.8" From fb2ef49760cff0925019231c6ce39b6ec4d29e65 Mon Sep 17 00:00:00 2001 From: Matt Fishman Date: Fri, 10 Oct 2025 09:48:10 -0400 Subject: [PATCH 2/6] Update GradedArrays compatibility version --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index 7e383bf..70a87e9 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -16,7 +16,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Aqua = "0.8.9" BlockArrays = "1" BlockSparseArrays = "0.8, 0.9, 0.10" -GradedArrays = "0.4" +GradedArrays = "0.4, 0.5" ITensorBase = "0.2, 0.3" NamedDimsArrays = "0.7, 0.8" QuantumOperatorDefinitions = "0.2" From 4264ffc6780c6c8118b8d3905c6e39a7525feb08 Mon Sep 17 00:00:00 2001 From: Matt Fishman Date: Fri, 10 Oct 2025 15:16:58 -0400 Subject: [PATCH 3/6] Change SectorProduct to sectorproduct --- .../QuantumOperatorDefinitionsGradedArraysExt.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ext/QuantumOperatorDefinitionsGradedArraysExt/QuantumOperatorDefinitionsGradedArraysExt.jl b/ext/QuantumOperatorDefinitionsGradedArraysExt/QuantumOperatorDefinitionsGradedArraysExt.jl index c913b71..bf9a514 100644 --- a/ext/QuantumOperatorDefinitionsGradedArraysExt/QuantumOperatorDefinitionsGradedArraysExt.jl +++ b/ext/QuantumOperatorDefinitionsGradedArraysExt/QuantumOperatorDefinitionsGradedArraysExt.jl @@ -2,7 +2,7 @@ module QuantumOperatorDefinitionsGradedArraysExt using BlockArrays: blocklasts, blocklength, blocklengths using GradedArrays: - AbstractGradedUnitRange, GradedOneTo, SectorProduct, U1, Z, ×, dual, gradedrange, sectors + AbstractGradedUnitRange, GradedOneTo, U1, Z, ×, dual, gradedrange, sectorproduct, sectors using QuantumOperatorDefinitions: QuantumOperatorDefinitions, @GradingType_str, @@ -34,21 +34,21 @@ QuantumOperatorDefinitions.combine_axes(a::GradedOneTo, b::Base.OneTo) = a QuantumOperatorDefinitions.combine_axes(a::Base.OneTo, b::GradedOneTo) = b function Base.AbstractUnitRange(::GradingType"N", t::SiteType) - return gradedrange(map(i -> SectorProduct((; N = U1(i - 1))) => 1, 1:length(t))) + return gradedrange(map(i -> sectorproduct((; N = U1(i - 1))) => 1, 1:length(t))) end function Base.AbstractUnitRange(::GradingType"Sz", t::SiteType) - return gradedrange(map(i -> SectorProduct((; Sz = U1(i - 1))) => 1, 1:length(t))) + return gradedrange(map(i -> sectorproduct((; Sz = U1(i - 1))) => 1, 1:length(t))) end function Base.AbstractUnitRange(::GradingType"Sz↑", t::SiteType) return AbstractUnitRange(GradingType"Sz"(), t) end function Base.AbstractUnitRange(::GradingType"Sz↓", t::SiteType) - return gradedrange(map(i -> SectorProduct((; Sz = U1(-(i - 1)))) => 1, 1:length(t))) + return gradedrange(map(i -> sectorproduct((; Sz = U1(-(i - 1)))) => 1, 1:length(t))) end function sector(gradingtype::GradingType, sec) sectorname = Symbol(get(gradingtype, :name, name(gradingtype))) - return SectorProduct(NamedTuple{(sectorname,)}((sec,))) + return sectorproduct(NamedTuple{(sectorname,)}((sec,))) end function Base.AbstractUnitRange(s::GradingType"Nf", t::SiteType"Fermion") From 9c5ebe02527d9783ab7083b4f850dc64a30d7c93 Mon Sep 17 00:00:00 2001 From: Matt Fishman Date: Fri, 10 Oct 2025 15:17:19 -0400 Subject: [PATCH 4/6] Apply suggestion from @mtfishman --- test/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Project.toml b/test/Project.toml index 70a87e9..f794177 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -16,7 +16,7 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Aqua = "0.8.9" BlockArrays = "1" BlockSparseArrays = "0.8, 0.9, 0.10" -GradedArrays = "0.4, 0.5" +GradedArrays = "0.5" ITensorBase = "0.2, 0.3" NamedDimsArrays = "0.7, 0.8" QuantumOperatorDefinitions = "0.2" From 2f2fd5dffb4a195463de60888a16d195610119ac Mon Sep 17 00:00:00 2001 From: Matt Fishman Date: Fri, 10 Oct 2025 15:17:40 -0400 Subject: [PATCH 5/6] Apply suggestion from @mtfishman --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 152cd60..9c27ec5 100644 --- a/Project.toml +++ b/Project.toml @@ -19,7 +19,7 @@ QuantumOperatorDefinitionsITensorBaseExt = ["ITensorBase", "GradedArrays", "Name [compat] BlockArrays = "1.3.0" -GradedArrays = "0.4, 0.5" +GradedArrays = "0.5" ITensorBase = "0.2, 0.3" LinearAlgebra = "1.10" NamedDimsArrays = "0.7, 0.8" From 26668e306047075ae20832d4907cc8c9bbbddf0b Mon Sep 17 00:00:00 2001 From: Matt Fishman Date: Fri, 10 Oct 2025 15:19:24 -0400 Subject: [PATCH 6/6] Replace SectorProduct with sectorproduct in tests --- test/test_gradedarraysext.jl | 44 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/test/test_gradedarraysext.jl b/test/test_gradedarraysext.jl index f95bbd9..66c807c 100644 --- a/test/test_gradedarraysext.jl +++ b/test/test_gradedarraysext.jl @@ -1,6 +1,6 @@ using BlockArrays: AbstractBlockArray, blocklengths using BlockSparseArrays: BlockSparseArray -using GradedArrays: SectorProduct, U1, Z, dual, isdual, sectors +using GradedArrays: U1, Z, dual, isdual, sectorproduct, sectors using ITensorBase: ITensor, Index, gettag, prime, settag using NamedDimsArrays: dename using QuantumOperatorDefinitions: OpName, SiteType, StateName, op, state @@ -10,17 +10,17 @@ using Test: @test, @testset t = SiteType("S=1/2"; gradings = ("Sz",)) r = AbstractUnitRange(t) @test r == 1:2 - @test sectors(r) == [SectorProduct((; Sz = U1(0))), SectorProduct((; Sz = U1(1)))] + @test sectors(r) == [sectorproduct((; Sz = U1(0))), sectorproduct((; Sz = U1(1)))] @test blocklengths(r) == [1, 1] t = SiteType("Electron"; gradings = ("Nf", "Sz")) r = AbstractUnitRange(t) @test r == 1:4 @test sectors(r) == [ - SectorProduct((; Nf = U1(0), Sz = U1(0))), - SectorProduct((; Nf = U1(1), Sz = U1(1))), - SectorProduct((; Nf = U1(1), Sz = U1(-1))), - SectorProduct((; Nf = U1(2), Sz = U1(0))), + sectorproduct((; Nf = U1(0), Sz = U1(0))), + sectorproduct((; Nf = U1(1), Sz = U1(1))), + sectorproduct((; Nf = U1(1), Sz = U1(-1))), + sectorproduct((; Nf = U1(2), Sz = U1(0))), ] @test blocklengths(r) == [1, 1, 1, 1] @@ -28,10 +28,10 @@ using Test: @test, @testset r = AbstractUnitRange(t) @test r == 1:4 @test sectors(r) == [ - SectorProduct((; NfA = U1(0), SzA = U1(0))), - SectorProduct((; NfA = U1(1), SzA = U1(1))), - SectorProduct((; NfA = U1(1), SzA = U1(-1))), - SectorProduct((; NfA = U1(2), SzA = U1(0))), + sectorproduct((; NfA = U1(0), SzA = U1(0))), + sectorproduct((; NfA = U1(1), SzA = U1(1))), + sectorproduct((; NfA = U1(1), SzA = U1(-1))), + sectorproduct((; NfA = U1(2), SzA = U1(0))), ] @test blocklengths(r) == [1, 1, 1, 1] @@ -39,18 +39,18 @@ using Test: @test, @testset r = AbstractUnitRange(t) @test r == 1:4 @test sectors(r) == [ - SectorProduct((; NfParity = Z{2}(0), Sz = U1(0))), - SectorProduct((; NfParity = Z{2}(1), Sz = U1(1))), - SectorProduct((; NfParity = Z{2}(1), Sz = U1(-1))), - SectorProduct((; NfParity = Z{2}(0), Sz = U1(0))), + sectorproduct((; NfParity = Z{2}(0), Sz = U1(0))), + sectorproduct((; NfParity = Z{2}(1), Sz = U1(1))), + sectorproduct((; NfParity = Z{2}(1), Sz = U1(-1))), + sectorproduct((; NfParity = Z{2}(0), Sz = U1(0))), ] @test blocklengths(r) == [1, 1, 1, 1] t = SiteType("S=1/2"; gradings = ("Sz",)) (r1, r2) = axes(OpName("σ⁺"), (t,)) - @test sectors(r1) == [SectorProduct((; Sz = U1(0))), SectorProduct((; Sz = U1(1)))] + @test sectors(r1) == [sectorproduct((; Sz = U1(0))), sectorproduct((; Sz = U1(1)))] @test blocklengths(r1) == [1, 1] - @test sectors(r2) == [SectorProduct((; Sz = U1(0))), SectorProduct((; Sz = U1(1)))] + @test sectors(r2) == [sectorproduct((; Sz = U1(0))), sectorproduct((; Sz = U1(1)))] @test blocklengths(r2) == [1, 1] t = SiteType("S=1/2"; gradings = ("Sz",)) @@ -63,7 +63,7 @@ using Test: @test, @testset @test a == [2, 0] @test a isa BlockSparseArray (r1,) = axes(a) - @test sectors(r1) == [SectorProduct((; Sz = U1(0))), SectorProduct((; Sz = U1(1)))] + @test sectors(r1) == [sectorproduct((; Sz = U1(0))), sectorproduct((; Sz = U1(1)))] @test blocklengths(r1) == [1, 1] t = SiteType("S=1/2"; gradings = ("Sz",)) @@ -71,9 +71,9 @@ using Test: @test, @testset @test a == [0 2; 0 0] @test a isa BlockSparseArray (r1, r2) = axes(a) - @test sectors(r1) == [SectorProduct((; Sz = U1(0))), SectorProduct((; Sz = U1(1)))] + @test sectors(r1) == [sectorproduct((; Sz = U1(0))), sectorproduct((; Sz = U1(1)))] @test blocklengths(r1) == [1, 1] - @test sectors(r2) == [SectorProduct((; Sz = U1(0))), SectorProduct((; Sz = U1(1)))] + @test sectors(r2) == [sectorproduct((; Sz = U1(0))), sectorproduct((; Sz = U1(1)))] @test blocklengths(r2) == [1, 1] end @@ -82,7 +82,7 @@ end @test gettag(i, "sitetype") == "S=1/2" # TODO: Test without denaming. @test dename(i) == 1:2 - @test sectors(dename(i)) == [SectorProduct((; Sz = U1(0))), SectorProduct((; Sz = U1(1)))] + @test sectors(dename(i)) == [sectorproduct((; Sz = U1(0))), sectorproduct((; Sz = U1(1)))] @test blocklengths(dename(i)) == [1, 1] i′ = prime(i) @@ -93,8 +93,8 @@ end @test a′ isa BlockSparseArray # TODO: Test these without denaming `a`. (r1, r2) = axes(a′) - @test sectors(r1) == [SectorProduct((; Sz = U1(0))), SectorProduct((; Sz = U1(1)))] + @test sectors(r1) == [sectorproduct((; Sz = U1(0))), sectorproduct((; Sz = U1(1)))] @test blocklengths(r1) == [1, 1] - @test sectors(r2) == [SectorProduct((; Sz = U1(0))), SectorProduct((; Sz = U1(1)))] + @test sectors(r2) == [sectorproduct((; Sz = U1(0))), sectorproduct((; Sz = U1(1)))] @test blocklengths(r2) == [1, 1] end