<!--
{
  "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/copy(_:to:count:)-7zpro",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate4vDSPO4copy_2to5countySo21DSPDoubleSplitComplexV_AHzSitFZ"
  },
  "title" : "copy(_:to:count:)"
}
-->

# copy(_:to:count:)

Copies a complex double-precision vector.

```
static func copy(_ source: DSPDoubleSplitComplex, to destination: inout DSPDoubleSplitComplex, count: Int)
```

## Parameters

`source`

The source complex vector.

`destination`

The destination complex vector.

`count`

The number of complex elements in the source and destination vectors.

## Discussion

The following code copies the complex elements in the source to the destination:

```swift
    let realSrc = UnsafeMutableBufferPointer<Double>.allocate(capacity: 4)
    _ = realSrc.initialize(from: [0, 2, 4, 6])
    
    let imagSrc = UnsafeMutableBufferPointer<Double>.allocate(capacity: 4)
    _ = imagSrc.initialize(from: [1, 3, 5, 7])
    
    let source = DSPDoubleSplitComplex(realp: realSrc.baseAddress!,
                                       imagp: imagSrc.baseAddress!)
    
    let realDst = UnsafeMutableBufferPointer<Double>.allocate(capacity: 4)
    let imagDst = UnsafeMutableBufferPointer<Double>.allocate(capacity: 4)
    
    var destination = DSPDoubleSplitComplex(realp: realDst.baseAddress!,
                                            imagp: imagDst.baseAddress!)
    
    vDSP.copy(source, to: &destination, count: 4)
    
    print(Array(realDst)) // Prints "[0.0, 2.0, 4.0, 6.0]".
    print(Array(imagDst)) // Prints "[1.0, 3.0, 5.0, 7.0]".
```

---

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)