<!--
{
  "documentType" : "article",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vector-clear-and-fill-functions",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Vector clear and fill functions"
}
-->

# Vector clear and fill functions

Populate vectors with zeros or a scalar value.

## Topics

### Clearing Vectors

[`static func clear<V>(inout V)`](/documentation/Accelerate/vDSP/clear(_:)-1t76j)

Populates a double-precision vector with zeros.

[`static func clear<V>(inout V)`](/documentation/Accelerate/vDSP/clear(_:)-5f0gr)

Populates a single-precision vector with zeros.

[`extern void vDSP_vclr(float *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vclr)

Populates a single-precision vector with zeros.

[`extern void vDSP_vclrD(double *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vclrD)

Populates a double-precision vector with zeros.

### Filling Vectors with a Single Scalar Value

[`static func fill<V>(inout V, with: Double)`](/documentation/Accelerate/vDSP/fill(_:with:)-91ud3)

Populates a double-precision vector with a specified scalar value.

[`static func fill<V>(inout V, with: Float)`](/documentation/Accelerate/vDSP/fill(_:with:)-7gfq3)

Populates a single-precision vector with a specified scalar value.

[`extern void vDSP_vfill(const float *__A, float *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vfill)

Populates a single-precision vector with a specified scalar value.

[`extern void vDSP_vfillD(const double *__A, double *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vfillD)

Populates a double-precision vector with a specified scalar value.

[`extern void vDSP_vfilli(const int *__A, int *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vfilli)

Populates an integer vector with a specified scalar value.

[`extern void vDSP_zvfill(const DSPSplitComplex *__A, const DSPSplitComplex *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_zvfill)

Populates a complex single-precision vector with a specified scalar value.

[`extern void vDSP_zvfillD(const DSPDoubleSplitComplex *__A, const DSPDoubleSplitComplex *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_zvfillD)

Populates a complex double-precision vector with a specified scalar value.



---

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)