[Numpy-discussion] Visual studio with mingw g77 built libraries

2008-01-30 Thread David Cournapeau
Hi, I would like to ask some details about the build process of numpy when visual studio is used for C compilation, and g77 for blas/lapack. As I understand it, the current situation consists in using libraries built the "Unix way" (e.g. libblas.a, static library built with ar + ranlib), takin

Re: [Numpy-discussion] Median again

2008-01-30 Thread Jarrod Millman
On Jan 30, 2008 10:41 AM, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > Yes, we could start to do that (spit out a warning in 1.0.5). This > should definitely be done in 1.0.6 > > Perhaps we use axis=None to start with and then check for that and spit > out the warning (and change axis to 0). Th

Re: [Numpy-discussion] Can not update a submatrix

2008-01-30 Thread Timothy Hochberg
On Jan 30, 2008 12:43 PM, Anne Archibald <[EMAIL PROTECTED]> wrote: > On 30/01/2008, Francesc Altet <[EMAIL PROTECTED]> wrote: > > A Wednesday 30 January 2008, Nadav Horesh escrigué: > > > In the following piece of code: > > > >>> import numpy as N > > > >>> R = N.arange(9).reshape(3,3) > > > >>>

Re: [Numpy-discussion] Can not update a submatrix

2008-01-30 Thread Anne Archibald
On 30/01/2008, Francesc Altet <[EMAIL PROTECTED]> wrote: > A Wednesday 30 January 2008, Nadav Horesh escrigué: > > In the following piece of code: > > >>> import numpy as N > > >>> R = N.arange(9).reshape(3,3) > > >>> ax = [1,2] > > >>> R > > > > array([[0, 1, 2], > >[3, 4, 5], > >[

Re: [Numpy-discussion] Vectorizing a function

2008-01-30 Thread LB
Thank you Gael, I think this could work for my case. It will be a bit tricky, since calc_0d is already a closure in which I've defined a function : the parameters x and y are to main parameters of an ODE. So calc_0d define a function, integrate it sing scipy.integrate.odeint and returns some chara

Re: [Numpy-discussion] Median again

2008-01-30 Thread Travis E. Oliphant
Timothy Hochberg wrote: > > > On Jan 29, 2008 5:48 PM, Travis E. Oliphant <[EMAIL PROTECTED] > > wrote: > > Joris De Ridder wrote: > > On 30 Jan 2008, at 00:32, Travis E. Oliphant wrote: > > > > > >> Matthew Brett wrote: > >> > >>> Hi, > >>

Re: [Numpy-discussion] Can not update a submatrix

2008-01-30 Thread Nadav Horesh
Thank you very much, that what I was looking for. Charles made a good point about offsets, counts and strides --- I really should go and reread the documentation. Nadav. -Original Message- From: [EMAIL PROTECTED] on behalf of lorenzo bolla Sent: Wed 30-Jan-08 17:31 To: Discussion of N

Re: [Numpy-discussion] Vectorizing a function

2008-01-30 Thread Charles R Harris
On Jan 30, 2008 10:18 AM, Timothy Hochberg <[EMAIL PROTECTED]> wrote: > > > On Jan 30, 2008 10:10 AM, Charles R Harris <[EMAIL PROTECTED]> > wrote: > > [SNIP] > > > > > > IIRC, the way to do closures in Python is something like > > > > In [5]: def factory(x) : > >...: def f() : > >...:

Re: [Numpy-discussion] Vectorizing a function

2008-01-30 Thread Charles R Harris
On Jan 30, 2008 10:10 AM, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On Jan 30, 2008 2:22 AM, Gael Varoquaux <[EMAIL PROTECTED]> > wrote: > > > On Wed, Jan 30, 2008 at 12:49:44AM -0800, LB wrote: > > > My problem is that the complexe calculations made in calc_0d use some > > > parameters, w

Re: [Numpy-discussion] Vectorizing a function

2008-01-30 Thread Timothy Hochberg
On Jan 30, 2008 10:10 AM, Charles R Harris <[EMAIL PROTECTED]> wrote: [SNIP] > > IIRC, the way to do closures in Python is something like > > In [5]: def factory(x) : >...: def f() : >...: print x >...: f.x = x >...: return f >...: > > In [6]: f = factory(

Re: [Numpy-discussion] Vectorizing a function

2008-01-30 Thread Charles R Harris
On Jan 30, 2008 2:22 AM, Gael Varoquaux <[EMAIL PROTECTED]> wrote: > On Wed, Jan 30, 2008 at 12:49:44AM -0800, LB wrote: > > My problem is that the complexe calculations made in calc_0d use some > > parameters, which are currently defined at the head of my python file. > > This is not very nice an

Re: [Numpy-discussion] Vectorizing a function

2008-01-30 Thread Anne Archibald
On 30/01/2008, Scott Ransom <[EMAIL PROTECTED]> wrote: > That works fine with arrays, scalars, or array/scalar mixes in the > calling. I do understand that more complicated functions might > require vectorize(), however, I wonder if sometimes it is used > when it doesn't need to be? It certainly

Re: [Numpy-discussion] Median again

2008-01-30 Thread Timothy Hochberg
On Jan 29, 2008 5:48 PM, Travis E. Oliphant <[EMAIL PROTECTED]> wrote: > Joris De Ridder wrote: > > On 30 Jan 2008, at 00:32, Travis E. Oliphant wrote: > > > > > >> Matthew Brett wrote: > >> > >>> Hi, > >>> > >>> > >>> median moved mediandim0 > >>> implementation of medianwithaxis or simil

Re: [Numpy-discussion] Can not update a submatrix

2008-01-30 Thread lorenzo bolla
or you can maybe use numpy.ix_: ax = [1,2] R[numpy.ix_(ax,ax)] = 100 hth, L. On 1/30/08, lorenzo bolla <[EMAIL PROTECTED]> wrote: > > you simply need to change the definition of ax: > ax = slice(1,3) > > and all works fine. > L. > > On 1/30/08, Francesc Altet <[EMAIL PROTECTED]> wrote: > > > >

Re: [Numpy-discussion] Can not update a submatrix

2008-01-30 Thread Charles R Harris
On Jan 30, 2008 8:21 AM, Nadav Horesh <[EMAIL PROTECTED]> wrote: > But: > > > >>> R[ax,:] = 100 > >>> R > array([[ 0, 1, 2], >[100, 100, 100], >[100, 100, 100]]) > >>> R[:,ax] = 200 > >>> R > array([[ 0, 200, 200], >[100, 200, 200], >[100, 200, 200]]) > > Do

Re: [Numpy-discussion] Can not update a submatrix

2008-01-30 Thread lorenzo bolla
you simply need to change the definition of ax: ax = slice(1,3) and all works fine. L. On 1/30/08, Francesc Altet <[EMAIL PROTECTED]> wrote: > > A Wednesday 30 January 2008, Nadav Horesh escrigué: > > In the following piece of code: > > >>> import numpy as N > > >>> R = N.arange(9).reshape(3,3) >

Re: [Numpy-discussion] Can not update a submatrix

2008-01-30 Thread Hans Meine
Am Mittwoch, 30. Januar 2008 16:21:40 schrieb Nadav Horesh: > But: > >>> R[ax,:] = 100 This is calling __setitem__, i.e. does not create either a view or a copy. Non-contiguous views (e.g. using [::2]) are also possible AFAIK, but fancy indexing is something different. -- Ciao, / / /--/

Re: [Numpy-discussion] Can not update a submatrix

2008-01-30 Thread Nadav Horesh
But: >>> R[ax,:] = 100 >>> R array([[ 0, 1, 2], [100, 100, 100], [100, 100, 100]]) >>> R[:,ax] = 200 >>> R array([[ 0, 200, 200], [100, 200, 200], [100, 200, 200]]) Do I get an array view only if the array is contiguous? Nadav. On Wed, 2008-01-30 at 16:08 +0

Re: [Numpy-discussion] Can not update a submatrix

2008-01-30 Thread Francesc Altet
A Wednesday 30 January 2008, Nadav Horesh escrigué: > In the following piece of code: > >>> import numpy as N > >>> R = N.arange(9).reshape(3,3) > >>> ax = [1,2] > >>> R > > array([[0, 1, 2], >[3, 4, 5], >[6, 7, 8]]) > > >>> R[ax,:][:,ax] = 100 > >>> R > > array([[0, 1, 2], >

[Numpy-discussion] Can not update a submatrix

2008-01-30 Thread Nadav Horesh
In the following piece of code: >>> import numpy as N >>> R = N.arange(9).reshape(3,3) >>> ax = [1,2] >>> R array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) >>> R[ax,:][:,ax] = 100 >>> R array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) Why R is not updated? I was expecting: >>> R ar

Re: [Numpy-discussion] load movie frames in python?

2008-01-30 Thread Brian Blais
On Jan 29, 2008, at Jan 29:9:25 PM, Andrew Straw wrote: I'm pretty sure there's code floating around the pyglet mailing list. I'd be happy to add it to http://code.astraw.com/projects/motmot/wiki/pygarrayimage if it seems reasonable. (pygarrayimage goes from numpy array to pyglet texture). I

Re: [Numpy-discussion] Vectorizing a function

2008-01-30 Thread Scott Ransom
On a side note, given that I've seen quite a few posts about vectorize() over the past several months... I've written hundreds or thousands of functions that are intended to work with numeric/numpy arrays and/or scalars and I've _never_ (not once!) found a need for the vectorize function. Python'

[Numpy-discussion] a view of a numpy object array

2008-01-30 Thread YW
Hi, How would one deal with the problem of getting a view of a numpy object array? For example, In [49]: b Out[49]: TaskResultArray([[TaskResult[ID:0]:{'out': 22}, TaskResult[ID:1]: {'out': 22}, TaskResult[ID:2]:{'out': 16}, TaskResult[ID:3]:{'out': 16}, TaskResult[ID:4]:{'out': 1

[Numpy-discussion] a view of a numpy object array

2008-01-30 Thread YW
Hi, How would one deal with the problem of getting a view of a numpy object array? For example, In [49]: b Out[49]: TaskResultArray([[TaskResult[ID:0]:{'out': 22}, TaskResult[ID:1]: {'out': 22}, TaskResult[ID:2]:{'out': 16}, TaskResult[ID:3]:{'out': 16}, TaskResult[ID:4]:{'out': 1

Re: [Numpy-discussion] Read-only mercurial mirror of numpy trunk available

2008-01-30 Thread Ondrej Certik
> > Better solution is to keep the tags in a Mercurial Queues patch, as I did. > Good. As I said, I know bzr much better than hg, and I did the mirror to > get something started (and get used to hg, too). Since you know hg, it > is better than you maintain this for a while for people to try it out.

Re: [Numpy-discussion] argsort memory problem?

2008-01-30 Thread Oriol Vendrell
* Robin <[EMAIL PROTECTED]> [2008-01-29 19:23:11 +]: > On Jan 29, 2008 7:16 PM, Lou Pecora <[EMAIL PROTECTED]> wrote: > > Hmmm... Interesting. I am using Python 2.4.4. It > > would be nice to have other Mac people with same/other > > Python and numpy versions try the argsort "bug" code. > >

Re: [Numpy-discussion] Vectorizing a function

2008-01-30 Thread Gael Varoquaux
On Wed, Jan 30, 2008 at 12:49:44AM -0800, LB wrote: > My problem is that the complexe calculations made in calc_0d use some > parameters, which are currently defined at the head of my python file. > This is not very nice and I can't define a module containing theses > two functions and call them wi

Re: [Numpy-discussion] Vectorizing a function

2008-01-30 Thread YW
Try use a closure. On Jan 30, 12:49 am, LB <[EMAIL PROTECTED]> wrote: >    Hi, > > I've got some questions on the numpy.vectorize  function. > Currently, i'm doing this kind of work : > > [ code] > def calc_0d(x, y): >     """ make complexe calculation using two scalars x and y """ >     [ ... ] >

[Numpy-discussion] Vectorizing a function

2008-01-30 Thread LB
Hi, I've got some questions on the numpy.vectorize function. Currently, i'm doing this kind of work : [ code] def calc_0d(x, y): """ make complexe calculation using two scalars x and y """ [ ... ] return res1, res2, res 3 # vectorize the function calc = vectorize(calc_0d) res1,