Author: semor
Date: Thu Feb 11 19:37:04 2010
New Revision: 10693
URL: http://svn.gna.org/viewcvs/relax?rev=10693&view=rev
Log:
Fix for Python>= 2.6.
The variable 'as' was replaced by 'asec' since it is now a statement in
Python>= 2.6.
This is similar to commit 46 in minfx:
https://mail.gna.org/public/minfx-commits/2009-05/msg00000.html
and as discussed in the thread starting at:
https://mail.gna.org/public/relax-devel/2010-02/msg00035.html
(Message-id:<4B737D34.4050008@xxxxxxxxx>)
Modified:
1.2/minimise/line_search/more_thuente.py
Modified: 1.2/minimise/line_search/more_thuente.py
URL:
http://svn.gna.org/viewcvs/relax/1.2/minimise/line_search/more_thuente.py?rev=10693&r1=10692&r2=10693&view=diff
==============================================================================
--- 1.2/minimise/line_search/more_thuente.py (original)
+++ 1.2/minimise/line_search/more_thuente.py Thu Feb 11 19:37:04 2010
@@ -289,7 +289,7 @@
and au, and at the trial point at.
ac is the minimiser of the cubic that interpolates fl, ft, gl, and gt.
aq is the minimiser of the quadratic that interpolates fl, ft, and gl.
- as is the minimiser of the quadratic that interpolates fl, gl, and gt.
+ asec is the minimiser of the quadratic that interpolates fl, gl, and gt.
The trial value selection is divided into four cases.
@@ -300,25 +300,25 @@
\ 1/2(aq + ac), otherwise.
- Case 2: ft<= fl and gt.gl< 0. In this case compute ac and as, and set
-
- / ac, if |ac - at|>= |as - at|,
+ Case 2: ft<= fl and gt.gl< 0. In this case compute ac and asec, and set
+
+ / ac, if |ac - at|>= |asec - at|,
at+ =<
- \ as, otherwise.
+ \ asec, otherwise.
Case 3: ft<= fl and gt.gl>= 0, and |gt|<= |gl|. In this case at+ is
chosen by extrapolating
the function values at al and at, so the trial value at+ lies outside th
interval with at and al
- as endpoints. Compute ac and as.
+ as endpoints. Compute ac and asec.
If the cubic tends to infinity in the direction of the step and the
minimum of the cubic is
beyound at, set
- / ac, if |ac - at|< |as - at|,
+ / ac, if |ac - at|< |asec - at|,
at+ =<
- \ as, otherwise.
-
- Otherwise set at+ = as.
+ \ asec, otherwise.
+
+ Otherwise set at+ = asec.
Redefine at+ by setting
@@ -382,22 +382,22 @@
# Interpolation.
ac = cubic(al, at, fl, ft, gl, gt)
- as = secant(al, at, gl, gt)
+ asec = secant(al, at, gl, gt)
if print_flag:
print "\t\tac: " + `ac`
- print "\t\tas: " + `as`
+ print "\t\tasec: " + `asec`
# Return at+.
- if abs(ac - at)>= abs(as - at):
- if print_flag:
- print "\t\tabs(ac - at)>= abs(as - at), " + `abs(ac - at)` + ">=
" + `abs(as - at)`
+ if abs(ac - at)>= abs(asec - at):
+ if print_flag:
+ print "\t\tabs(ac - at)>= abs(asec - at), " + `abs(ac - at)` +
">= " + `abs(asec - at)`
print "\t\tat_new = ac = " + `ac`
at_new = ac
else:
if print_flag:
- print "\t\tabs(ac - at)< abs(as - at), " + `abs(ac - at)` + "<
" + `abs(as - at)`
- print "\t\tat_new = as = " + `as`
- at_new = as
+ print "\t\tabs(ac - at)< abs(asec - at), " + `abs(ac - at)` + "<
" + `abs(asec - at)`
+ print "\t\tat_new = asec = " + `asec`
+ at_new = asec
# Case 3.
@@ -421,26 +421,26 @@
# Set ac to the lower limit.
ac = Ik_lim[0]
- as = secant(al, at, gl, gt)
+ asec = secant(al, at, gl, gt)
if print_flag:
print "\t\tac: " + `ac`
- print "\t\tas: " + `as`
+ print "\t\tasec: " + `asec`
# Test if bracketed.
if bracketed:
if print_flag:
print "\t\tBracketed"
- if abs(ac - at)< abs(as - at):
- if print_flag:
- print "\t\t\tabs(ac - at)< abs(as - at), " + `abs(ac - at)` +
"< " + `abs(as - at)`
+ if abs(ac - at)< abs(asec - at):
+ if print_flag:
+ print "\t\t\tabs(ac - at)< abs(asec - at), " + `abs(ac - at)` +
"< " + `abs(asec - at)`
print "\t\t\tat_new = ac = " + `ac`
at_new = ac
else:
if print_flag:
- print "\t\t\tabs(ac - at)>= abs(as - at), " + `abs(ac - at)` +
">= " + `abs(as - at)`
- print "\t\t\tat_new = as = " + `as`
- at_new = as
+ print "\t\t\tabs(ac - at)>= abs(asec - at), " + `abs(ac - at)` +
">= " + `abs(asec - at)`
+ print "\t\t\tat_new = asec = " + `asec`
+ at_new = asec
# Redefine at+.
if print_flag:
@@ -458,16 +458,16 @@
else:
if print_flag:
print "\t\tNot bracketed"
- if abs(ac - at)> abs(as - at):
- if print_flag:
- print "\t\t\tabs(ac - at)> abs(as - at), " + `abs(ac - at)` +
"> " + `abs(as - at)`
+ if abs(ac - at)> abs(asec - at):
+ if print_flag:
+ print "\t\t\tabs(ac - at)> abs(asec - at), " + `abs(ac - at)` +
"> " + `abs(asec - at)`
print "\t\t\tat_new = ac = " + `ac`
at_new = ac
else:
if print_flag:
- print "\t\t\tabs(ac - at)<= abs(as - at), " + `abs(ac - at)` +
"<= " + `abs(as - at)`
- print "\t\t\tat_new = as = " + `as`
- at_new = as
+ print "\t\t\tabs(ac - at)<= abs(asec - at), " + `abs(ac - at)` +
"<= " + `abs(asec - at)`
+ print "\t\t\tat_new = asec = " + `asec`
+ at_new = asec
# Check limits.
if print_flag:
_______________________________________________
relax (http://nmr-relax.com)
This is the relax-commits mailing list
relax-commits@xxxxxxx
To unsubscribe from this list, get a password
reminder, or change your subscription options,
visit the list information page at
https://mail.gna.org/listinfo/relax-commits