Skip to content

Commit 8173240

Browse files
authored
Upgrade to TensorAlgebra.jl v0.5 (#80)
1 parent 98e99f4 commit 8173240

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

.gitignore

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
1-
*.jl.*.cov
2-
*.jl.cov
3-
*.jl.mem
1+
*.cov
2+
*.mem
43
*.o
54
*.swp
65
.DS_Store
76
.benchmarkci
87
.tmp
98
.vscode/
10-
Manifest.toml
9+
LocalPreferences.toml
10+
Manifest*.toml
1111
benchmark/*.json
1212
dev/
13-
docs/LocalPreferences.toml
14-
docs/Manifest.toml
1513
docs/build/
1614
docs/src/index.md
17-
examples/LocalPreferences.toml
18-
test/LocalPreferences.toml

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "GradedArrays"
22
uuid = "bc96ca6e-b7c8-4bb6-888e-c93f838762c2"
3-
version = "0.5.3"
3+
version = "0.5.4"
44
authors = ["ITensor developers <[email protected]> and contributors"]
55

66
[deps]
@@ -37,7 +37,7 @@ MatrixAlgebraKit = "0.6"
3737
Random = "1.10"
3838
SUNRepresentations = "0.3"
3939
SplitApplyCombine = "1.2.3"
40-
TensorAlgebra = "0.3.2, 0.4"
40+
TensorAlgebra = "0.5"
4141
TensorKitSectors = "0.1, 0.2"
4242
TensorProducts = "0.1.3"
4343
TypeParameterAccessors = "0.4"

src/tensoralgebra.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,25 @@ function matricize_axes(
4545
return codomain_axis, flip(unflipped_domain_axis)
4646
end
4747

48+
using TensorAlgebra: blockedtrivialperm
4849
function TensorAlgebra.matricize(
49-
::SectorFusion, a::AbstractArray, biperm::AbstractBlockPermutation{2}
50+
::SectorFusion, a::AbstractArray, codomain_length::Val, domain_length::Val
5051
)
51-
a_perm = permutedims(a, Tuple(biperm))
52+
biperm = blockedtrivialperm((codomain_length, domain_length))
5253
codomain_axis, domain_axis = matricize_axes(axes(a)[biperm])
53-
a_reshaped = blockreshape(a_perm, (codomain_axis, domain_axis))
54+
a_reshaped = blockreshape(a, (codomain_axis, domain_axis))
5455
# Sort the blocks by sector and merge the equivalent sectors.
5556
return sectormergesort(a_reshaped)
5657
end
5758

59+
using TensorAlgebra: tuplemortar
5860
function TensorAlgebra.unmatricize(
5961
::SectorFusion,
6062
m::AbstractMatrix,
61-
blocked_axes::BlockedTuple{2, <:Any, <:Tuple{Vararg{AbstractUnitRange}}},
63+
codomain_axes::Tuple{Vararg{AbstractUnitRange}},
64+
domain_axes::Tuple{Vararg{AbstractUnitRange}},
6265
)
66+
blocked_axes = tuplemortar((codomain_axes, domain_axes))
6367
if isempty(blocked_axes)
6468
# Handle edge case of empty blocked_axes, which can occur
6569
# when matricizing a 0-dimensional array (a scalar).

test/Project.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ TensorProducts = "decf83d6-1968-43f4-96dc-fdb3fe15fc6d"
1616
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1717
TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"
1818

19+
[sources]
20+
GradedArrays = {path = ".."}
21+
1922
[compat]
2023
Aqua = "0.8.11"
2124
BlockArrays = "1.6"
@@ -28,7 +31,7 @@ SUNRepresentations = "0.3"
2831
SafeTestsets = "0.1"
2932
SparseArraysBase = "0.7"
3033
Suppressor = "0.2.8"
31-
TensorAlgebra = "0.3.2, 0.4"
34+
TensorAlgebra = "0.5"
3235
TensorKitSectors = "0.1, 0.2"
3336
TensorProducts = "0.1.3"
3437
Test = "1.10"

0 commit comments

Comments
 (0)