Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Sources/AccelerateLinux/MatrixOps/MatrixBasicOps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand Down Expand Up @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand Down
51 changes: 50 additions & 1 deletion Sources/AccelerateLinux/VectorOps/VectorBasicOps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Double>,
_ __I: vDSP_Stride,
Expand All @@ -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<Double>,
_ __I: vDSP_Stride,
Expand All @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand All @@ -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<Double>,
_ __IB: vDSP_Stride,
Expand All @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand All @@ -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<Double>,
_ y: UnsafePointer<Double>,
Expand Down Expand Up @@ -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<Double>,
_ __IC: vDSP_Stride,
Expand Down Expand Up @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand All @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand All @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand All @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand All @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand Down Expand Up @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand Down Expand Up @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand Down Expand Up @@ -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<Double>,
_ __N: vDSP_Length,
Expand Down Expand Up @@ -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<Double>,
_ __B: UnsafePointer<Double>,
Expand Down Expand Up @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand All @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand All @@ -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<Double>,
_ __IB: vDSP_Stride,
Expand All @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand All @@ -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<Double>,
_ x: UnsafePointer<Double>,
Expand All @@ -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<Double>,
_ x: UnsafePointer<Double>,
Expand All @@ -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<Double>,
_ x: UnsafePointer<Double>,
Expand All @@ -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<Double>,
_ x: UnsafePointer<Double>,
Expand All @@ -576,7 +624,8 @@ public func vvlog(
}
}

private func quicksort(
@usableFromInline
func quicksort(
_ vec: UnsafeMutablePointer<Double>,
_ len: vDSP_Length,
_ ord: Int32,
Expand Down
4 changes: 4 additions & 0 deletions Sources/AccelerateLinux/VectorOps/VectorTransformOps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Double>,
_ __IA: vDSP_Stride,
Expand All @@ -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<Float>,
_ __IA: vDSP_Stride,
Expand Down
2 changes: 2 additions & 0 deletions Sources/AccelerateLinux/VectorOps/vDSP+StatisticalOps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<U>(_ vector: U) -> Double where U: AccelerateBuffer, U.Element == Double {
sum(vector) / Double(vector.count)
}
Expand Down