[Numpy-discussion] numerical noise for simple calcululations

2008-02-10 Thread dmitrey
hi all, I need a good estimation of noise value for simple calculations. I.e. when I calculate something like sin(15)+cos(80) I get a solution with precision, for example, 1e-11. I guess the precision depends on system arch, isn't it? So what's the best way to estimate the value? I guess here

Re: [Numpy-discussion] numerical noise for simple calcululations

2008-02-10 Thread Timothy Hochberg
On Sun, Feb 10, 2008 at 4:23 AM, dmitrey <[EMAIL PROTECTED]> wrote: > hi all, > I need a good estimation of noise value for simple calculations. > > I.e. when I calculate something like sin(15)+cos(80) I get a solution > with precision, for example, 1e-11. > > I guess the precision depends on syst

Re: [Numpy-discussion] numerical noise for simple calcululations

2008-02-10 Thread dmitrey
I need just a single number "in avarage". I have committed some changes to NLP/NSP ralg solver from scikits.openopt, for non-noisy funcs it works better, but for noisy funcs vise versa, hence now my examples/nssolveVSfsolve.py doesn't work as it should be, so I need to implement "noise" paramete

[Numpy-discussion] sort method raises unexpected error with axis=None

2008-02-10 Thread Matthew Brett
Hi, I just noticed this: >From the sort method docstring: axis : integer Axis to be sorted along. None indicates that the flattened array should be used. Default is -1. In [40]: import numpy as N In [41]: a = N.arange(10) In [42]: N.sort(a, None) Out[42]: array([0, 1, 2, 3

[Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Matthew Brett
Hi, I am sorry if I have missed something obvious, but is there any way in python of doing this: import numpy as np a = np.arange(10) b = np.arange(10)+1 a.data = b.data # raises error, but I hope you see what I mean ? Thanks a lot for any pointers. Matthew

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Robert Kern
On Feb 10, 2008 5:15 PM, Matthew Brett <[EMAIL PROTECTED]> wrote: > Hi, > > I am sorry if I have missed something obvious, but is there any way in > python of doing this: > > import numpy as np > a = np.arange(10) > b = np.arange(10)+1 > a.data = b.data # raises error, but I hope you see what I mea

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Robert Kern
On Feb 10, 2008 6:48 PM, Matthew Brett <[EMAIL PROTECTED]> wrote: > > > import numpy as np > > > a = np.arange(10) > > > b = np.arange(10)+1 > > > a.data = b.data # raises error, but I hope you see what I mean > > > > > > ? > > > > Not really, no. Can you describe your use case in more detail? > >

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Matthew Brett
> > import numpy as np > > a = np.arange(10) > > b = np.arange(10)+1 > > a.data = b.data # raises error, but I hope you see what I mean > > > > ? > > Not really, no. Can you describe your use case in more detail? Yes - I am just writing the new median implementation. To allow future optimization

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Matthew Brett
> Ah, I see. You definitely do not want to reassign the .data buffer in > this case. An out= parameter does not reassign the memory location > that the array object points to. It should use the allocated memory > that was already there. It shouldn't "copy" anything at all; > otherwise, "median(x, o

[Numpy-discussion] non-contiguous array error

2008-02-10 Thread Brad Malone
Hi, I am receiving a "AttributeError: incompatible shape for a non-contiguous array" error. A quick illustration of the type of code that gives me the error is shown below: from numpy import * list=[i for i in range(0,27)] c=array(list) c.shape=(3,3,3)

Re: [Numpy-discussion] non-contiguous array error

2008-02-10 Thread Robert Kern
On Feb 10, 2008 7:43 PM, Brad Malone <[EMAIL PROTECTED]> wrote: > Hi, I am receiving a "AttributeError: incompatible shape for a > non-contiguous array" error. A quick illustration of the type of code > that gives me the error is shown below: > > from n

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Robert Kern
On Feb 10, 2008 7:17 PM, Matthew Brett <[EMAIL PROTECTED]> wrote: > > Ah, I see. You definitely do not want to reassign the .data buffer in > > this case. An out= parameter does not reassign the memory location > > that the array object points to. It should use the allocated memory > > that was alr

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Damian R. Eads
Matthew Brett wrote: >>> import numpy as np >>> a = np.arange(10) >>> b = np.arange(10)+1 >>> a.data = b.data # raises error, but I hope you see what I mean >>> >>> ? >> Not really, no. Can you describe your use case in more detail? > > Yes - I am just writing the new median implementation. To al

Re: [Numpy-discussion] Setting contents of buffer for array object

2008-02-10 Thread Anne Archibald
On 10/02/2008, Matthew Brett <[EMAIL PROTECTED]> wrote: > > Ah, I see. You definitely do not want to reassign the .data buffer in > > this case. An out= parameter does not reassign the memory location > > that the array object points to. It should use the allocated memory > > that was already there

Re: [Numpy-discussion] String sort

2008-02-10 Thread Charles R Harris
On Feb 8, 2008 5:29 AM, Francesc Altet <[EMAIL PROTECTED]> wrote: > Hi, > > I'm a bit confused that the sort method of a string character doesn't > allow a mergesort: > > >>> s = numpy.empty(10, "S10") > >>> s.sort(kind="merge") > TypeError: desired sort not supported for this type > > However, by