@@ -582,13 +582,21 @@ end
582
582
583
583
# bug identified in PR #52318: dot products of quaternionic Hermitian matrices,
584
584
# or any number type where conj(a)*conj(b) ≠ conj(a*b):
585
- @testset " dot Hermitian quaternion #52318 " begin
586
- A, B = [Quaternion . (randn (3 , 3 ), randn ( 3 , 3 ), randn ( 3 , 3 ), randn ( 3 , 3 )) |> t -> t + t' for i in 1 : 2 ]
585
+ @testset " dot Hermitian quaternion" begin
586
+ A, B = [(randn (Quaternion{Float64}, 4 , 4 )) |> t -> t + t' for i in 1 : 2 ]
587
587
@test A == Hermitian (A) && B == Hermitian (B)
588
588
@test dot (A, B) ≈ dot (Hermitian (A), Hermitian (B))
589
- A, B = [Quaternion . (randn (3 , 3 ), randn ( 3 , 3 ), randn ( 3 , 3 ), randn ( 3 , 3 )) |> t -> t + transpose (t) for i in 1 : 2 ]
589
+ A, B = [(randn (Quaternion{Float64}, 4 , 4 )) |> t -> t + transpose (t) for i in 1 : 2 ]
590
590
@test A == Symmetric (A) && B == Symmetric (B)
591
591
@test dot (A, B) ≈ dot (Symmetric (A), Symmetric (B))
592
+ A = randn (Quaternion{Float64}, 4 , 4 )
593
+ x = randn (Quaternion{Float64}, 4 )
594
+ y = randn (Quaternion{Float64}, 4 )
595
+ for t in (Symmetric, Hermitian), uplo in (:U , :L )
596
+ M = t (A, uplo)
597
+ N = Matrix (M)
598
+ @test dot (x, M, y) ≈ dot (x, M* y) ≈ dot (x, N, y)
599
+ end
592
600
end
593
601
594
602
# let's make sure the analogous bug will not show up with kronecker products
610
618
end
611
619
end
612
620
621
+ @testset " 3-arg dot with Symmetric/Hermitian matrix of matrices" begin
622
+ for m in (Symmetric ([randn (ComplexF64, 2 , 2 ) for i in 1 : 2 , j in 1 : 2 ]),
623
+ Symmetric ([randn (ComplexF64, 2 , 2 ) for i in 1 : 2 , j in 1 : 2 ], :L ),
624
+ Hermitian ([randn (ComplexF64, 2 , 2 ) for i in 1 : 2 , j in 1 : 2 ]),
625
+ Hermitian ([randn (ComplexF64, 2 , 2 ) for i in 1 : 2 , j in 1 : 2 ], :L )
626
+ )
627
+ x = [randn (ComplexF64, 2 ) for i in 1 : 2 ]
628
+ y = [randn (ComplexF64, 2 ) for i in 1 : 2 ]
629
+ @test dot (x, m, y) ≈ dot (x, m* y) ≈ dot (x, Matrix (m), y)
630
+ end
631
+ end
632
+
613
633
# Issue #7647: test xsyevr, xheevr, xstevr drivers.
614
634
@testset " Eigenvalues in interval for $(typeof (Mi7647)) " for Mi7647 in
615
635
(Symmetric (diagm (0 => 1.0 : 3.0 )),
0 commit comments