Skip to content

Commit 3fa56c9

Browse files
committed
Add vDSP_vspdp
1 parent 2d07b58 commit 3fa56c9

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,4 @@ The package is structured as follows:
8585
- [x] `vDSP.mean` - Mean of a vector
8686
- `Transforms`:
8787
- [x] `vDSP_vdpsp` - Convert a double vector to a single precision vector
88-
- [ ] `vDSP_vspdp` - Convert a single precision vector to a double precision vector
88+
- [x] `vDSP_vspdp` - Convert a single precision vector to a double precision vector

Sources/AccelerateLinux/VectorOps/VectorTransformOps.swift

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,25 @@ public func vDSP_vdpsp(
2222
i += 1
2323
}
2424
}
25+
26+
/// Converts a single-precision vector to a double-precision vector.
27+
/// - Parameters:
28+
/// - __A: The input vector.
29+
/// - __IA: The distance between the elements in the input vector.
30+
/// - __C: The output vector.
31+
/// - __IC: The distance between the elements in the output vector.
32+
/// - __N: The number of elements that the function processes.
33+
public func vDSP_vspdp(
34+
_ __A: UnsafePointer<Float>,
35+
_ __IA: vDSP_Stride,
36+
_ __C: UnsafeMutablePointer<Double>,
37+
_ __IC: vDSP_Stride,
38+
_ __N: vDSP_Length
39+
) {
40+
var i = 0
41+
while i < __N {
42+
__C[i * __IC] = Double(__A[i * __IA])
43+
i += 1
44+
}
45+
}
2546
#endif

0 commit comments

Comments
 (0)