iosframeworksmaxlapackaccelerate

Is there an iOS accelerate methods for doing elementwise maximum (np.maximum)?


I am investigating using iOS Accelerate to perform some fast math on a mobile device. I would need the equivalent of np.maximum in numpy. This is an element wise maximum between 2 ndarray.

I have been searching documentations related to Apple Accelerate Framework, and I found nothing within it that can directly perform this.

Note: The Q was answered correctly below and tested with:

let a: [Float] = [2, 4, 3, 8, 1, 10]

let b: [Float] = [1, 5, 2, 1, 9, 1]

var c: [Float] = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

vDSP_vmax(a, 1, b, 1, &c, 1, 6)

c

in a Xcode Playground.


Solution

  • Check vDSP_vmaxD(). It's what you want.