-
Notifications
You must be signed in to change notification settings - Fork 63
various problems with STDDEV() when numbers are equals #2029
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@alaingdl I mention this for newbies, as you know this pretty well, the stddev results in gdl are 'correct' a they show the numeric accuracy of a series of 10000 (resp. 10000) sums and divide of floating point values.
To reproduce (and this is true for all other GDL commands involving floating-point adds/mults etc) exactly the IDL results, one would have not only to use the same machine-compied, optimised, algorithm (same order of adds, divide, etc at assembly level) but also in many cases the same amount of operations in each one of the parallel threads when OMP_NUM_THREADS is > 1. In other words: impossible. However, you should be fair with GDL, you have pinpointed a case where IDL and GDL differ, but
and not 0 ! So you are right, to get 0 in some cases IDL must have taken precautions for this special case.
and
So this is not a "all values are equal" test thing. The returned "NaN" (a bug indeed) would be a signature of the (apparently not completely successful!) attempt to a posteriori do something if the returned stddev is smaller than the expected accuracy (depending on number of atomic operations, single or double). A 'simple' solution would be to do all computations in extended precision (we have no 128 bits double doubles, so this would work only for floats:)
|
@alaingdl BTW thanks for your self-assignments! |
Thanks for the message ! Yes I am quite aware of numerical accuracy ! (it is a pity, Coyote web site seems to be off, we have here a "the sky is falling" on that) Yesterday I spend some time looking at the code for MOMENT() which is really impressive ! Without consideration of time, we would have a simple way to "solve" the problem, testing if the max of the array is equal to the min ! But it is quite expensive, needing to recourse the array looking for max & min. Maybe we can do that only when |
hum hum hum, IDL just introduced RUNNING_STATS I also look at https://www.nv5geospatialsoftware.com/docs/accuracy_and_floating_po.html |
FYI I've done (as many others I suppose) a local working copy of coyote's site. |
Here may not be the good place to discuss that, but I do not think GDL should reproduce IDL's behaviour at all costs:
It would be possible to add a global switch that would put GDL in an 'IDL enhanced compatibility' at the expense of a much slower GDL and a complication of the sources and their maintainance. |
STDDEV(array) should return 0.0 when all input are equal.
This problem is strongly linked with previous issue #2028 since we do used internal MOMENT() in
stddev.pro
in src/probut we should be able to have more simple way to minimize the problem
All values here should be equal to zero here !
The trick may be to test whether Min() and Max() are equal then shortcut the computation ?
What gives IDL 8.8 ?
Look like and interesting bug in IDL ?!
The text was updated successfully, but these errors were encountered: