From f3252bf50599ba16640ef08eb1e43c632eacf264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Chuchma=C5=82a?= Date: Sat, 14 Nov 2020 17:56:50 +0100 Subject: [PATCH] Tests for multiplications of Hermitian matrices (#38380) --- stdlib/LinearAlgebra/test/symmetric.jl | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/stdlib/LinearAlgebra/test/symmetric.jl b/stdlib/LinearAlgebra/test/symmetric.jl index c44fd2db93345..7d99dd32889fd 100644 --- a/stdlib/LinearAlgebra/test/symmetric.jl +++ b/stdlib/LinearAlgebra/test/symmetric.jl @@ -697,4 +697,34 @@ end end end +@testset "Dsiambiguation multiplication with transposed AbstractMatrix methods in linalg/matmul.jl for $T and $S" for T in + (Float16, Float32, Float64, BigFloat), S in (ComplexF16, ComplexF32, ComplexF64) + let Ahrs = Transpose(Hermitian(Symmetric(rand(T, 3, 3)))), + Acs = Transpose(Symmetric(rand(S, 3, 3))), + Ahcs = Transpose(Hermitian(Symmetric(rand(S, 3, 3)))) + + @test Ahrs * Ahrs ≈ Ahrs * parent(Ahrs) + @test Ahrs * Acs ≈ Ahrs * parent(Acs) + @test Acs * Acs ≈ parent(Acs) * parent(Acs) + @test Acs * Ahrs ≈ parent(Acs) * Ahrs + @test Ahrs * Ahcs ≈ parent(Ahrs) * Ahcs + @test Ahcs * Ahrs ≈ Ahcs * parent(Ahrs) + end +end + +@testset "Dsiambiguation multiplication with adjointed AbstractMatrix methods in linalg/matmul.jl for $T and $S" for T in + (Float16, Float32, Float64, BigFloat), S in (ComplexF16, ComplexF32, ComplexF64) + let Ahrs = Adjoint(Hermitian(Symmetric(rand(T, 3, 3)))), + Acs = Adjoint(Symmetric(rand(S, 3, 3))), + Ahcs = Adjoint(Hermitian(Symmetric(rand(S, 3, 3)))) + + @test Ahrs * Ahrs ≈ Ahrs * parent(Ahrs) + @test Ahcs * Ahcs ≈ parent(Ahcs) * parent(Ahcs) + @test Ahrs * Ahcs ≈ Ahrs * parent(Ahcs) + @test Acs * Ahcs ≈ Acs * parent(Ahcs) + @test Ahcs * Ahrs ≈ parent(Ahcs) * Ahrs + @test Ahcs * Acs ≈ parent(Ahcs) * Acs + end +end + end # module TestSymmetric