LinearAlgebra.jl
LinearAlgebra.jl copied to clipboard
should matrix-vector mul! also protect against aliasing?
As per the documentation for mul!,
https://github.com/JuliaLang/julia/blob/263928f9ad450a28d601c3f185040987e0bc45d5/stdlib/LinearAlgebra/src/matmul.jl#L266-L268
The mwe
a = rand(3, 3); v = rand(3);
mul!(a, a, a)
is 'protected' against wrong inputs for matrix-matrix product and errors w/
ERROR: ArgumentError: output matrix must not be aliased with input matrix
https://github.com/JuliaLang/julia/blob/263928f9ad450a28d601c3f185040987e0bc45d5/stdlib/LinearAlgebra/src/matmul.jl#L653-L655
however, the matrix-vector product a * v is not 'protected' against C == A || C == B
julia> mul!(v, a, v)
3-element Vector{Float64}:
0.0
0.0
0.0
should a similar alias check be applied for matrix-vector mul! at the gemv! or generic_matvecmul! methods?