@@ -16,8 +16,10 @@ public func vDSP_maxvD(
1616) {
1717 __C. pointee = - Double. infinity
1818 guard __N > 0 else { return }
19- for i in 1 ..< __N {
19+ var i = 1
20+ while i < __N {
2021 __C. pointee = max ( __C. pointee, __A [ Int ( i) * __I] )
22+ i += 1
2123 }
2224}
2325
@@ -35,8 +37,60 @@ public func vDSP_minvD(
3537) {
3638 __C. pointee = Double . infinity
3739 guard __N > 0 else { return }
38- for i in 1 ..< __N {
40+ var i = 1
41+ while i < __N {
3942 __C. pointee = min ( __C. pointee, __A [ Int ( i) * __I] )
43+ i += 1
44+ }
45+ }
46+
47+ /// Calculates the double-precision element-wise sum of two vectors, using the specified stride.
48+ /// - Parameters:
49+ /// - __A: The first input vector, A.
50+ /// - __IA: The distance between the elements in the first input vector.
51+ /// - __B: The second input vector, B.
52+ /// - __IB: The distance between the elements in the second input vector.
53+ /// - __C: The output vector, C.
54+ /// - __IC: The distance between the elements in the output vector.
55+ /// - __N: The number of elements that the function processes.
56+ public func vDSP_vaddD(
57+ _ __A: UnsafePointer < Double > ,
58+ _ __IA: vDSP_Stride ,
59+ _ __B: UnsafePointer < Double > ,
60+ _ __IB: vDSP_Stride ,
61+ _ __C: UnsafeMutablePointer < Double > ,
62+ _ __IC: vDSP_Stride ,
63+ _ __N: vDSP_Length
64+ ) {
65+ var i = 0
66+ while i < __N {
67+ __C [ Int ( i) * __IC] = __A [ Int ( i) * __IA] + __B[ Int ( i) * __IB]
68+ i += 1
69+ }
70+ }
71+
72+ /// Calculates the double-precision element-wise subtraction of two vectors, using the specified stride.
73+ /// - Parameters:
74+ /// - __B: The first input vector, B.
75+ /// - __IB: The distance between the elements in the first input vector.
76+ /// - __A: The second input vector, A.
77+ /// - __IA: The distance between the elements in the second input vector.
78+ /// - __C: The output vector, C.
79+ /// - __IC: The distance between the elements in the output vector.
80+ /// - __N: The number of elements that the function processes.
81+ public func vDSP_vsubD(
82+ _ __B: UnsafePointer < Double > ,
83+ _ __IB: vDSP_Stride ,
84+ _ __A: UnsafePointer < Double > ,
85+ _ __IA: vDSP_Stride ,
86+ _ __C: UnsafeMutablePointer < Double > ,
87+ _ __IC: vDSP_Stride ,
88+ _ __N: vDSP_Length
89+ ) {
90+ var i = 0
91+ while i < __N {
92+ __C [ Int ( i) * __IC] = __A [ Int ( i) * __IA] - __B[ Int ( i) * __IB]
93+ i += 1
4094 }
4195}
4296#endif
0 commit comments