A symmetric matrix multiplied by a scalar is not symmetric

#1

Hello,
I have a Symmetric matrix P. When i post-multiply it by a scalar it is still Symmetric, but when i pre-multiply it with the same scalar it is no more Symmetric. Why julia does that ?
Here is an example, the same happens for Hermitian matrices.
I am running Julia Version 1.0.3

julia> P
3×3 Symmetric{Float64,Array{Float64,2}}:
1.5441 -1.04908 0.225946
-1.04908 3.39796 -0.193123
0.225946 -0.193123 2.72884

julia> P*2
3×3 Symmetric{Float64,Array{Float64,2}}:
3.08821 -2.09816 0.451892
-2.09816 6.79592 -0.386245
0.451892 -0.386245 5.45768

julia> 2*P
3×3 Array{Float64,2}:
3.08821 -2.09816 0.451892
-2.09816 6.79592 -0.386245
0.451892 -0.386245 5.45768

#2

Appears to be fixed on julia-1.1.0.

> julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.1.0 (2019-01-21)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

julia> using LinearAlgebra

julia> s = Symmetric(rand(3,3))
3×3 Symmetric{Float64,Array{Float64,2}}:
 0.0793429  0.681884  0.364857
 0.681884   0.212794  0.790376
 0.364857   0.790376  0.555614

julia> 2*s
3×3 Symmetric{Float64,Array{Float64,2}}:
 0.158686  1.36377   0.729715
 1.36377   0.425589  1.58075
 0.729715  1.58075   1.11123

julia> s*2
3×3 Symmetric{Float64,Array{Float64,2}}:
 0.158686  1.36377   0.729715
 1.36377   0.425589  1.58075
 0.729715  1.58075   1.11123
2 Likes
#3

Thanks, i will check out the new version then.