@@ -4,6 +4,11 @@ module TestSymmetric
4
4
5
5
using Test, LinearAlgebra, Random
6
6
7
+ const BASE_TEST_PATH = joinpath (Sys. BINDIR, " .." , " share" , " julia" , " test" )
8
+
9
+ isdefined (Main, :Quaternions ) || @eval Main include (joinpath ($ (BASE_TEST_PATH), " testhelpers" , " Quaternions.jl" ))
10
+ using . Main. Quaternions
11
+
7
12
Random. seed! (1010 )
8
13
9
14
@testset " Pauli σ-matrices: $σ " for σ in map (Hermitian,
462
467
end
463
468
end
464
469
470
+ # bug identified in PR #52318: dot products of quaternionic Hermitian matrices,
471
+ # or any number type where conj(a)*conj(b) ≠ conj(a*b):
472
+ @testset " dot Hermitian quaternion #52318" begin
473
+ A, B = [Quaternion .(randn (3 ,3 ), randn (3 , 3 ), randn (3 , 3 ), randn (3 ,3 )) |> t -> t + t' for i in 1 : 2 ]
474
+ @test A == Hermitian (A) && B == Hermitian (B)
475
+ @test dot (A, B) ≈ dot (Hermitian (A), Hermitian (B))
476
+ A, B = [Quaternion .(randn (3 ,3 ), randn (3 , 3 ), randn (3 , 3 ), randn (3 ,3 )) |> t -> t + transpose (t) for i in 1 : 2 ]
477
+ @test A == Symmetric (A) && B == Symmetric (B)
478
+ @test dot (A, B) ≈ dot (Symmetric (A), Symmetric (B))
479
+ end
480
+
465
481
# Issue #7647: test xsyevr, xheevr, xstevr drivers.
466
482
@testset " Eigenvalues in interval for $(typeof (Mi7647)) " for Mi7647 in
467
483
(Symmetric (diagm (0 => 1.0 : 3.0 )),
0 commit comments