Function

Scales the sparse vector x by alpha and adds the result to the dense vector y, with both vectors containing single-precision values.

## Parameters

`nz`

The number of nonzero entries in the sparse vector x.

`alpha`

Scalar multiplier of x.

`x`

Pointer to the dense storage for the values of the sparse vector x. The corresponding entry in `indx` holds the index of the value. Contains `nz` values.

`indx`

Pointer to the dense storage for the index values of the sparse vector x. The corresponding entry in x holds the values of the vector. Contains `nz` values.

`y`

Pointer to the dense vector y. Accessed as `y[indx[0..nz-1]*incy]`, so dimension must be compatible with largest index value in `indx`. The behavior of this function is undefined if this is not met. Negative strides are supported. Note, unlike dense BLAS routines, the pointer points to the last element when stride is negative.

`incy`

Increment between valid values in the dense vector y. Negative strides are supported.

## Discussion

Performs the operation y = alpha * x + y in place. If `alpha` or `nz` is zero, y is unchanged.

Scales the sparse vector x by alpha and adds the result to the dense vector y.

If the desired operation is y = alpha * x, then an efficient option is to create the y buffer of zeros and then perform the operation with the zero filled y.

Indices in `indx` are always assumed to be stored in ascending order. Additionally, indices are assumed to be unique. The behavior of this function is undefined if either of these assumptions are not met.

All indices are 0 based (the first element of a pointer is `ptr`).

### Vector-Vector Operations

`func sparse_inner_product_dense_double(sparse_dimension, UnsafePointer<Double>!, UnsafePointer<sparse_index>!, UnsafePointer<Double>!, sparse_stride) -> Double`

Computes the inner product of sparse vector x with double-precision y, with both vectors containing double-precision values.

`func sparse_inner_product_dense_float(sparse_dimension, UnsafePointer<Float>!, UnsafePointer<sparse_index>!, UnsafePointer<Float>!, sparse_stride) -> Float`

Computes the inner product of sparse vector x with dense vector y, with both vectors containing single-precision values.

`func sparse_vector_add_with_scale_dense_double(sparse_dimension, Double, UnsafePointer<Double>!, UnsafePointer<sparse_index>!, UnsafeMutablePointer<Double>!, sparse_stride)`

Scales the sparse vector x by alpha and adds the result to the dense vector y, with both vectors containing double-precision values.