Simple MWE:
A = ones(2,2)
v = [1.0; 2.0]
A * v # [3.0; 3.0]
A * v[2:-1:1] # [3.0; 3.0]
A * view(v, 2:-1:1) # [2.0; 2.0] ????
Is this a bug?
Simple MWE:
A = ones(2,2)
v = [1.0; 2.0]
A * v # [3.0; 3.0]
A * v[2:-1:1] # [3.0; 3.0]
A * view(v, 2:-1:1) # [2.0; 2.0] ????
Is this a bug?
Yes. The matrix multiplication ultimately dispatches to BLAS
gemv
:
via
BLAS
gemv
probably assumes that the stride is nonnegative. LinearAlgebra.generic_matvecmul!
does do the right thing though, so the latter method could just check for a negative stride and fall back to that.
Poster the issue. Thanks.