Skip to content

Commit 5e9d0db

Browse files
committed
Merge branch 'main' into non-abelian_fusion
2 parents b322fca + a583788 commit 5e9d0db

File tree

20 files changed

+181
-43
lines changed

20 files changed

+181
-43
lines changed

.github/workflows/main_test_itensors_base_macos_windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
version:
17-
- '1.6'
17+
- 'lts'
1818
- '1'
1919
os:
2020
# - windows-latest # windows tests are failing for an unknow reason, disable for now

.github/workflows/test_itensormps_ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
version:
19-
- '1.6'
19+
- 'lts'
2020
- '1'
2121
os:
2222
- ubuntu-latest

.github/workflows/test_itensors_base_ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
version:
19-
- '1.6'
19+
- 'lts'
2020
- '1'
2121
os:
2222
- ubuntu-latest

.github/workflows/test_ndtensors.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
matrix:
1818
version:
19-
- '1.6'
19+
- 'lts'
2020
- '1'
2121
os:
2222
- ubuntu-latest

NDTensors/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "NDTensors"
22
uuid = "23ae76d9-e61a-49c4-8f12-3f1a16adf9cf"
33
authors = ["Matthew Fishman <[email protected]>"]
4-
version = "0.3.43"
4+
version = "0.3.45"
55

66
[deps]
77
Accessors = "7d9f7c33-5ae7-4f3b-8dc6-eff91059b697"
@@ -91,7 +91,7 @@ TimerOutputs = "0.5.5"
9191
TupleTools = "1.2.0"
9292
VectorInterface = "0.4.2"
9393
cuTENSOR = "2"
94-
julia = "1.6"
94+
julia = "1.10"
9595

9696
[extras]
9797
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"

NDTensors/src/empty/EmptyTensor.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ end
152152

153153
setindex!!(T::EmptyTensor, x, I...) = setindex(T, x, I...)
154154

155-
promote_rule(::Type{EmptyNumber}, ::Type{T}) where {T<:Number} = T
156-
157155
function promote_rule(
158156
::Type{T1}, ::Type{T2}
159157
) where {T1<:EmptyStorage{EmptyNumber},T2<:TensorStorage}

NDTensors/src/emptynumber.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ convert(::Type{T}, x::EmptyNumber) where {T<:Number} = T(zero(T))
1818
# This helps with defining `norm` of `EmptyStorage{EmptyNumber}`.
1919
AbstractFloat(::EmptyNumber) = zero(AbstractFloat)
2020

21+
# Extra definitions fix ambiguity errors.
22+
Base.promote_rule(::Type{EmptyNumber}, T::Type{<:Number}) = T
23+
Base.promote_rule(T::Type{<:Number}, ::Type{EmptyNumber}) = T
24+
Base.promote_rule(::Type{EmptyNumber}, ::Type{Bool}) = Bool
25+
Base.promote_rule(::Type{Bool}, ::Type{EmptyNumber}) = Bool
26+
Base.promote_rule(::Type{EmptyNumber}, T::Type{Complex{R}}) where {R<:Real} = T
27+
Base.promote_rule(T::Type{Complex{R}}, ::Type{EmptyNumber}) where {R<:Real} = T
28+
2129
# Basic arithmetic
2230
(::EmptyNumber + ::EmptyNumber) = EmptyNumber()
2331
(::EmptyNumber - ::EmptyNumber) = EmptyNumber()

NDTensors/src/lib/BlockSparseArrays/test/test_basics.jl

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -597,21 +597,31 @@ include("TestBlockSparseArraysUtils.jl")
597597
c = @view b[4:8, 4:8]
598598
@test c isa SubArray{<:Any,<:Any,<:BlockSparseArray}
599599
@test size(c) == (5, 5)
600-
@test block_nstored(c) == 2
600+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
601+
@test block_nstored(c) == 2 broken = VERSION > v"1.11-"
601602
@test blocksize(c) == (2, 2)
602603
@test blocklengths.(axes(c)) == ([2, 3], [2, 3])
603-
@test size(c[Block(1, 1)]) == (2, 2)
604-
@test c[Block(1, 1)] == a[Block(2, 2)[2:3, 2:3]]
605-
@test size(c[Block(2, 2)]) == (3, 3)
606-
@test c[Block(2, 2)] == a[Block(1, 1)[1:3, 1:3]]
607-
@test size(c[Block(2, 1)]) == (3, 2)
608-
@test iszero(c[Block(2, 1)])
609-
@test size(c[Block(1, 2)]) == (2, 3)
610-
@test iszero(c[Block(1, 2)])
604+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
605+
@test size(c[Block(1, 1)]) == (2, 2) broken = VERSION v"1.11-"
606+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
607+
@test c[Block(1, 1)] == a[Block(2, 2)[2:3, 2:3]] broken = VERSION v"1.11-"
608+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
609+
@test size(c[Block(2, 2)]) == (3, 3) broken = VERSION v"1.11-"
610+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
611+
@test c[Block(2, 2)] == a[Block(1, 1)[1:3, 1:3]] broken = VERSION v"1.11-"
612+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
613+
@test size(c[Block(2, 1)]) == (3, 2) broken = VERSION v"1.11-"
614+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
615+
@test iszero(c[Block(2, 1)]) broken = VERSION v"1.11-"
616+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
617+
@test size(c[Block(1, 2)]) == (2, 3) broken = VERSION v"1.11-"
618+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
619+
@test iszero(c[Block(1, 2)]) broken = VERSION v"1.11-"
611620

612621
x = randn(elt, 3, 3)
613622
c[Block(2, 2)] = x
614-
@test c[Block(2, 2)] == x
623+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
624+
@test c[Block(2, 2)] == x broken = VERSION v"1.11-"
615625
@test a[Block(1, 1)[1:3, 1:3]] == x
616626

617627
a = BlockSparseArray{elt}([2, 3], [3, 4])
@@ -637,10 +647,13 @@ include("TestBlockSparseArraysUtils.jl")
637647
@test copy(b) == a
638648
@test blocksize(b) == (2, 2)
639649
@test blocklengths.(axes(b)) == ([4, 4], [4, 4])
640-
@test b[Block(1, 1)] == a[Block.(1:2), Block.(1:2)]
641-
@test b[Block(2, 1)] == a[Block.(3:4), Block.(1:2)]
642-
@test b[Block(1, 2)] == a[Block.(1:2), Block.(3:4)]
643-
@test b[Block(2, 2)] == a[Block.(3:4), Block.(3:4)]
650+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
651+
if VERSION < v"1.11-"
652+
@test b[Block(1, 1)] == a[Block.(1:2), Block.(1:2)]
653+
@test b[Block(2, 1)] == a[Block.(3:4), Block.(1:2)]
654+
@test b[Block(1, 2)] == a[Block.(1:2), Block.(3:4)]
655+
@test b[Block(2, 2)] == a[Block.(3:4), Block.(3:4)]
656+
end
644657
c = @view b[Block(2, 2)]
645658
@test blocksize(c) == (1, 1)
646659
@test c == a[Block.(3:4), Block.(3:4)]
@@ -669,13 +682,17 @@ include("TestBlockSparseArraysUtils.jl")
669682
@test copy(b) == a[J, J]
670683
@test blocksize(b) == (2, 2)
671684
@test blocklengths.(axes(b)) == ([4, 4], [4, 4])
672-
@test b[Block(1, 1)] == Array(a)[[7, 8, 5, 6], [7, 8, 5, 6]]
685+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
686+
@test b[Block(1, 1)] == Array(a)[[7, 8, 5, 6], [7, 8, 5, 6]] broken =
687+
VERSION v"1.11-"
673688
c = @views b[Block(1, 1)][2:3, 2:3]
674689
@test c == Array(a)[[8, 5], [8, 5]]
675-
@test copy(c) == Array(a)[[8, 5], [8, 5]]
690+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
691+
@test copy(c) == Array(a)[[8, 5], [8, 5]] broken = VERSION v"1.11-"
676692
c = @view b[Block(1, 1)[2:3, 2:3]]
677693
@test c == Array(a)[[8, 5], [8, 5]]
678-
@test copy(c) == Array(a)[[8, 5], [8, 5]]
694+
# TODO: Fix in Julia 1.11 (https://github.com/ITensor/ITensors.jl/pull/1539).
695+
@test copy(c) == Array(a)[[8, 5], [8, 5]] broken = VERSION v"1.11-"
679696
end
680697

681698
# TODO: Add more tests of this, it may

NDTensors/src/lib/LabelledNumbers/src/labelledunitrange.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ end
3737

3838
labelled_getindex(a, index) = labelled(unlabel(a)[index], label(a))
3939

40+
# This is required in Julia 1.11 and above since
41+
# the generic `axes(a::AbstractRange)` definition was removed
42+
# and replace with a generic `axes(a)` definition that
43+
# is written in terms of `Base.unchecked_oneto`, i.e.:
44+
# ```julia
45+
# map(Base.unchecked_oneto, size(A))
46+
# ```
47+
# which returns a `Base.OneTo` instead of a `LabelledUnitRange`.
48+
Base.axes(a::LabelledUnitRange) = Base.oneto.(size(a))
49+
50+
# TODO: Delete this definition, this should output a `Base.OneTo`.
4051
Base.OneTo(stop::LabelledInteger) = labelled(Base.OneTo(unlabel(stop)), label(stop))
4152

4253
# Fix ambiguity error with `AbstractRange` definition in `Base`.

NDTensors/test/Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1818
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
1919
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
2020
StridedViews = "4db3bf67-4bd7-4b4e-b153-31dc3fb37143"
21-
TBLIS = "48530278-0828-4a49-9772-0f3830dfa1e9"
2221
TensorOperations = "6aa20fa7-93e2-5fca-9bc0-fbd0db3c71a2"
2322
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2423
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
@@ -30,5 +29,6 @@ Metal = "1.1.0"
3029
[extras]
3130
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
3231
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
33-
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
3432
cuTENSOR = "011b41b2-24ef-40a8-b3eb-fa098493e9e1"
33+
Metal = "dde4c033-4e86-420c-a63e-0dd931031962"
34+
TBLIS = "48530278-0828-4a49-9772-0f3830dfa1e9"

0 commit comments

Comments
 (0)