Vector scale (zaio_vectorScale)
Description
This function scales an input vector, x, by a constant, alpha, and adds the result to another vector, y. If scaling is desired, you can initialize vector y with zeros. Both vectors must be of the same size.
Note: This function is enabled with directive
_ZAIO_SOURCE 2
prior
to the inclusion of the library header.
#define _ZAIO_SOURCE 2
#include <zaio.h>
Format
zaio_status_t zaio_vectorScale(float *x, float *y, float alpha, int v_size);
Parameters
- float *x
- A pointer to the first vector of size v_size.
- float *y
- A pointer to the second vector of size v_size.
- float alpha
- The scale constant to apply to x.
- int v_size
- The dimension of both vectors.
Returns
The function returns a status of zaio_status_t, of which the rightmost 16 bits denote the return code.
Notes
This is a destructive operation. The y vector will return containing the results of the scalar and addition operations. If the y vector needs to be preserved, use the zaio_vectorCopy function to create a copy prior to calling this function.