@@ -70,182 +70,3 @@ istestfile(fn) = endswith(fn, ".jl") && !contains(fn, "setup")
7070 end
7171 end
7272end
73-
74-
75- using Test
76- using TestExtras
77- using Random
78- using TensorKit
79- using Combinatorics
80- using TensorKit: ProductSector, fusiontensor, pentagon_equation, hexagon_equation
81- using TensorOperations
82- using Base. Iterators: take, product
83- # using SUNRepresentations: SUNIrrep
84- # const SU3Irrep = SUNIrrep{3}
85- using LinearAlgebra: LinearAlgebra
86- using Zygote: Zygote
87-
88- const TK = TensorKit
89-
90- Random. seed!(1234 )
91-
92- # don't run all tests on GPU, only the GPU
93- # specific ones
94- is_buildkite = get(ENV , " BUILDKITE" , " false" ) == " true"
95-
96- smallset(:: Type{I} ) where {I <: Sector } = take(values(I), 5 )
97- function smallset(:: Type{ProductSector{Tuple{I1, I2}}} ) where {I1, I2}
98- iter = product(smallset(I1), smallset(I2))
99- s = collect(i ⊠ j for (i, j) in iter if dim(i) * dim(j) <= 6 )
100- return length(s) > 6 ? rand(s, 6 ) : s
101- end
102- function smallset(:: Type{ProductSector{Tuple{I1, I2, I3}}} ) where {I1, I2, I3}
103- iter = product(smallset(I1), smallset(I2), smallset(I3))
104- s = collect(i ⊠ j ⊠ k for (i, j, k) in iter if dim(i) * dim(j) * dim(k) <= 6 )
105- return length(s) > 6 ? rand(s, 6 ) : s
106- end
107- function randsector(:: Type{I} ) where {I <: Sector }
108- s = collect(smallset(I))
109- a = rand(s)
110- while a == one(a) # don't use trivial label
111- a = rand(s)
112- end
113- return a
114- end
115- function hasfusiontensor(I:: Type{<:Sector} )
116- try
117- fusiontensor(one(I), one(I), one(I))
118- return true
119- catch e
120- if e isa MethodError
121- return false
122- else
123- rethrow(e)
124- end
125- end
126- end
127-
128- sectorlist = (
129- Z2Irrep, Z3Irrep, Z4Irrep, Z3Irrep ⊠ Z4Irrep,
130- U1Irrep, CU1Irrep, SU2Irrep,
131- FermionParity, FermionParity ⊠ FermionParity,
132- FermionParity ⊠ U1Irrep ⊠ SU2Irrep, FermionParity ⊠ SU2Irrep ⊠ SU2Irrep, # Hubbard-like
133- FibonacciAnyon, IsingAnyon,
134- Z2Irrep ⊠ FibonacciAnyon ⊠ FibonacciAnyon,
135- )
136-
137- # spaces
138- Vtr = (ℂ^ 2 , (ℂ^ 3 )' , ℂ^ 4 , ℂ^ 3 , (ℂ^ 2 )' )
139- Vℤ₂ = (
140- Vect[Z2Irrep](0 => 1 , 1 => 1 ),
141- Vect[Z2Irrep](0 => 1 , 1 => 2 )' ,
142- Vect[Z2Irrep](0 => 3 , 1 => 2 )' ,
143- Vect[Z2Irrep](0 => 2 , 1 => 3 ),
144- Vect[Z2Irrep](0 => 2 , 1 => 5 ),
145- )
146- Vfℤ₂ = (
147- Vect[FermionParity](0 => 1 , 1 => 1 ),
148- Vect[FermionParity](0 => 1 , 1 => 2 )' ,
149- Vect[FermionParity](0 => 2 , 1 => 1 )' ,
150- Vect[FermionParity](0 => 2 , 1 => 3 ),
151- Vect[FermionParity](0 => 2 , 1 => 5 ),
152- )
153- Vℤ₃ = (
154- Vect[Z3Irrep](0 => 1 , 1 => 2 , 2 => 1 ),
155- Vect[Z3Irrep](0 => 2 , 1 => 1 , 2 => 1 ),
156- Vect[Z3Irrep](0 => 1 , 1 => 2 , 2 => 1 )' ,
157- Vect[Z3Irrep](0 => 1 , 1 => 2 , 2 => 3 ),
158- Vect[Z3Irrep](0 => 1 , 1 => 3 , 2 => 3 )' ,
159- )
160- VU₁ = (
161- Vect[U1Irrep](0 => 1 , 1 => 2 , - 1 => 2 ),
162- Vect[U1Irrep](0 => 3 , 1 => 1 , - 1 => 1 ),
163- Vect[U1Irrep](0 => 2 , 1 => 2 , - 1 => 1 )' ,
164- Vect[U1Irrep](0 => 1 , 1 => 2 , - 1 => 3 ),
165- Vect[U1Irrep](0 => 1 , 1 => 3 , - 1 => 3 )' ,
166- )
167- VfU₁ = (
168- Vect[FermionNumber](0 => 1 , 1 => 2 , - 1 => 2 ),
169- Vect[FermionNumber](0 => 3 , 1 => 1 , - 1 => 1 ),
170- Vect[FermionNumber](0 => 2 , 1 => 2 , - 1 => 1 )' ,
171- Vect[FermionNumber](0 => 1 , 1 => 2 , - 1 => 3 ),
172- Vect[FermionNumber](0 => 1 , 1 => 3 , - 1 => 3 )' ,
173- )
174- VCU₁ = (
175- Vect[CU1Irrep]((0 , 0 ) => 1 , (0 , 1 ) => 2 , 1 => 1 ),
176- Vect[CU1Irrep]((0 , 0 ) => 3 , (0 , 1 ) => 0 , 1 => 1 ),
177- Vect[CU1Irrep]((0 , 0 ) => 1 , (0 , 1 ) => 0 , 1 => 2 )' ,
178- Vect[CU1Irrep]((0 , 0 ) => 2 , (0 , 1 ) => 2 , 1 => 1 ),
179- Vect[CU1Irrep]((0 , 0 ) => 2 , (0 , 1 ) => 1 , 1 => 2 )' ,
180- )
181- VSU₂ = (
182- Vect[SU2Irrep](0 => 3 , 1 // 2 => 1 ),
183- Vect[SU2Irrep](0 => 2 , 1 => 1 ),
184- Vect[SU2Irrep](1 // 2 => 1 , 1 => 1 )' ,
185- Vect[SU2Irrep](0 => 2 , 1 // 2 => 2 ),
186- Vect[SU2Irrep](0 => 1 , 1 // 2 => 1 , 3 // 2 => 1 )' ,
187- )
188- VfSU₂ = (
189- Vect[FermionSpin](0 => 3 , 1 // 2 => 1 ),
190- Vect[FermionSpin](0 => 2 , 1 => 1 ),
191- Vect[FermionSpin](1 // 2 => 1 , 1 => 1 )' ,
192- Vect[FermionSpin](0 => 2 , 1 // 2 => 2 ),
193- Vect[FermionSpin](0 => 1 , 1 // 2 => 1 , 3 // 2 => 1 )' ,
194- )
195- VSU₂U₁ = (
196- Vect[SU2Irrep ⊠ U1Irrep]((0 , 0 ) => 1 , (1 // 2 , - 1 ) => 1 ),
197- Vect[SU2Irrep ⊠ U1Irrep](
198- (0 , 0 ) => 2 , (0 , 2 ) => 1 , (1 , 0 ) => 1 , (1 , - 2 ) => 1 ,
199- (1 // 2 , - 1 ) => 1
200- ),
201- Vect[SU2Irrep ⊠ U1Irrep]((1 // 2 , 1 ) => 1 , (1 , - 2 ) => 1 )' ,
202- Vect[SU2Irrep ⊠ U1Irrep]((0 , 0 ) => 2 , (0 , 2 ) => 1 , (1 // 2 , 1 ) => 1 ),
203- Vect[SU2Irrep ⊠ U1Irrep]((0 , 0 ) => 1 , (1 // 2 , 1 ) => 1 )' ,
204- )
205- Vfib = (
206- Vect[FibonacciAnyon](:I => 1 , :τ => 1 ),
207- Vect[FibonacciAnyon](:I => 1 , :τ => 2 )' ,
208- Vect[FibonacciAnyon](:I => 3 , :τ => 2 )' ,
209- Vect[FibonacciAnyon](:I => 2 , :τ => 3 ),
210- Vect[FibonacciAnyon](:I => 2 , :τ => 2 ),
211- )
212-
213- if ! is_buildkite
214- Ti = time()
215- @time include(" fusiontrees.jl" )
216- @time include(" spaces.jl" )
217- @time include(" tensors.jl" )
218- @time include(" factorizations.jl" )
219- @time include(" diagonal.jl" )
220- @time include(" planar.jl" )
221- if ! (Sys. isapple() && get(ENV , " CI" , " false" ) == " true" ) && isempty(VERSION . prerelease)
222- @time include(" ad.jl" )
223- end
224- @time include(" bugfixes.jl" )
225- Tf = time()
226- printstyled(
227- " Finished all tests in " ,
228- string(round((Tf - Ti) / 60 ; sigdigits = 3 )),
229- " minutes." ; bold = true , color = Base. info_color()
230- )
231- println()
232- @testset " Aqua" verbose = true begin
233- using Aqua
234- Aqua. test_all(TensorKit)
235- end
236- else
237- Ti = time()
238- #= using CUDA
239- if CUDA.functional()
240- end
241- using AMDGPU
242- if AMDGPU.functional()
243- end=#
244- Tf = time()
245- printstyled(
246- " Finished all GPU tests in " ,
247- string(round((Tf - Ti) / 60 ; sigdigits = 3 )),
248- " minutes." ; bold = true , color = Base. info_color()
249- )
250- println()
251- end
0 commit comments