Sum of Squared Differences


Is there anything in the JUCE lib for doing sum of squared differences?

I tried to add accelerate to my app, but was getting quite a bit of errors including the header

There is a method to calculate the RMS (root mean square) named AudioBuffer::getRMSLevel()
Unfortunately it is not a vector operation, but a small loop which should perform quite fast.
You can experiment with FloatVectorOperations like and give it the same pointer twice, so you get the squares. But you have to calculate the average by summing up, and I don’t see a vector operation for that, so maybe you end up with the same runtime as if you use the loop of getRMSLevel.

Not sure if this fits your use case since you didn’t specify it, but there is a little utility in JUCE called StatisticsAccumulator that could perhaps be useful?

1 Like