vectorize axpy in gradient