 // MARK: Minimum
 
 public func min(x: [Float]) -> Float {
-    var result: Float = 0.0
-    vDSP_minv(x, 1, &result, vDSP_Length(x.count))
+    return min(x, range: 0..<x.count)
+}
+
+public func min(x: [Float], range: Range<Int>) -> Float {
+    let p = UnsafePointer<Float>(x) + range.startIndex
+
+    var result: Float = 0.0
+    vDSP_minv(p, 1, &result, vDSP_Length(range.count))
 
     return result
 }
 
 public func min(x: [Double]) -> Double {
-    var result: Double = 0.0
-    vDSP_minvD(x, 1, &result, vDSP_Length(x.count))
+    return min(x, range: 0..<x.count)
+}
+
+public func min(x: [Double], range: Range<Int>) -> Double {
+    let p = UnsafePointer<Double>(x) + range.startIndex
+
+    var result: Double = 0.0
+    vDSP_minvD(p, 1, &result, vDSP_Length(range.count))
 
     return result
 }

// MARK: Mean Magnitude

public func meamg(x: [Float]) -> Float {
    var result: Float = 0.0
    vDSP_meamgv(x, 1, &result, vDSP_Length(x.count))

    return result
}

public func meamg(x: [Double]) -> Double {
    var result: Double = 0.0
    vDSP_meamgvD(x, 1, &result, vDSP_Length(x.count))

    return result
}

// MARK: Mean

public func mean(x: [Float]) -> Float {
    return mean(x, range: 0..<x.count)
}

public func mean(x: [Float], range: Range<Int>) -> Float {
    let p = UnsafePointer<Float>(x) + range.startIndex

    var result: Float = 0.0
    vDSP_meanv(p, 1, &result, vDSP_Length(range.count))

    return result
}

public func mean(x: [Double]) -> Double {
    return mean(x, range: 0..<x.count)
}

public func mean(x: [Double], range: Range<Int>) -> Double {
    let p = UnsafePointer<Double>(x) + range.startIndex

    var result: Double = 0.0
    vDSP_meanvD(p, 1, &result, vDSP_Length(range.count))

    return result
}
