---
title: "sparse_pack_vector_float(_:_:_:_:_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/sparse_pack_vector_float(_:_:_:_:_:_:)"
---

# sparse_pack_vector_float(_:_:_:_:_:_:)

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

## Declaration

```swift
func sparse_pack_vector_float(_ N: sparse_dimension, _ nz: sparse_dimension, _ x: UnsafePointer<Float>!, _ incx: sparse_stride, _ y: UnsafeMutablePointer<Float>!, _ 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

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

## Discussion

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. important: Apple provides the BLAS and LAPACK libraries under the Accelerate framework to be in line with LAPACK 3.9.1. Starting with iOS 26, iPadOS 26, macOS 26, tvOS 26, visionOS 26, and watchOS 26, the libraries are in line with LAPACK 3.12.0. These new interfaces provide additional functionality, as well as a new ILP64 interface. To use the new interfaces, define ACCELERATE_NEW_LAPACK before including the Accelerate or vecLib headers. For ILP64 interfaces, also define ACCELERATE_LAPACK_ILP64. For Swift projects, specify ACCELERATE_NEW_LAPACK=1 and ACCELERATE_LAPACK_ILP64=1 as preprocessor macros in Xcode build settings under Apple Clang - Preprocessing > Preprocessor Macros.

## See Also

### Sparse Utility Operations

- [sparse_get_vector_nonzero_count_double(_:_:_:)](accelerate/sparse_get_vector_nonzero_count_double(_:_:_:).md)
- [sparse_get_vector_nonzero_count_float(_:_:_:)](accelerate/sparse_get_vector_nonzero_count_float(_:_:_:).md)
- [sparse_pack_vector_double(_:_:_:_:_:_:)](accelerate/sparse_pack_vector_double(_:_:_:_:_:_:).md)
- [sparse_unpack_vector_double(_:_:_:_:_:_:_:)](accelerate/sparse_unpack_vector_double(_:_:_:_:_:_:_:).md)
- [sparse_unpack_vector_float(_:_:_:_:_:_:_:)](accelerate/sparse_unpack_vector_float(_:_:_:_:_:_:_:).md)
