octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #56884] mean can overflow


From: Michael Leitner
Subject: [Octave-bug-tracker] [bug #56884] mean can overflow
Date: Mon, 16 Sep 2019 16:11:35 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0

Follow-up Comment #9, bug #56884 (project octave):

The problem with Marco's implementation is that it loops over the entries to
be averaged, and thus is unsuited for large dimensions as long as there is not
JIT. Attached is another proposal based on pairwise summation (implemented in
vectorized form), including the idea of the iterative mean algorithm that
evades over- and underflows. At first glance, I would say that it should not
be worse than iterative mean (I would hope that it is better, as it uses only
division by two), and it definitely is faster when written as m-code. I would
say the best solution would be to implement my proposal as compiled code,
where you can use locality of reference much better. Thus, I would expect it
to be even faster than the native sum, which seems to be using Kahan
summation. At the cost of increased runtime, this is practically perfectly
accurate (that is, the returned value is the nearest floating-point value to
the exact solution), however for mean the accuracy is not needed (I do not see
the point in the returned value being more accurate on an absolute scale than
the inputs).

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?56884>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]