Skip to content

Commit 8eebaca

Browse files
authored
as tensor_product alias (#8)
1 parent cfebf0d commit 8eebaca

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TensorProducts"
22
uuid = "decf83d6-1968-43f4-96dc-fdb3fe15fc6d"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.1.1"
4+
version = "0.1.2"
55

66
[weakdeps]
77
BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e"

src/tensor_product.jl

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ function require_one_based_axis(a::AbstractUnitRange)
99
end
1010

1111
# ============================== tensor product ==========================================
12-
() = tensor_product()
13-
(a) = tensor_product(a)
14-
15-
# default. No type restriction to allow sectors as input
16-
(a1, a2) = tensor_product(a1, a2)
17-
18-
# allow to specialize ⊗(a1, a2) to fusion_product
19-
(a1, a2, as...) = ((a1, a2), as...)
20-
2112
tensor_product() = OneToOne()
2213
tensor_product(a) = a
2314
tensor_product(a1, a2, as...) = tensor_product(tensor_product(a1, a2), as...)
@@ -32,3 +23,5 @@ end
3223
tensor_product(::OneToOne, ::OneToOne) = OneToOne()
3324
tensor_product(::OneToOne, a::AbstractUnitRange) = tensor_product(a)
3425
tensor_product(a::AbstractUnitRange, ::OneToOne) = tensor_product(a)
26+
27+
const = tensor_product

test/test_tensor_product.jl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@ using BlockArrays: blockedrange, blockisequal
77
r0 = OneToOne()
88
b1 = blockedrange([1, 2])
99

10-
@testset "" begin
11-
@test () isa OneToOne
12-
@test (1:2) == 1:2
13-
@test (1:2, 1:3) == 1:6
14-
@test (1:2, 1:3, 1:4) == 1:24
15-
16-
@test (r0, r0) isa OneToOne
17-
@test blockisequal((b1, b1), blockedrange([1, 2, 2, 4]))
18-
@test blockisequal((b1, r0), b1)
19-
@test blockisequal((r0, b1), b1)
20-
end
21-
2210
@testset "tensor_product" begin
2311
@test tensor_product() isa OneToOne
2412
@test tensor_product(1:2) == 1:2
@@ -30,5 +18,11 @@ end
3018
@test_throws ArgumentError tensor_product(2:3, 2:2)
3119

3220
@test tensor_product(r0, r0) isa OneToOne
21+
@test blockisequal(tensor_product(b1, r0), b1)
22+
@test blockisequal(tensor_product(r0, b1), b1)
23+
24+
@test blockisequal(tensor_product(b1, b1), blockedrange([1, 2, 2, 4]))
3325
@test blockisequal(tensor_product(b1, b1), blockedrange([1, 2, 2, 4]))
26+
27+
@test (r0, r0) isa OneToOne
3428
end

0 commit comments

Comments
 (0)