Get sum of element-wise products of two arrays / vDSP

I did a quick scan for all methods in vdsp framework but didn't found a method for this specific task. Is there a method for that I may have overseen?

float multiplyAndAccumulate (float* p1, float* p2, int N)
{
      float s = 0;
      const float* e = p1 + N;
      while (p1 != e)
      {
                s += (*p1) * (*p2);
                p1++;
                p2++;
      }
      return s;
}

Ah I guess this must be the right function

https://developer.apple.com/documentation/accelerate/vdsp/3240838-add#declaration

But how do I use this with c++?

The Obj-C equivalent of that method is https://developer.apple.com/documentation/accelerate/1450275-vdsp_vsadd?language=objc

And, mentioned in this post (https://developer.apple.com/forums/thread/699949):

The Accelerate “Objective C” API is actually usable from C/C++ - it doesn’t use any Obj-C only features.

Thanks for your help!

Actually I don't think this is exactly what I wanted (sum of all element-wise products of two arrays), I misinterpreted the description of the function.

In the meantime I already created my own arm neon assembler-code for that purpose.

Get sum of element-wise products of two arrays / vDSP
 
 
Q