Hi Alex —
The problem you’re running into is actually precisely that vDSP uses the single-pass algorithm for mean and standard deviation:
vDSP_sve_svesq(data, 1, &Sum, &SumSquares, numDataPoints);
mean = Sum / numDataPoints;
deviation = sqrt(SumSquares / numDataPoints - mean*mean);
Your data is sufficiently ill-conditioned that the single-pass algorithm cannot produce an accurate result. One good option is to handle this by trying to use the single pass algorithm as sketched above, and falling back onto the two-pass algorithm if the computed deviation is either NaN or very small compared to the average squared value (vDSP does not use this two-pass algorithm itself because one of the requirements of vDSP is that it deliver *predictable* performance whenever possible; the time required should not vary depending on the data).
– Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list (PerfOptimi...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/perfoptimization-dev/perfoptimization-dev-garchive-8409%40googlegroups.com
This email sent to perfoptimization-...@googlegroups.com