-
Notifications
You must be signed in to change notification settings - Fork 598
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
do not allocate xtol_abs unless needed #268
Conversation
There are also a few other explicit references to |
Of course, I should have read the code instead of relying on There are parts in cdirect.c and hybrid.c where both stopping criteria on dx[i] <= (ub[i] - lb[i]) * xtol_rel // ∀ i
// where lb and ub are 0 and 1 unless NOSCAL is used instead of If this is integral to the algorithm, I can preserve the current behaviour by adding checks: - if (w[i] > (p->stop->xtol_abs[i] ) &&
+ if (w[i] > (p->stop->xtol_abs ? p->stop->xtol_abs[i] : 0) && - && w[i] > p->stop->xtol_abs[i])
+ && w[i] > p->stop->xtol_abs ? p->stop->xtol_abs[i] : 0) Is this the right thing to do, though? |
@aitap, I think that code predates the code in |
As discussed in stevengj#183, it is beneficial to avoid allocating potentially huge buffers of size `n` unless `x`-tolerance criteria are used.
Sorry, my analysis was wrong. Those are not I tried to avoid branching in for-loops, but in some cases letting a ternary operator in led to more comprehensible code. |
LGTM, thanks! |
As discussed in #183, it is beneficial to avoid allocating potentially
huge buffers of size
n
unlessx
-tolerance criteria are used.This patch adds checks for
!opt->xtol_abs
and behaves as ifxtol_abs[i] == 0 ∀i
if true.