# JuliaLang/julia

fix #29392: correct ambiguity resolving fallback for of (*|/)(::Numbe…

`…r, ::SymOrHerm)`
fredrikekre committed Oct 2, 2018
1 parent a2df80e commit 964bae71d9f4705bb9fb084d1672979b88214c48
Showing with 11 additions and 2 deletions.
1. +2 −2 stdlib/LinearAlgebra/src/symmetric.jl
2. +9 −0 stdlib/LinearAlgebra/test/symmetric.jl
 @@ -442,9 +442,9 @@ mul!(C::StridedMatrix{T}, A::StridedMatrix{T}, B::Hermitian{T,<:StridedMatrix}) for T in (:Symmetric, :Hermitian), op in (:*, :/) # Deal with an ambiguous case @eval (\$op)(A::\$T, x::Bool) = (\$T)((\$op)(A.data, x), sym_uplo(A.uplo)) @eval (\$op)(A::\$T, x::Bool) = broadcast(\$op, A, x) S = T == :Hermitian ? :Real : :Number @eval (\$op)(A::\$T, x::\$S) = (\$T)((\$op)(A.data, x), sym_uplo(A.uplo)) @eval (\$op)(A::\$T, x::\$S) = broadcast(\$op, A, x) end function factorize(A::HermOrSym{T}) where T
 @@ -517,4 +517,13 @@ end @test Hermitian(A, :U)[1,1] == Hermitian(A, :L)[1,1] == real(A[1,1]) end @testset "issue #29392" begin S = Symmetric(rand(Float64, 2, 2)) H = Hermitian(rand(ComplexF64, 2, 2)) @test (2.0 * S)::Matrix{Float64} == (S * 2.0)::Matrix{Float64} @test (2.0 * H)::Matrix{ComplexF64} == (H * 2.0)::Matrix{ComplexF64} @test (S / 2.0)::Matrix{Float64} == Matrix(S) / 2.0 @test (H / 2.0)::Matrix{Float64} == Matrix(H) / 2.0 end end # module TestSymmetric