@@ -28,7 +28,8 @@ for V in spacelist
2828
2929 @testset " QR decomposition" begin
3030 for T in eltypes,
31- t in (rand (T, W, W), rand (T, W, W)' , rand (T, W, V1), rand (T, V1, W)' )
31+ t in (rand (T, W, W), rand (T, W, W)' , rand (T, W, V1), rand (T, V1, W)' ,
32+ DiagonalTensorMap (rand (T, reduceddim (V1)), V1))
3233
3334 Q, R = @constinferred qr_full (t)
3435 @test Q * R ≈ t
@@ -78,7 +79,8 @@ for V in spacelist
7879
7980 @testset " LQ decomposition" begin
8081 for T in eltypes,
81- t in (rand (T, W, W), rand (T, W, W)' , rand (T, W, V1), rand (T, V1, W)' )
82+ t in (rand (T, W, W), rand (T, W, W)' , rand (T, W, V1), rand (T, V1, W)' ,
83+ DiagonalTensorMap (rand (T, reduceddim (V1)), V1))
8284
8385 L, Q = @constinferred lq_full (t)
8486 @test L * Q ≈ t
@@ -124,7 +126,8 @@ for V in spacelist
124126
125127 @testset " Polar decomposition" begin
126128 for T in eltypes,
127- t in (rand (T, W, W), rand (T, W, W)' , rand (T, W, V1), rand (T, V1, W)' )
129+ t in (rand (T, W, W), rand (T, W, W)' , rand (T, W, V1), rand (T, V1, W)' ,
130+ DiagonalTensorMap (rand (T, reduceddim (V1)), V1))
128131
129132 @assert domain (t) ≾ codomain (t)
130133 w, p = @constinferred left_polar (t)
@@ -156,7 +159,8 @@ for V in spacelist
156159 for T in eltypes,
157160 t in (rand (T, W, W), rand (T, W, W)' ,
158161 rand (T, W, V1), rand (T, V1, W),
159- rand (T, W, V1)' , rand (T, V1, W)' )
162+ rand (T, W, V1)' , rand (T, V1, W)' ,
163+ DiagonalTensorMap (rand (T, reduceddim (V1)), V1))
160164
161165 u, s, vᴴ = @constinferred svd_full (t)
162166 @test u * s * vᴴ ≈ t
@@ -201,7 +205,11 @@ for V in spacelist
201205 end
202206
203207 @testset " Eigenvalue decomposition" begin
204- for T in eltypes, t in (rand (T, V1, V1), rand (T, W, W), rand (T, W, W)' )
208+ for T in eltypes,
209+ t in
210+ (rand (T, V1, V1), rand (T, W, W), rand (T, W, W)' ,
211+ DiagonalTensorMap (rand (T, reduceddim (V1)), V1))
212+
205213 d, v = @constinferred eig_full (t)
206214 @test t * v ≈ v * d
207215
@@ -213,7 +221,7 @@ for V in spacelist
213221 vdv = v' * v
214222 vdv = (vdv + vdv' ) / 2
215223 @test @constinferred isposdef (vdv)
216- @test ! isposdef (t) # unlikely for non-hermitian map
224+ t isa DiagonalTensorMap || @test ! isposdef (t) # unlikely for non-hermitian map
217225
218226 d, v = @constinferred eig_trunc (t; trunc= truncrank (dim (domain (t)) ÷ 2 ))
219227 @test t * v ≈ v * d
@@ -254,7 +262,8 @@ for V in spacelist
254262 for T in eltypes,
255263 t in (rand (T, W, W), rand (T, W, W)' ,
256264 rand (T, W, V1), rand (T, V1, W),
257- rand (T, W, V1)' , rand (T, V1, W)' )
265+ rand (T, W, V1)' , rand (T, V1, W)' ,
266+ DiagonalTensorMap (rand (T, reduceddim (V1)), V1))
258267
259268 d1, d2 = dim (codomain (t)), dim (domain (t))
260269 @test rank (t) == min (d1, d2)
0 commit comments