[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 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 parameter

[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 mean ? Not

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? Yes - I am just writing

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, I would

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, out=out)

[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 numpy

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 already

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 allow future

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 looking at the numpy