diff --git a/.gitignore b/.gitignore index 7085ca8..d5d9e4e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,18 +1,14 @@ -*.jl.*.cov -*.jl.cov -*.jl.mem +*.cov +*.mem *.o *.swp .DS_Store .benchmarkci .tmp .vscode/ -Manifest.toml +LocalPreferences.toml +Manifest*.toml benchmark/*.json dev/ -docs/LocalPreferences.toml -docs/Manifest.toml docs/build/ docs/src/index.md -examples/LocalPreferences.toml -test/LocalPreferences.toml diff --git a/Project.toml b/Project.toml index 2b550dc..65c0abd 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "GradedArrays" uuid = "bc96ca6e-b7c8-4bb6-888e-c93f838762c2" -version = "0.5.3" +version = "0.5.4" authors = ["ITensor developers and contributors"] [deps] @@ -37,7 +37,7 @@ MatrixAlgebraKit = "0.6" Random = "1.10" SUNRepresentations = "0.3" SplitApplyCombine = "1.2.3" -TensorAlgebra = "0.3.2, 0.4" +TensorAlgebra = "0.5" TensorKitSectors = "0.1, 0.2" TensorProducts = "0.1.3" TypeParameterAccessors = "0.4" diff --git a/src/tensoralgebra.jl b/src/tensoralgebra.jl index 90be1d2..1aa618c 100644 --- a/src/tensoralgebra.jl +++ b/src/tensoralgebra.jl @@ -45,21 +45,25 @@ function matricize_axes( return codomain_axis, flip(unflipped_domain_axis) end +using TensorAlgebra: blockedtrivialperm function TensorAlgebra.matricize( - ::SectorFusion, a::AbstractArray, biperm::AbstractBlockPermutation{2} + ::SectorFusion, a::AbstractArray, codomain_length::Val, domain_length::Val ) - a_perm = permutedims(a, Tuple(biperm)) + biperm = blockedtrivialperm((codomain_length, domain_length)) codomain_axis, domain_axis = matricize_axes(axes(a)[biperm]) - a_reshaped = blockreshape(a_perm, (codomain_axis, domain_axis)) + a_reshaped = blockreshape(a, (codomain_axis, domain_axis)) # Sort the blocks by sector and merge the equivalent sectors. return sectormergesort(a_reshaped) end +using TensorAlgebra: tuplemortar function TensorAlgebra.unmatricize( ::SectorFusion, m::AbstractMatrix, - blocked_axes::BlockedTuple{2, <:Any, <:Tuple{Vararg{AbstractUnitRange}}}, + codomain_axes::Tuple{Vararg{AbstractUnitRange}}, + domain_axes::Tuple{Vararg{AbstractUnitRange}}, ) + blocked_axes = tuplemortar((codomain_axes, domain_axes)) if isempty(blocked_axes) # Handle edge case of empty blocked_axes, which can occur # when matricizing a 0-dimensional array (a scalar). diff --git a/test/Project.toml b/test/Project.toml index ba8f661..8d59748 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -16,6 +16,9 @@ TensorProducts = "decf83d6-1968-43f4-96dc-fdb3fe15fc6d" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a" +[sources] +GradedArrays = {path = ".."} + [compat] Aqua = "0.8.11" BlockArrays = "1.6" @@ -28,7 +31,7 @@ SUNRepresentations = "0.3" SafeTestsets = "0.1" SparseArraysBase = "0.7" Suppressor = "0.2.8" -TensorAlgebra = "0.3.2, 0.4" +TensorAlgebra = "0.5" TensorKitSectors = "0.1, 0.2" TensorProducts = "0.1.3" Test = "1.10"