chiark
/
gitweb
/
~ianmdlvl
/
nlopt.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9bf8c62
)
if reltol > 0, catch convergence case where new == old == 0
author
stevenj
<stevenj@alum.mit.edu>
Thu, 12 Nov 2009 22:12:19 +0000
(17:12 -0500)
committer
stevenj
<stevenj@alum.mit.edu>
Thu, 12 Nov 2009 22:12:19 +0000
(17:12 -0500)
darcs-hash:
20091112221219
-c8de0-
04e133b083c9f326593ad295b7309bf931c16bc4
.gz
util/stop.c
patch
|
blob
|
history
diff --git
a/util/stop.c
b/util/stop.c
index 22d31ddbd18e77e02313dd8b4a3145b4ba855edd..72e6a23cc9f8247c1e0e6b7bd4d3443f3e267d38 100644
(file)
--- a/
util/stop.c
+++ b/
util/stop.c
@@
-29,7
+29,8
@@
static int relstop(double old, double new, double reltol, double abstol)
{
if (nlopt_isinf(old)) return 0;
return(fabs(new - old) < abstol
- || fabs(new - old) < reltol * (fabs(new) + fabs(old)) * 0.5);
+ || fabs(new - old) < reltol * (fabs(new) + fabs(old)) * 0.5
+ || (reltol > 0 && new == old)); /* catch new == old == 0 case */
}
int nlopt_stop_ftol(const nlopt_stopping *s, const double f, double oldf)