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

# sparse_vector_norm_double(_:_:_:_:)

Computes the specified norm of the double-precision sparse vector x.

## Declaration

```swift
func sparse_vector_norm_double(_ nz: sparse_dimension, _ x: UnsafePointer<Double>!, _ indx: UnsafePointer<sparse_index>!, _ norm: sparse_norm) -> Double
```

## Parameters

- `nz`: The number of nonzero values 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.
- `norm`: The norm to be computed. Must be one of doc://com.apple.accelerate/documentation/Accelerate/SPARSE_NORM_ONE, doc://com.apple.accelerate/documentation/Accelerate/SPARSE_NORM_TWO, or doc://com.apple.accelerate/documentation/Accelerate/SPARSE_NORM_INF. See discussion for further details.

## Return Value

Return Value The requested norm.

## Discussion

Discussion Compute the specified norm of the sparse vector x.  Specify one of: | SPARSE_NORM_ONE | sumᵢ ( | x[i] | ) | |—|—| | SPARSE_NORM_TWO | sqrt ( sumᵢ (x[i])² ) | | SPARSE_NORM_INF | maxᵢ( | x[i] | ) | | SPARSE_NORM_R1 | Not supported, undefined. | If norm is not one of the enumerated norm types, the default value is SPARSE_NORM_INF. 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.

## See Also

### Vector-Vector Operations

- [sparse_inner_product_dense_double(_:_:_:_:_:)](accelerate/sparse_inner_product_dense_double(_:_:_:_:_:).md)
- [sparse_inner_product_dense_float(_:_:_:_:_:)](accelerate/sparse_inner_product_dense_float(_:_:_:_:_:).md)
- [sparse_inner_product_sparse_double(_:_:_:_:_:_:)](accelerate/sparse_inner_product_sparse_double(_:_:_:_:_:_:).md)
- [sparse_inner_product_sparse_float(_:_:_:_:_:_:)](accelerate/sparse_inner_product_sparse_float(_:_:_:_:_:_:).md)
- [sparse_vector_add_with_scale_dense_double(_:_:_:_:_:_:)](accelerate/sparse_vector_add_with_scale_dense_double(_:_:_:_:_:_:).md)
- [sparse_vector_add_with_scale_dense_float(_:_:_:_:_:_:)](accelerate/sparse_vector_add_with_scale_dense_float(_:_:_:_:_:_:).md)
- [sparse_vector_norm_float(_:_:_:_:)](accelerate/sparse_vector_norm_float(_:_:_:_:).md)
