JuliaLang/julia — pull request #5189 by stevengj (2013-12-18 18:56:48+00:00)
Title: add generic fallback for Blas.LinAlg.axpy!

In cases where one wants to use `axpy!` to reduce memory allocation (see e.g. Julialang/IterativeSolvers.jl#16), it is annoying that it is only defined for `Array`s of `BlasFloat` types. This patch provides a fallback for arbitrary array-like and range-like types.

Also, I noticed that `axpy!(alpha, x, y)` for BLAS types returned `y`, but `axpy!(alpha, x, rx, y, ry)` returned a pointer to data in `y`. The latter exposure of the internal implementation seems undesirable and not very useful, so I modified it to return `y`.