Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "TensorAlgebra"
uuid = "68bd88dc-f39d-4e12-b2ca-f046b68fcc6a"
authors = ["ITensor developers <[email protected]> and contributors"]
version = "0.1.8"
version = "0.1.9"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
2 changes: 2 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
SymmetrySectors = "f8a8ad64-adbc-4fce-92f7-ffe2bb36a86e"
TensorAlgebra = "68bd88dc-f39d-4e12-b2ca-f046b68fcc6a"
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand All @@ -19,5 +20,6 @@ TestExtras = "5ed8adda-3752-4e41-b88a-e8b09835ee3a"
Aqua = "0.8.9"
SafeTestsets = "0.1"
Suppressor = "0.2"
SymmetrySectors = "0.1"
TensorOperations = "5.1.3"
Test = "1.10"
25 changes: 14 additions & 11 deletions test/test_gradedunitrangesext_basics.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
using BlockArrays: Block
using TensorAlgebra: ⊗
using GradedUnitRanges: GradedUnitRanges, gradedrange, label
using GradedUnitRanges: GradedUnitRanges, gradedrange, dual, isdual, label
using SymmetrySectors: U1
using Test: @test, @testset

struct U1
dim::Int
end
Base.isless(l1::U1, l2::U1) = isless(l1.dim, l2.dim)
GradedUnitRanges.fuse_labels(l1::U1, l2::U1) = U1(l1.dim + l2.dim)

## TODO: This should need to get implemented, but `dual`
## isn't being used right now in `GradedUnitRanges`.
## GradedUnitRanges.dual(l::U1) = U1(-l.dim)

@testset "TensorAlgebraGradedUnitRangesExt" begin
a1 = gradedrange([U1(0) => 2, U1(1) => 3])
a2 = gradedrange([U1(2) => 3, U1(3) => 4])
Expand All @@ -25,4 +16,16 @@ GradedUnitRanges.fuse_labels(l1::U1, l2::U1) = U1(l1.dim + l2.dim)
@test a[Block(2)] == 7:15
@test a[Block(3)] == 16:23
@test a[Block(4)] == 24:35
@test !isdual(a)

a = a1 ⊗ dual(a2)
@test label(a[Block(1)]) == U1(-2)
@test label(a[Block(2)]) == U1(-1)
@test label(a[Block(3)]) == U1(-3)
@test label(a[Block(4)]) == U1(-2)
@test a[Block(1)] == 1:6
@test a[Block(2)] == 7:15
@test a[Block(3)] == 16:23
@test a[Block(4)] == 24:35
@test !isdual(a)
end
Loading