Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 231905 Details for
Bug 320135
Please apply changeset 5790 to sci-libs/scipy-0.7.x
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to apply the given changeset.
scipy-0.7-optimize.patch (text/plain), 1.83 KB, created by
François Bissey
on 2010-05-18 09:43:32 UTC
(
hide
)
Description:
patch to apply the given changeset.
Filename:
MIME Type:
Creator:
François Bissey
Created:
2010-05-18 09:43:32 UTC
Size:
1.83 KB
patch
obsolete
>--- scipy/optimize/optimize.py.orig 2009-07-11 17:56:37.000000000 +1200 >+++ scipy/optimize/optimize.py 2010-05-17 21:36:07.605336495 +1200 >@@ -41,6 +41,12 @@ > m = asarray(m) > return numpy.minimum.reduce(m,axis) > >+def is_array_scalar(x): >+ """Test whether `x` is either a scalar or an array scalar. >+ >+ """ >+ return len(atleast_1d(x) == 1) >+ > abs = absolute > import __builtin__ > pymin = __builtin__.min >@@ -1177,13 +1183,12 @@ > > """ > # Test bounds are of correct form >- x1 = atleast_1d(x1) >- x2 = atleast_1d(x2) >- if len(x1) != 1 or len(x2) != 1: >- raise ValueError, "Optimisation bounds must be scalars" \ >- " or length 1 arrays" >+ >+ if not (is_array_scalar(x1) and is_array_scalar(x2)): >+ raise ValueError("Optimisation bounds must be scalars" >+ " or array scalars.") > if x1 > x2: >- raise ValueError, "The lower bound exceeds the upper bound." >+ raise ValueError("The lower bound exceeds the upper bound.") > > flag = 0 > header = ' Func-count x f(x) Procedure' >--- scipy/optimize/tests/test_optimize.py.orig 2009-07-11 17:56:37.000000000 +1200 >+++ scipy/optimize/tests/test_optimize.py 2010-05-18 21:31:39.000000000 +1200 >@@ -159,10 +160,17 @@ > assert abs(x - 1.5) < 1e-6 > assert_raises(ValueError, > optimize.fminbound, lambda x: (x - 1.5)**2 - 0.8, 5, 1) >+ >+ def test_fminbound_scalar(self): > assert_raises(ValueError, >- optimize.fminbound, lambda x: (x - 1.5)**2 - 0.8, >+ optimize.fminbound, lambda x: (x - 1.5)**2 - 0.8, > np.zeros(2), 1) > >+ assert_almost_equal( >+ optimize.fminbound(lambda x: (x - 1.5)**2 - 0.8, 1, np.array(5)), >+ 1.5) >+ >+ > class TestTnc(TestCase): > """TNC non-linear optimization.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 320135
: 231905