<!--
{
  "documentType" : "article",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/sparse-vector-utility-operations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Sparse Vector Utility Operations"
}
-->

# Sparse Vector Utility Operations

Create and work with sparse vector structures.

## Topics

### Sparse Utility Operations

[`func sparse_get_vector_nonzero_count_double(sparse_dimension, UnsafePointer<Double>!, sparse_stride) -> Int`](/documentation/Accelerate/sparse_get_vector_nonzero_count_double(_:_:_:))

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`](/documentation/Accelerate/sparse_get_vector_nonzero_count_float(_:_:_:))

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

[`func sparse_pack_vector_double(sparse_dimension, sparse_dimension, UnsafePointer<Double>!, sparse_stride, UnsafeMutablePointer<Double>!, UnsafeMutablePointer<sparse_index>!) -> Int`](/documentation/Accelerate/sparse_pack_vector_double(_:_:_:_:_:_:))

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

[`func sparse_pack_vector_float(sparse_dimension, sparse_dimension, UnsafePointer<Float>!, sparse_stride, UnsafeMutablePointer<Float>!, UnsafeMutablePointer<sparse_index>!) -> Int`](/documentation/Accelerate/sparse_pack_vector_float(_:_:_:_:_:_:))

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

[`func sparse_unpack_vector_double(sparse_dimension, sparse_dimension, Bool, UnsafePointer<Double>!, UnsafePointer<sparse_index>!, UnsafeMutablePointer<Double>!, sparse_stride)`](/documentation/Accelerate/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.

[`func sparse_unpack_vector_float(sparse_dimension, sparse_dimension, Bool, UnsafePointer<Float>!, UnsafePointer<sparse_index>!, UnsafeMutablePointer<Float>!, sparse_stride)`](/documentation/Accelerate/sparse_unpack_vector_float(_:_:_:_:_:_:_:))

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

### Supporting Types

[`typealias sparse_dimension`](/documentation/Accelerate/sparse_dimension)

The dimension type.

[`typealias sparse_index`](/documentation/Accelerate/sparse_index)

The index type.

[`typealias sparse_stride`](/documentation/Accelerate/sparse_stride)

The stride type.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)