From 9cb97530f815b82795c351c2119708ee6c165b16 Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Tue, 30 Jun 2026 14:55:18 -0400 Subject: [PATCH 1/4] Drop BlockArrays extension and support TensorAlgebra 0.14 Removes the `BlockArrays` extension along with its tests, since there is no current need to wrap `BlockArrays` types directly, and raises the `TensorAlgebra` compat bound to 0.14 (https://github.com/ITensor/TensorAlgebra.jl/pull/194). --- Project.toml | 11 ++-- .../ITensorBaseBlockArraysExt.jl | 56 ------------------- test/Project.toml | 4 +- test/test_blockarraysext.jl | 39 ------------- 4 files changed, 7 insertions(+), 103 deletions(-) delete mode 100644 ext/ITensorBaseBlockArraysExt/ITensorBaseBlockArraysExt.jl delete mode 100644 test/test_blockarraysext.jl diff --git a/Project.toml b/Project.toml index 537dc3d..20d4ede 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ITensorBase" uuid = "4795dd04-0d67-49bb-8f44-b89c448a1dc7" -version = "0.9.1" +version = "0.9.2" authors = ["ITensor developers and contributors"] [workspace] @@ -27,13 +27,15 @@ WrappedUnions = "325db55a-9c6c-5b90-b1a2-ec87e7a38c44" [weakdeps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" +[sources.TensorAlgebra] +rev = "mf/inline-strided-permute" +url = "https://github.com/ITensor/TensorAlgebra.jl" + [extensions] ITensorBaseAdaptExt = "Adapt" -ITensorBaseBlockArraysExt = "BlockArrays" ITensorBaseMooncakeExt = "Mooncake" ITensorBaseTensorOperationsExt = "TensorOperations" @@ -42,7 +44,6 @@ AbstractTrees = "0.4.5" Accessors = "0.1.39" Adapt = "4.1.1" ArrayLayouts = "1.11" -BlockArrays = "1.3" Combinatorics = "1" Compat = "4.16" ConstructionBase = "1.6" @@ -52,7 +53,7 @@ Mooncake = "0.4.202, 0.5" OrderedCollections = "1.6" Random = "1.10" SimpleTraits = "0.9.4" -TensorAlgebra = "0.13.4" +TensorAlgebra = "0.14" TensorOperations = "5.3.1" TermInterface = "2" TupleTools = "1.6" diff --git a/ext/ITensorBaseBlockArraysExt/ITensorBaseBlockArraysExt.jl b/ext/ITensorBaseBlockArraysExt/ITensorBaseBlockArraysExt.jl deleted file mode 100644 index 743d407..0000000 --- a/ext/ITensorBaseBlockArraysExt/ITensorBaseBlockArraysExt.jl +++ /dev/null @@ -1,56 +0,0 @@ -module ITensorBaseBlockArraysExt -using ArrayLayouts: ArrayLayouts -using BlockArrays: Block, BlockRange -using ITensorBase: AbstractNamedTensor, NamedUnitRange, getindex_named, view_nameddims - -# These methods disambiguate named-range block indexing from `BlockArrays`' generic -# `AbstractArray` block-indexing methods. -function Base.getindex(r::NamedUnitRange, I::Block{1}) - # TODO: Use `Derive.@interface NamedArrayInterface() r[I]` instead. - return getindex_named(r, I) -end - -function Base.getindex(r::NamedUnitRange, I::BlockRange{1}) - # TODO: Use `Derive.@interface NamedArrayInterface() r[I]` instead. - return getindex_named(r, I) -end - -const BlockIndex{N} = Union{Block{N}, BlockRange{N}, AbstractVector{<:Block{N}}} - -function Base.view(a::AbstractNamedTensor, I1::Block{1}, Irest::BlockIndex{1}...) - # TODO: Use `Derive.@interface ITensorInterface() r[I]` instead. - return view_nameddims(a, I1, Irest...) -end - -function Base.view(a::AbstractNamedTensor, I::Block) - # TODO: Use `Derive.@interface ITensorInterface() r[I]` instead. - return view_nameddims(a, Tuple(I)...) -end - -function Base.view(a::AbstractNamedTensor, I1::BlockIndex{1}, Irest::BlockIndex{1}...) - # TODO: Use `Derive.@interface ITensorInterface() r[I]` instead. - return view_nameddims(a, I1, Irest...) -end - -# Fix ambiguity error. -function Base.getindex( - a::AbstractNamedTensor, I1::BlockRange{1}, Irest::BlockRange{1}... - ) - return ArrayLayouts.layout_getindex(a, I1, Irest...) -end - -# Fix ambiguity errors. -function Base.getindex(a::AbstractNamedTensor, I1::Block{1}, Irest...) - return copy(view(a, I1, Irest...)) -end -function Base.getindex(a::AbstractNamedTensor, I1::AbstractVector, I2::Block{1}) - return copy(view(a, I1, I2)) -end -function Base.getindex(a::AbstractNamedTensor, I1::Block{1}, I2::AbstractVector) - return copy(view(a, I1, I2)) -end -function Base.getindex(a::AbstractNamedTensor, I::Block{N}) where {N} - return copy(view(a, I)) -end - -end diff --git a/test/Project.toml b/test/Project.toml index 6cc5237..d7b94ed 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -2,7 +2,6 @@ AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" -BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" ITensorBase = "4795dd04-0d67-49bb-8f44-b89c448a1dc7" ITensorPkgSkeleton = "3d388ab1-018a-49f4-ae50-18094d5f71ea" @@ -29,7 +28,6 @@ path = ".." AbstractTrees = "0.4.5" Adapt = "4" Aqua = "0.8.9" -BlockArrays = "1" Combinatorics = "1" ITensorBase = "0.9" ITensorPkgSkeleton = "0.3.42" @@ -41,7 +39,7 @@ Random = "1.10" SafeTestsets = "0.1" StableRNGs = "1" Suppressor = "0.2" -TensorAlgebra = "0.12.4, 0.13" +TensorAlgebra = "0.14" TensorOperations = "5.3.1" TermInterface = "2" Test = "1.10" diff --git a/test/test_blockarraysext.jl b/test/test_blockarraysext.jl deleted file mode 100644 index 30e8ea0..0000000 --- a/test/test_blockarraysext.jl +++ /dev/null @@ -1,39 +0,0 @@ -using BlockArrays: Block, BlockArray -using ITensorBase: inds, nameddims, unname, unnamed -using Test: @test, @testset - -@testset "ITensorBaseBlockArraysExt" begin - elt = Float64 - - a = BlockArray{elt}(undef, [2, 3], [2, 3]) - a[Block(1, 1)] = randn(elt, 2, 2) - a[Block(2, 1)] = randn(elt, 3, 2) - a[Block(1, 2)] = randn(elt, 2, 3) - a[Block(2, 2)] = randn(elt, 3, 3) - n = nameddims(a, ("i", "j")) - i, j = inds(n) - @test unnamed(n[i[Block(2)], j[Block(1)]]) == a[Block(2, 1)] - @test unnamed(n[Block(2), Block(1)]) == a[Block(2, 1)] - @test unnamed(n[Block(2, 1)]) == a[Block(2, 1)] - @test unnamed(n[i[Block(2)], j[Block.(1:2)]]) == a[Block(2), Block.(1:2)] - @test unnamed(n[Block(2), Block.(1:2)]) == a[Block(2), Block.(1:2)] - @test unnamed(n[i[Block.(1:2)], j[Block(1)]]) == a[Block.(1:2), Block(1)] - @test unnamed(n[Block.(1:2), Block(1)]) == a[Block.(1:2), Block(1)] - @test unnamed(n[Block.(1:2), Block.(1:2)]) == a[Block.(1:2), Block.(1:2)] - - a = BlockArray{elt}(undef, [2, 3], [2, 3]) - a[Block(1, 1)] = randn(elt, 2, 2) - a[Block(2, 1)] = randn(elt, 3, 2) - a[Block(1, 2)] = randn(elt, 2, 3) - a[Block(2, 2)] = randn(elt, 3, 3) - b = BlockArray{elt}(undef, [2, 3], [2, 3]) - b[Block(1, 1)] = randn(elt, 2, 2) - b[Block(2, 1)] = randn(elt, 3, 2) - b[Block(1, 2)] = randn(elt, 2, 3) - b[Block(2, 2)] = randn(elt, 3, 3) - na = nameddims(a, ("i", "j")) - nb = nameddims(b, ("j", "i")) - nc = na .+ 2 .* nb - c = a + 2 * permutedims(b, (2, 1)) - @test unname(nc, ("i", "j")) ≈ c -end From 80f957525f303e19c0f6f486b6a014a87bbf85eb Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Tue, 30 Jun 2026 15:36:36 -0400 Subject: [PATCH 2/4] Bump the docs TensorAlgebra compat to 0.14 The `docs` workspace member still bounded `TensorAlgebra` at the old version, which leaves the shared workspace compat empty once the root and tests require 0.14. --- docs/Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Project.toml b/docs/Project.toml index 836c95c..72492b6 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -16,5 +16,5 @@ ITensorBase = "0.9" ITensorFormatter = "0.2.27" Literate = "2" MatrixAlgebraKit = "0.2, 0.3, 0.4, 0.5, 0.6" -TensorAlgebra = "0.12.4, 0.13" +TensorAlgebra = "0.14" Test = "1.10" From d30ea1f99d66197f9e1e6a002fc4328a6309ecd2 Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Tue, 30 Jun 2026 15:52:22 -0400 Subject: [PATCH 3/4] Bump the minor version to 0.10.0 for the breaking removal Dropping the `BlockArrays` extension removes functionality downstream code may rely on, so this is a breaking release. Raise the workspace members' `ITensorBase` compat to `0.10` to match. --- Project.toml | 2 +- docs/Project.toml | 2 +- examples/Project.toml | 2 +- test/Project.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 20d4ede..7bdc422 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "ITensorBase" uuid = "4795dd04-0d67-49bb-8f44-b89c448a1dc7" -version = "0.9.2" +version = "0.10.0" authors = ["ITensor developers and contributors"] [workspace] diff --git a/docs/Project.toml b/docs/Project.toml index 72492b6..d10d035 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -12,7 +12,7 @@ path = ".." [compat] Documenter = "1" -ITensorBase = "0.9" +ITensorBase = "0.10" ITensorFormatter = "0.2.27" Literate = "2" MatrixAlgebraKit = "0.2, 0.3, 0.4, 0.5, 0.6" diff --git a/examples/Project.toml b/examples/Project.toml index 0e153f6..c1a24b5 100644 --- a/examples/Project.toml +++ b/examples/Project.toml @@ -6,5 +6,5 @@ MatrixAlgebraKit = "6c742aac-3347-4629-af66-fc926824e5e4" path = ".." [compat] -ITensorBase = "0.9" +ITensorBase = "0.10" MatrixAlgebraKit = "0.2, 0.3, 0.4, 0.5, 0.6" diff --git a/test/Project.toml b/test/Project.toml index d7b94ed..82515fd 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -29,7 +29,7 @@ AbstractTrees = "0.4.5" Adapt = "4" Aqua = "0.8.9" Combinatorics = "1" -ITensorBase = "0.9" +ITensorBase = "0.10" ITensorPkgSkeleton = "0.3.42" JLArrays = "0.2, 0.3" LinearAlgebra = "1.10" From 8f0991fd549d40474635338781030c219187c7ab Mon Sep 17 00:00:00 2001 From: Matthew Fishman Date: Tue, 30 Jun 2026 22:39:43 -0400 Subject: [PATCH 4/4] Drop the TensorAlgebra source pin now that 0.14 is registered TensorAlgebra 0.14 is registered, so the `[compat]` bound resolves against the release and the branch pin is no longer needed. --- Project.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Project.toml b/Project.toml index 7bdc422..e8ccfe4 100644 --- a/Project.toml +++ b/Project.toml @@ -30,10 +30,6 @@ Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6" TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2" -[sources.TensorAlgebra] -rev = "mf/inline-strided-permute" -url = "https://github.com/ITensor/TensorAlgebra.jl" - [extensions] ITensorBaseAdaptExt = "Adapt" ITensorBaseMooncakeExt = "Mooncake"