<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vDSP/clear(_:)-5f0gr",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate4vDSPO5clearyyxzAA0A13MutableBufferRzSf7ElementRtzlFZ"
  },
  "title" : "clear(_:)"
}
-->

# clear(_:)

Populates a single-precision vector with zeros.

```
static func clear<V>(_ vector: inout V) where V : AccelerateMutableBuffer, V.Element == Float
```

## Parameters

`vector`

The vector to populate with zeros.

## Discussion

This function populates a vector with zeros.

The following code shows how to clear the array c, setting the value of each element to zero:

```swift
var c = [Float](repeating: .nan,
                count: 10)

vDSP.clear(&c)

// Prints "[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]"
print(c)
```

---

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)