---
title: vDSP_sve
framework: Kernel
role: symbol
role_heading: Function
platforms: [macOS 10.4+]
path: kernel/1579937-vdsp_sve
---

# vDSP_sve

Calculates the sum of values in a single-precision vector.

## Declaration

```occ
void vDSP_sve(const float *__A, vDSP_Stride __I, float *__C, vDSP_Length __N);
```

## Parameters

- `__A`: Single-precision real input vector.
- `__I`: Stride for A.
- `__C`: Single-precision real output scalar.
- `__N`: The number of elements to process.

## Discussion

Discussion This function calculates the sum of the first N elements of A and writes the result to C:

The operation is:  C[0] = sum(A[n], 0 <= n < N); The following code shows an example of using vDSP_sve: let stride = vDSP_Stride(1)

let a: [Float] = [-1.5, 2.25, 3.6,                   0.2, -0.1, -4.3] let n = vDSP_Length(a.count)

var c: Float = .nan

vDSP_sve(a,          stride,          &c,          n)

// Prints "sum 0.1500" print(String(format: "sum %.4f", c))
