diff --git a/Sources/AccelerateLinux/MatrixOps/MatrixBasicOps.swift b/Sources/AccelerateLinux/MatrixOps/MatrixBasicOps.swift index 04a50d4..3e15419 100644 --- a/Sources/AccelerateLinux/MatrixOps/MatrixBasicOps.swift +++ b/Sources/AccelerateLinux/MatrixOps/MatrixBasicOps.swift @@ -12,6 +12,8 @@ import CBLAS /// - __M: The number of rows in the output matrix and the number of columns in the input matrix. /// - __N: The number of columns in the output matrix and the number of rows in the input matrix. /// - Warning: This function doesn’t support in-place operation. +@inlinable +@inline(__always) public func vDSP_mtransD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -42,6 +44,8 @@ public func vDSP_mtransD( /// - __M: The number of rows in matrices A and C. /// - __N: The number of columns in matrices B and C. /// - __P: The number of columns in matrix A and the number of rows in matrix B. +@inlinable +@inline(__always) public func vDSP_mmulD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, diff --git a/Sources/AccelerateLinux/VectorOps/VectorBasicOps.swift b/Sources/AccelerateLinux/VectorOps/VectorBasicOps.swift index 648749e..651dec1 100644 --- a/Sources/AccelerateLinux/VectorOps/VectorBasicOps.swift +++ b/Sources/AccelerateLinux/VectorOps/VectorBasicOps.swift @@ -10,6 +10,8 @@ import Glibc /// - __I: The stride of the vector. /// - __C: The maximum value. /// - __N: The number of elements in the vector. +@inlinable +@inline(__always) public func vDSP_maxvD( _ __A: UnsafePointer, _ __I: vDSP_Stride, @@ -31,6 +33,8 @@ public func vDSP_maxvD( /// - __I: The stride of the vector. /// - __C: The minimum value. /// - __N: The number of elements in the vector. +@inlinable +@inline(__always) public func vDSP_minvD( _ __A: UnsafePointer, _ __I: vDSP_Stride, @@ -55,6 +59,8 @@ public func vDSP_minvD( /// - __C: The output vector, C. /// - __IC: The distance between the elements in the output vector. /// - __N: The number of elements that the function processes. +@inlinable +@inline(__always) public func vDSP_vaddD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -80,6 +86,8 @@ public func vDSP_vaddD( /// - __C: The output vector, C. /// - __IC: The distance between the elements in the output vector. /// - __N: The number of elements that the function processes. +@inlinable +@inline(__always) public func vDSP_vsubD( _ __B: UnsafePointer, _ __IB: vDSP_Stride, @@ -105,6 +113,8 @@ public func vDSP_vsubD( /// - __C: The output vector, C. /// - __IC: The distance between the elements in the output vector. /// - __N: The number of elements that the function processes. +@inlinable +@inline(__always) public func vDSP_vmulD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -127,6 +137,8 @@ public func vDSP_vmulD( /// - _: The exponent input array, y. /// - _: The base input array, x. /// - _: The number of elements in the arrays. +@inlinable +@inline(__always) public func vvpow( _ z: UnsafeMutablePointer, _ y: UnsafePointer, @@ -158,6 +170,8 @@ public func vvpow( /// - __C: Double-precision real output vector. /// - __IC: Address stride for C. /// - __N: The number of elements to process. +@inlinable +@inline(__always) public func vDSP_vclrD( _ __C: UnsafeMutablePointer, _ __IC: vDSP_Stride, @@ -188,6 +202,8 @@ public func vDSP_vfillD( /// - __C: On output, the absolute values of the elements in the input vector. /// - __IC: The distance between the elements in the output vector C. /// - __N: The number of elements that the function processes. +@inlinable +@inline(__always) public func vDSP_vabsD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -209,6 +225,8 @@ public func vDSP_vabsD( /// - __C: On output, the negative values of the elements in the input vector. /// - __IC: The distance between the elements in the output vector C. /// - __N: The number of elements that the function processes. +@inlinable +@inline(__always) public func vDSP_vnegD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -224,6 +242,8 @@ public func vDSP_vnegD( } /// Computes the squared value of each element in the supplied double-precision vector. +@inlinable +@inline(__always) public func vDSP_vsqD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -246,6 +266,8 @@ public func vDSP_vsqD( /// - __IB: The distance between the elements in the input vector B. /// - __C: On output, the dot product of the two vectors. /// - __N: The number of elements to process. +@inlinable +@inline(__always) public func vDSP_dotprD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -263,6 +285,8 @@ public func vDSP_dotprD( } /// Calculates the double-precision vector test limit using the specified stride. +@inlinable +@inline(__always) public func vDSP_vlimD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -290,6 +314,8 @@ public func vDSP_vlimD( /// - __N: The number of elements that the function clips to the specified range. /// - __NLow: On output, the number of elements clipped to the low-clipping threshold. /// - __NHigh: On output, the number of elements clipped to the high-clipping threshold. +@inlinable +@inline(__always) public func vDSP_vclipcD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -327,6 +353,8 @@ public func vDSP_vclipcD( /// Integrates vector A using a running sum from vector C. /// Vector A is weighted by scalar *S and added to the previous output point. /// The first element from vector A is not used in the sum. +@inlinable +@inline(__always) public func vDSP_vrsumD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -356,6 +384,8 @@ public func vDSP_vrsumD( /// - __N: The number of elements in the vector. /// - __Order: A value that specifies the sort order. Pass 1 to specify ascending order, or -1 for descending order. #warning("If the array is bigger than Int.max, vDSP_vsortD will do nothing. Find a solution") +@inlinable +@inline(__always) public func vDSP_vsortD( _ __C: UnsafeMutablePointer, _ __N: vDSP_Length, @@ -388,6 +418,8 @@ public func vDSP_vsortD( /// - __C: The output vector. /// - __IC: The distance between the elements in the output vector. /// - __N: The number of elements that the function processes. +@inlinable +@inline(__always) public func vDSP_vrampD( _ __A: UnsafePointer, _ __B: UnsafePointer, @@ -416,6 +448,8 @@ public func vDSP_vrampD( /// for (n = 0; n < N; ++n) /// C[n] = A[n] <= B[n] ? A[n] : B[n]; /// ``` +@inlinable +@inline(__always) public func vDSP_vminD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -441,6 +475,8 @@ public func vDSP_vminD( /// - __C: Double-precision real output vector. /// - __IC: Stride for C. /// - __N: The number of elements to process. +@inlinable +@inline(__always) public func vDSP_vmaxD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -466,6 +502,8 @@ public func vDSP_vmaxD( /// - __C: The output vector, C. /// - __IC: The distance between the elements in the output vector. /// - __N: The number of elements that the function processes. +@inlinable +@inline(__always) public func vDSP_vdivD( _ __B: UnsafePointer, _ __IB: vDSP_Stride, @@ -490,6 +528,8 @@ public func vDSP_vdivD( /// - __C: The output vector, C. /// - __IC: The distance between the elements in the output vector. /// - __N: The number of elements that the function processes. +@inlinable +@inline(__always) public func vDSP_vsdivD( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -513,6 +553,8 @@ public func vDSP_vsdivD( /// /// If x is +/-0, the result preserves the signed zero. /// If x is +/-inf, the result is NaN. +@inlinable +@inline(__always) public func vvsin( _ y: UnsafeMutablePointer, _ x: UnsafePointer, @@ -530,6 +572,8 @@ public func vvsin( /// - y: The output array, y. /// - x: The input array, x. /// - n: The number of elements in the arrays. +@inlinable +@inline(__always) public func vvsqrt( _ y: UnsafeMutablePointer, _ x: UnsafePointer, @@ -547,6 +591,8 @@ public func vvsqrt( /// - y: The output array, y. /// - x: The input array, x. /// - n: The number of elements in the arrays. +@inlinable +@inline(__always) public func vvexp( _ y: UnsafeMutablePointer, _ x: UnsafePointer, @@ -564,6 +610,8 @@ public func vvexp( /// - y: The output array, y. /// - x: The input array, x. /// - n: The number of elements in the arrays. +@inlinable +@inline(__always) public func vvlog( _ y: UnsafeMutablePointer, _ x: UnsafePointer, @@ -576,7 +624,8 @@ public func vvlog( } } -private func quicksort( +@usableFromInline +func quicksort( _ vec: UnsafeMutablePointer, _ len: vDSP_Length, _ ord: Int32, diff --git a/Sources/AccelerateLinux/VectorOps/VectorTransformOps.swift b/Sources/AccelerateLinux/VectorOps/VectorTransformOps.swift index 096e601..7cac3e0 100644 --- a/Sources/AccelerateLinux/VectorOps/VectorTransformOps.swift +++ b/Sources/AccelerateLinux/VectorOps/VectorTransformOps.swift @@ -9,6 +9,8 @@ /// - __C: The output vector. /// - __IC: The distance between the elements in the output vector. /// - __N: The number of elements that the function processes. +@inlinable +@inline(__always) public func vDSP_vdpsp( _ __A: UnsafePointer, _ __IA: vDSP_Stride, @@ -30,6 +32,8 @@ public func vDSP_vdpsp( /// - __C: The output vector. /// - __IC: The distance between the elements in the output vector. /// - __N: The number of elements that the function processes. +@inlinable +@inline(__always) public func vDSP_vspdp( _ __A: UnsafePointer, _ __IA: vDSP_Stride, diff --git a/Sources/AccelerateLinux/VectorOps/vDSP+StatisticalOps.swift b/Sources/AccelerateLinux/VectorOps/vDSP+StatisticalOps.swift index 3334a95..9c07927 100644 --- a/Sources/AccelerateLinux/VectorOps/vDSP+StatisticalOps.swift +++ b/Sources/AccelerateLinux/VectorOps/vDSP+StatisticalOps.swift @@ -5,6 +5,8 @@ extension vDSP { /// Returns the mean value of a double-precision vector. /// - Parameter vector: The source vector. + @inlinable + @inline(__always) public static func mean(_ vector: U) -> Double where U: AccelerateBuffer, U.Element == Double { sum(vector) / Double(vector.count) }