In general, you cannot do an in place matrix multiplication of the form x=Ax. This is only possible if A has special structure such as e.g. triangular, Toeplitz or orthogonal. However, you can do a y = A*x + y, which is what gemv does. For sparse matrices this is achievable with A_mul_B!, i.e.
A = sprandn(10, 10, 0.3); x = randn(10); y = Array(Float64, 10); A_mul_B!(y, A, x) Med venlig hilsen Andreas Noack 2014-11-03 8:58 GMT-05:00 <[email protected]>: > If I understand correctly, operations such as `v = A*v`, where A is a > dense matrix and v is a vector, create temporaries and allocate memory; if > one wishes to do the computation in place without allocation, the only > solution is using directly `gemv!`. > > What if `A` is a sparse matrix? Is there an in-place alternative to `v = > A*v`? > > Thanks, > --federico >
