@@ -4,6 +4,11 @@ module TestSymmetric
44
55using Test, LinearAlgebra, Random
66
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+
712Random. seed! (1010 )
813
914@testset " Pauli σ-matrices: $σ " for σ in map (Hermitian,
462467 end
463468end
464469
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+
465481# Issue #7647: test xsyevr, xheevr, xstevr drivers.
466482@testset " Eigenvalues in interval for $(typeof (Mi7647)) " for Mi7647 in
467483 (Symmetric (diagm (0 => 1.0 : 3.0 )),
0 commit comments