<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/sparse_inner_product_dense_float(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@sparse_inner_product_dense_float"
  },
  "title" : "sparse_inner_product_dense_float(_:_:_:_:_:)"
}
-->

# sparse_inner_product_dense_float(_:_:_:_:_:)

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

```
func sparse_inner_product_dense_float(_ nz: sparse_dimension, _ x: UnsafePointer<Float>!, _ indx: UnsafePointer<sparse_index>!, _ y: UnsafePointer<Float>!, _ incy: sparse_stride) -> Float
```

## Parameters

`nz`

The number of nonzero entries in the sparse vector 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.

## Return Value

The inner product of sparse vector *x* with dense vector *y*.  Returns zero if `nz` is less than or equal to zero.

## Discussion

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[0]`).

> 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.

---

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)