The BLAS_AXPY procedure updates an existing array by adding a multiple of another array. It can also be used to update one or more one-dimensional subvectors of an array according to the following vector operation:

where S is a scale factor and X is an input vector.

BLAS_AXPY can be faster and use less memory than the usual IDL array notation

(e.g. ```
Y=Y+A*X
```

) for updating existing arrays.

**NOTE: **
BLAS_AXPY is much faster when operating on entire arrays and rows, than when used on columns or higher dimensions.

The array to be updated. *
Y *
can be of any scalar numeric type. REPLICATE_INPLACE does not change the size and type of *
Y*
.

The scalar value which will fill all or part of *
X*
. *
Value*
may be any scalar type that IDL can convert to the type of *
X*
. REPLICATE_INPLACE does not change *
Value*
.

The array to be scaled and added to array *
Y*
, or the vector to be scaled and added to subvectors of *
Y*
. *
X*
must be of the same type as *
Y*
.

An array with the same number of elements as the number of dimensions of *
X*
. The *
Loc1 *
and *
D1*
arguments together determine which one-dimensional subvector (or subvectors, if *
D1*
and *
Range*
are provided) of *
X*
is to be updated.

seed = 5L *;
A seed value needs to be defined*

A = FINDGEN(40, 90, 10)*;
Create a multidimensional array.*

B = RANDOMU(40, 90, 10)*;
Create a random update.*

BLAS_AXPY, A, 4.5, B*;
Add a multiple of B to A.
(i.e., A = A + 4.5*B )*

BLAS_AXPY, A, 1., REPLICATE(4.3, 40), 1, [0,4,9]

*;
Add a constant to a subvector of A. (i.e. A[*,4,9] = A[*,4,9] + 4.3)*

C = FINDGEN(90)*;
Create a vector update.*

BLAS_AXPY, A, 1., C, 2, [9,0,0], 3, LINDGEN(10)

*;
Add C to a group of subvectors of A. ( i.e. A[ 9,*,*] = A[ 9,*,*] + C)*