Re: [Numpy-discussion] When are 0-d arrays writeable?

2012-11-23 Thread Nathaniel Smith
On 23 Nov 2012 03:34, Charles R Harris charlesr.har...@gmail.com wrote: Examples, In [13]: ones(()).flags.writeable Out[13]: True In [14]: (-ones(())).flags.writeable Out[14]: False In [15]: (-1*ones(())).flags.writeable Out[15]: False In [16]: (1 + ones(())).flags.writeable Out[16]:

[Numpy-discussion] Unexpected RuntimeWarning

2012-11-23 Thread Bob Dowling
I have a simple function defined in the following snippet: --- start --- import numpy def chebyshev(x, m): '''Calculates Chebyshev functions of the first kind using the trigonometric identities.''' theta = numpy.where( numpy.abs(x)=1.0, numpy.arccos(x),

Re: [Numpy-discussion] Unexpected RuntimeWarning

2012-11-23 Thread Pauli Virtanen
Bob Dowling rjd4+numpy at cam.ac.uk writes: [clip] I'm guessing that numpy.where() is evaluating the complete arccos and arccosh arrays and therefore getting invalid arguments. Now, I can turn off the warnings with numpy.seterr(invalid='ignore') but that's not what I would regard as good

Re: [Numpy-discussion] Unexpected RuntimeWarning

2012-11-23 Thread Bob Dowling
You may want to use this: http://docs.scipy.org/doc/numpy/reference/generated/numpy.piecewise.html Thank you. That's just what I needed. Works a treat: --- start --- import numpy def chebyshev(x, m): '''Calculates Chebyshev functions of the first kind using the trigonometric

Re: [Numpy-discussion] When are 0-d arrays writeable?

2012-11-23 Thread Sebastian Berg
On Fri, 2012-11-23 at 10:49 +, Nathaniel Smith wrote: On 23 Nov 2012 03:34, Charles R Harris charlesr.har...@gmail.com wrote: Examples, In [13]: ones(()).flags.writeable Out[13]: True In [14]: (-ones(())).flags.writeable Out[14]: False In [15]:

[Numpy-discussion] [ANN] Stochastic programming and optimization addon for FuncDesigner v. 0.421

2012-11-23 Thread Dmitrey
hi all, I'm glad to inform you that stochastic programming and optimization addon for FuncDesigner v. 0.421 has been released. Now you can use gradient-based solvers for numerical optimization, such as ALGENCAN, IPOPT, ralg, gsubg etc. Usually they work faster than derivative-free (such as

Re: [Numpy-discussion] When are 0-d arrays writeable?

2012-11-23 Thread Charles R Harris
On Fri, Nov 23, 2012 at 7:53 AM, Sebastian Berg sebast...@sipsolutions.netwrote: On Fri, 2012-11-23 at 10:49 +, Nathaniel Smith wrote: On 23 Nov 2012 03:34, Charles R Harris charlesr.har...@gmail.com wrote: Examples, In [13]: ones(()).flags.writeable Out[13]: True In

Re: [Numpy-discussion] Unexpected RuntimeWarning

2012-11-23 Thread Charles R Harris
On Fri, Nov 23, 2012 at 4:38 AM, Bob Dowling rjd4+nu...@cam.ac.uk wrote: I have a simple function defined in the following snippet: --- start --- import numpy def chebyshev(x, m): '''Calculates Chebyshev functions of the first kind using the trigonometric identities.'''

Re: [Numpy-discussion] the difference between + and np.add?

2012-11-23 Thread Chris Barker - NOAA Federal
On Thu, Nov 22, 2012 at 6:20 AM, Francesc Alted franc...@continuum.io wrote: As Nathaniel said, there is not a difference in terms of *what* is computed. However, the methods that you suggested actually differ on *how* they are computed, and that has dramatic effects on the time used. For