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

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

[Octave-bug-tracker] [bug #60539] Slow performance of betaincinv.m


From: Michael Leitner
Subject: [Octave-bug-tracker] [bug #60539] Slow performance of betaincinv.m
Date: Thu, 6 May 2021 13:29:12 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #1, bug #60539 (project octave):

If both alpha and beta are greater or equal one, then betainc(x,alpha,beta)
has a point of inflection at x=(alpha-1)/(alpha+beta-2), where it changes from
a positive curvature to a negative curvature. Thus, in these cases you can
skip the initial ten bisection steps and start directly at the inflection
point (if alpha==beta==1 you can take x=0.5), and you are guaranteed that the 
points visited by the Newton method will be monotonic convergent and never
stray beyond 0 or 1 (so the fixes in #60528 wouldn't even be necessary -- they
also cost performance). You could special-case that.

If one or the other are smaller than one, you have a divergence of the
derivative at the corresponding end, but the curvature is either everywhere
positive or negative. There should be some way to get safely on the outer side
of the final value and again go monotonously inwards by purely Newton steps,
but I do not see it at the moment. If both are smaller than one, you would
first have to figure out on which side the final value will be (this is easy,
compute the inflection point as above, compute betainc at this point and see
whether it is higher or lower), and then continue as above.

Of course, yes, the stopping criterion for the Newton steps should also be
fixed.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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