Function

sparse_pack_vector_double(_:_:_:_:_:_:)

Packs nonzero values from a double-precision dense vector to a destination array.

Declaration

func sparse_pack_vector_double(_ N: sparse_dimension, _ nz: sparse_dimension, _ x: UnsafePointer<Double>!, _ incx: sparse_stride, _ y: UnsafeMutablePointer<Double>!, _ indy: UnsafeMutablePointer<sparse_index>!) -> Int

Parameters

N

The number of elements in the dense vector x.

nz

The number of nonzero values to collect. If less than nz nonzero elements are found in the N elements of x, then the last nz - actual_nonzero_count of y and indy are unused.

x

Pointer to the dense vector x.

incx

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

y

The destination dense storage of nonzero values of x. Expected to be of size nz elements.

indy

The destination dense storage of nonzero indices of x. Expected to be of size nz elements.

Return Value

The number of nonzero values written. On success, y and indy are updated with up to the first nz nonzero indices.

Discussion

Pack the first nz nonzero values and indices from the dense vector x and place them in y and indy. If less than nz nonzero elements are found in the N elements of x, then the last nz - actual_nonzero_count elements of y and indy are unused. The number of indices written can range from 0 to nz values and the number written is returned.

See Also

Sparse Utility Operations

func sparse_get_vector_nonzero_count_double(sparse_dimension, UnsafePointer<Double>!, sparse_stride) -> Int

Returns the number of nonzero values in the double-precision dense vector x.

func sparse_get_vector_nonzero_count_float(sparse_dimension, UnsafePointer<Float>!, sparse_stride) -> Int

Returns the number of nonzero values in the single-precision dense vector x.

func sparse_unpack_vector_double(sparse_dimension, sparse_dimension, Bool, UnsafePointer<Double>!, UnsafePointer<sparse_index>!, UnsafeMutablePointer<Double>!, sparse_stride)

Extracts elements from the sparse vector x into the corresponding location in the dense vector y, with both vectors containing double-precision values.

func sparse_unpack_vector_float(sparse_dimension, sparse_dimension, Bool, UnsafePointer<Float>!, UnsafePointer<sparse_index>!, UnsafeMutablePointer<Float>!, sparse_stride)

Extracts elements from the sparse vector x into the corresponding location in the dense vector y, with both vectors containing single-precision values.