sparse_unpack_vector_double(_:_:_:_:_:_:_:)
Extracts elements from the sparse vector x into the corresponding location in the dense vector y, with both vectors containing double-precision values.
Declaration
func sparse_unpack_vector_double(_ N: sparse_dimension, _ nz: sparse_dimension, _ zero: Bool, _ x: UnsafePointer<Double>!, _ indx: UnsafePointer<sparse_index>!, _ y: UnsafeMutablePointer<Double>!, _ incy: sparse_stride)Parameters
- N:
The number of elements in the dense vector y.
- nz:
The number of nonzero entries in the sparse vector x.
- zero:
When True, zero the elements of y which do not have nonzero values written to them. When False ignore the elements of y which do not have nonzero values written to them.
- x:
Pointer to the dense storage for the values of the sparse vector x. The corresponding entry in
indxholds the index of the value. Containsnzvalues. - 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
nzvalues.Indices are always assumed to be stored in ascending order. Additionally, indices are assumed to be unique. Undefined behavior if either of these assumptions are not met.All indices are 0 based (the first element of a pointer is
ptr[0]). - y:
Pointer to the dense vector y. Expected to be of size
N * abs(incy)elements. Negative strides are supported. Note, unlike dense BLAS routines, the pointer points to the last element when stride is negative. On exit, the entries described by the indices inindxwill be filled with the corresponding values inxand all other values will be unchanged if parameter zero is False, or set to zero if parameter zero is True. - incy:
Increment between valid values in the dense vector y. Negative strides are supported.
Discussion
This function extracts elements from the sparse vector x into the corresponding location in the dense vector y. It can optionally zero the unused values of y by setting the zero parameter to true.
The function is equivalent to the following code.
if (zero)
for (i in 0 .. N-1)
y[i*incy] = 0;
for (i in 0 .. nz-1)
if (indx[i] < N)
y[indx[i]*incy] = x[i];On exit, y has been updated with the nonzero values. If nz is less than or equal to zero, y is unchanged.