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