@@ -365,9 +365,8 @@ for V in spacelist
365
365
for T in (Float64, ComplexF64)
366
366
t1 = randisometry (T, W1, W2)
367
367
t2 = randisometry (T, W2 ← W2)
368
- @test t1' * t1 ≈ one (t2)
369
- @test t2' * t2 ≈ one (t2)
370
- @test t2 * t2' ≈ one (t2)
368
+ @test isisometry (t1)
369
+ @test isunitary (t2)
371
370
P = t1 * t1'
372
371
@test P * P ≈ P
373
372
end
@@ -447,21 +446,14 @@ for V in spacelist
447
446
TensorKit. Polar (), TensorKit. SVD (),
448
447
TensorKit. SDD ())
449
448
Q, R = @constinferred leftorth (t, ((3 , 4 , 2 ), (1 , 5 )); alg= alg)
450
- QdQ = Q' * Q
451
- @test QdQ ≈ one (QdQ)
449
+ @test isisometry (Q)
452
450
@test Q * R ≈ permute (t, ((3 , 4 , 2 ), (1 , 5 )))
453
- # removed since leftorth now merges legs!
454
- # if alg isa Polar
455
- # @test isposdef(R)
456
- # @test domain(R) == codomain(R) == space(t, 1)' ⊗ space(t, 5)'
457
- # end
458
451
end
459
452
@testset " leftnull with $alg " for alg in
460
453
(TensorKit. QR (), TensorKit. SVD (),
461
454
TensorKit. SDD ())
462
455
N = @constinferred leftnull (t, ((3 , 4 , 2 ), (1 , 5 )); alg= alg)
463
- NdN = N' * N
464
- @test NdN ≈ one (NdN)
456
+ @test isisometry (N)
465
457
@test norm (N' * permute (t, ((3 , 4 , 2 ), (1 , 5 )))) <
466
458
100 * eps (norm (t))
467
459
end
@@ -471,30 +463,21 @@ for V in spacelist
471
463
TensorKit. Polar (), TensorKit. SVD (),
472
464
TensorKit. SDD ())
473
465
L, Q = @constinferred rightorth (t, ((3 , 4 ), (2 , 1 , 5 )); alg= alg)
474
- QQd = Q * Q'
475
- @test QQd ≈ one (QQd)
466
+ @test isisometry (Q; side= :right )
476
467
@test L * Q ≈ permute (t, ((3 , 4 ), (2 , 1 , 5 )))
477
- # removed since rightorth now merges legs!
478
- # if alg isa Polar
479
- # @test isposdef(L)
480
- # @test domain(L) == codomain(L) == space(t, 3) ⊗ space(t, 4)
481
- # end
482
468
end
483
469
@testset " rightnull with $alg " for alg in
484
470
(TensorKit. LQ (), TensorKit. SVD (),
485
471
TensorKit. SDD ())
486
472
M = @constinferred rightnull (t, ((3 , 4 ), (2 , 1 , 5 )); alg= alg)
487
- MMd = M * M'
488
- @test MMd ≈ one (MMd)
473
+ @test isisometry (M; side= :right )
489
474
@test norm (permute (t, ((3 , 4 ), (2 , 1 , 5 ))) * M' ) <
490
475
100 * eps (norm (t))
491
476
end
492
477
@testset " tsvd with $alg " for alg in (TensorKit. SVD (), TensorKit. SDD ())
493
478
U, S, V = @constinferred tsvd (t, ((3 , 4 , 2 ), (1 , 5 )); alg= alg)
494
- UdU = U' * U
495
- @test UdU ≈ one (UdU)
496
- VVd = V * V'
497
- @test VVd ≈ one (VVd)
479
+ @test isisometry (U)
480
+ @test isisometry (V; side= :right )
498
481
t2 = permute (t, ((3 , 4 , 2 ), (1 , 5 )))
499
482
@test U * S * V ≈ t2
500
483
@@ -537,8 +520,7 @@ for V in spacelist
537
520
(TensorKit. QR (), TensorKit. SVD (),
538
521
TensorKit. SDD ())
539
522
N = @constinferred leftnull (t; alg= alg)
540
- @test N' * N ≈ id (domain (N))
541
- @test N * N' ≈ id (codomain (N))
523
+ @test isunitary (N)
542
524
end
543
525
@testset " rightorth with $alg " for alg in
544
526
(TensorKit. RQ (), TensorKit. RQpos (),
@@ -553,8 +535,7 @@ for V in spacelist
553
535
(TensorKit. LQ (), TensorKit. SVD (),
554
536
TensorKit. SDD ())
555
537
M = @constinferred rightnull (copy (t' ); alg= alg)
556
- @test M * M' ≈ id (codomain (M))
557
- @test M' * M ≈ id (domain (M))
538
+ @test isunitary (M)
558
539
end
559
540
@testset " tsvd with $alg " for alg in (TensorKit. SVD (), TensorKit. SDD ())
560
541
U, S, V = @constinferred tsvd (t; alg= alg)
@@ -590,8 +571,7 @@ for V in spacelist
590
571
@test ! isposdef (t2) # unlikely for non-hermitian map
591
572
t2 = (t2 + t2' )
592
573
D, V = eigen (t2)
593
- VdV = V' * V
594
- @test VdV ≈ one (VdV)
574
+ @test isisometry (V)
595
575
D̃, Ṽ = @constinferred eigh (t2)
596
576
@test D ≈ D̃
597
577
@test V ≈ Ṽ
0 commit comments