Closed
Description
Consider the following:
julia> U = UpperTriangular(Float64[1 2 3; 0 1 2; 0 0 1])
3×3 UpperTriangular{Float64,Array{Float64,2}}:
1.0 2.0 3.0
⋅ 1.0 2.0
⋅ ⋅ 1.0
julia> X = randn(3, 3)
3×3 Array{Float64,2}:
0.9189 -0.942656 -0.825467
-0.346463 0.829813 0.741945
-0.239974 -0.232412 1.46933
julia> U .+= X
3×3 UpperTriangular{Float64,Array{Float64,2}}:
1.9189 1.05734 2.17453
⋅ 1.82981 2.74194
⋅ ⋅ 2.46933
Note that U
was updated with the result of elementwise addition with X
. However, U
is still an UpperTriangular
, even though the right hand side of the addition is not. Generally speaking, the result of adding two matrices is only upper triangular if both are.
It seems to me that the case of updating a structured matrix should not work except when the operation would produce a matrix of the same structure.