@@ -9,17 +9,17 @@ spacelist = try
99 if ENV [" CI" ] == " true"
1010 println (" Detected running on CI" )
1111 if Sys. iswindows ()
12- (Vtr, Vℤ₃, VU₁, VfU₁, VCU₁, VSU₂)
12+ (Vtr, Vℤ₃, VU₁, VfU₁, VCU₁, VSU₂, VIB_diag )
1313 elseif Sys. isapple ()
14- (Vtr, Vℤ₃, VfU₁, VfSU₂)
14+ (Vtr, Vℤ₃, VfU₁, VfSU₂, VIB_diag )
1515 else
16- (Vtr, VU₁, VCU₁, VSU₂, VfSU₂)
16+ (Vtr, VU₁, VCU₁, VSU₂, VfSU₂, VIB_diag )
1717 end
1818 else
19- (Vtr, Vℤ₃, VU₁, VfU₁, VCU₁, VSU₂, VfSU₂)
19+ (Vtr, Vℤ₃, VU₁, VfU₁, VCU₁, VSU₂, VfSU₂, VIB_diag )
2020 end
2121catch
22- (Vtr, Vℤ₃, VU₁, VfU₁, VCU₁, VSU₂, VfSU₂)
22+ (Vtr, Vℤ₃, VU₁, VfU₁, VCU₁, VSU₂, VfSU₂, VIB_diag )
2323end
2424
2525eltypes = (Float32, ComplexF64)
@@ -37,7 +37,7 @@ for V in spacelist
3737 @testset " QR decomposition" begin
3838 for T in eltypes,
3939 t in (
40- rand (T, W, W), rand (T, W, W)' , rand (T, W, V1 ), rand (T, V1 , W)' ,
40+ rand (T, W, W), rand (T, W, W)' , rand (T, W, V4 ), rand (T, V4 , W)' ,
4141 DiagonalTensorMap (rand (T, reduceddim (V1)), V1),
4242 )
4343
@@ -64,7 +64,7 @@ for V in spacelist
6464
6565 # empty tensor
6666 for T in eltypes
67- t = rand (T, V1 ⊗ V2, zero (V1))
67+ t = rand (T, V1 ⊗ V2, zerospace (V1))
6868
6969 Q, R = @constinferred qr_full (t)
7070 @test Q * R ≈ t
@@ -90,7 +90,7 @@ for V in spacelist
9090 @testset " LQ decomposition" begin
9191 for T in eltypes,
9292 t in (
93- rand (T, W, W), rand (T, W, W)' , rand (T, W, V1 ), rand (T, V1 , W)' ,
93+ rand (T, W, W), rand (T, W, W)' , rand (T, W, V4 ), rand (T, V4 , W)' ,
9494 DiagonalTensorMap (rand (T, reduceddim (V1)), V1),
9595 )
9696
@@ -113,7 +113,7 @@ for V in spacelist
113113
114114 for T in eltypes
115115 # empty tensor
116- t = rand (T, zero (V1), V1 ⊗ V2)
116+ t = rand (T, zerospace (V1), V1 ⊗ V2)
117117
118118 L, Q = @constinferred lq_full (t)
119119 @test L * Q ≈ t
@@ -139,7 +139,7 @@ for V in spacelist
139139 @testset " Polar decomposition" begin
140140 for T in eltypes,
141141 t in (
142- rand (T, W, W), rand (T, W, W)' , rand (T, W, V1 ), rand (T, V1 , W)' ,
142+ rand (T, W, W), rand (T, W, W)' , rand (T, W, V4 ), rand (T, V4 , W)' ,
143143 DiagonalTensorMap (rand (T, reduceddim (V1)), V1),
144144 )
145145
@@ -155,7 +155,7 @@ for V in spacelist
155155 end
156156
157157 for T in eltypes,
158- t in (rand (T, W, W), rand (T, W, W)' , rand (T, V1 , W), rand (T, W, V1 )' )
158+ t in (rand (T, W, W), rand (T, W, W)' , rand (T, V4 , W), rand (T, W, V4 )' )
159159
160160 @assert codomain (t) ≾ domain (t)
161161 p, wᴴ = @constinferred right_polar (t)
@@ -173,8 +173,8 @@ for V in spacelist
173173 for T in eltypes,
174174 t in (
175175 rand (T, W, W), rand (T, W, W)' ,
176- rand (T, W, V1 ), rand (T, V1 , W),
177- rand (T, W, V1 )' , rand (T, V1 , W)' ,
176+ rand (T, W, V4 ), rand (T, V4 , W),
177+ rand (T, W, V4 )' , rand (T, V4 , W)' ,
178178 DiagonalTensorMap (rand (T, reduceddim (V1)), V1),
179179 )
180180
@@ -208,7 +208,7 @@ for V in spacelist
208208 end
209209
210210 # empty tensor
211- for T in eltypes, t in (rand (T, W, zero (V1)), rand (T, zero (V1), W))
211+ for T in eltypes, t in (rand (T, W, zerospace (V1)), rand (T, zerospace (V1), W))
212212 U, S, Vᴴ = @constinferred svd_full (t)
213213 @test U * S * Vᴴ ≈ t
214214 @test isunitary (U)
@@ -224,8 +224,8 @@ for V in spacelist
224224 for T in eltypes,
225225 t in (
226226 randn (T, W, W), randn (T, W, W)' ,
227- randn (T, W, V1 ), randn (T, V1 , W),
228- randn (T, W, V1 )' , randn (T, V1 , W)' ,
227+ randn (T, W, V4 ), randn (T, V4 , W),
228+ randn (T, W, V4 )' , randn (T, V4 , W)' ,
229229 DiagonalTensorMap (randn (T, reduceddim (V1)), V1),
230230 )
231231
@@ -236,7 +236,8 @@ for V in spacelist
236236 @test isisometry (U)
237237 @test isisometry (Vᴴ; side = :right )
238238
239- trunc = truncrank (dim (domain (S)) ÷ 2 )
239+ # FIXME : dimension of S is a float, might be a real issue if it's a decimal
240+ trunc = truncrank (Int (dim (domain (S)) ÷ 2 ))
240241 U1, S1, Vᴴ1 = @constinferred svd_trunc (t; trunc)
241242 @test t * Vᴴ1' ≈ U1 * S1
242243 @test isisometry (U1)
@@ -268,7 +269,7 @@ for V in spacelist
268269 @test isisometry (Vᴴ4; side = :right )
269270 @test norm (t - U4 * S4 * Vᴴ4) <= 0.5
270271
271- trunc = truncrank (dim (domain (S)) ÷ 2 ) & trunctol (; atol = λ - 10 eps (λ))
272+ trunc = truncrank (Int ( dim (domain (S)) ÷ 2 ) ) & trunctol (; atol = λ - 10 eps (λ))
272273 U5, S5, Vᴴ5 = @constinferred svd_trunc (t; trunc)
273274 @test t * Vᴴ5' ≈ U5 * S5
274275 @test isisometry (U5)
@@ -298,7 +299,7 @@ for V in spacelist
298299 @test @constinferred isposdef (vdv)
299300 t isa DiagonalTensorMap || @test ! isposdef (t) # unlikely for non-hermitian map
300301
301- d, v = @constinferred eig_trunc (t; trunc = truncrank (dim (domain (t)) ÷ 2 ))
302+ d, v = @constinferred eig_trunc (t; trunc = truncrank (Int ( dim (domain (t)) ÷ 2 ) ))
302303 @test t * v ≈ v * d
303304 @test dim (domain (d)) ≤ dim (domain (t)) ÷ 2
304305
@@ -329,7 +330,7 @@ for V in spacelist
329330 @test isposdef (t - λ * one (t) + 0.1 * one (t))
330331 @test ! isposdef (t - λ * one (t) - 0.1 * one (t))
331332
332- d, v = @constinferred eigh_trunc (t; trunc = truncrank (dim (domain (t)) ÷ 2 ))
333+ d, v = @constinferred eigh_trunc (t; trunc = truncrank (Int ( dim (domain (t)) ÷ 2 ) ))
333334 @test t * v ≈ v * d
334335 @test dim (domain (d)) ≤ dim (domain (t)) ÷ 2
335336 end
@@ -339,26 +340,26 @@ for V in spacelist
339340 for T in eltypes,
340341 t in (
341342 rand (T, W, W), rand (T, W, W)' ,
342- rand (T, W, V1 ), rand (T, V1 , W),
343- rand (T, W, V1 )' , rand (T, V1 , W)' ,
343+ rand (T, W, V4 ), rand (T, V4 , W),
344+ rand (T, W, V4 )' , rand (T, V4 , W)' ,
344345 DiagonalTensorMap (rand (T, reduceddim (V1)), V1),
345346 )
346347
347348 d1, d2 = dim (codomain (t)), dim (domain (t))
348349 @test rank (t) == min (d1, d2)
349350 M = left_null (t)
350- @test @constinferred (rank (M)) + rank (t) == d1
351+ @test @constinferred (rank (M)) + rank (t) ≈ d1
351352 Mᴴ = right_null (t)
352- @test rank (Mᴴ) + rank (t) == d2
353+ @test rank (Mᴴ) + rank (t) ≈ d2
353354 end
354355 for T in eltypes
355356 u = unitary (T, V1 ⊗ V2, V1 ⊗ V2)
356357 @test @constinferred (cond (u)) ≈ one (real (T))
357358 @test @constinferred (rank (u)) == dim (V1 ⊗ V2)
358359
359- t = rand (T, zero (V1), W)
360+ t = rand (T, zerospace (V1), W)
360361 @test rank (t) == 0
361- t2 = rand (T, zero (V1) * zero (V2), zero (V1) * zero (V2))
362+ t2 = rand (T, zerospace (V1) * zerospace (V2), zerospace (V1) * zerospace (V2))
362363 @test rank (t2) == 0
363364 @test cond (t2) == 0.0
364365 end
0 commit comments