Re: [Numpy-discussion] iterate over multiple arrays

2011-09-12 Thread David Froger
Thank you Olivier and Robert for your replies! Some remarks about the dictionnary solution: from numpy import * def f(arr): return arr + 100. arrs = {} arrs['a'] = array( [1,1,1] ) arrs['b'] = array( [2,2,2] ) arrs['c'] = array( [3,3,3] ) arrs['d'] = array( [4,4,4] ) for key,value in arr

Re: [Numpy-discussion] load from text files Pull Request Review

2011-09-12 Thread Christopher Jordan-Squire
I did some timings to see what the advantage would be, in the simplest case possible, of taking multiple lines from the file to process at a time. Assuming the dtype is already known. The code is attached. What I found was I can't use generators to avoid constructing a list and then making a tuple

[Numpy-discussion] using Matlab compiler to build Python-callable library?

2011-09-12 Thread Reckoner
Hi, Has anybody ever tried using the Matlab compiler to build a standalone library that would be callable using Python? We have a lot of leftover Matlab code that we are trying to migrate. Thanks! ___ NumPy-Discussion mailing list NumPy-Discussion@scip

Re: [Numpy-discussion] iterate over multiple arrays

2011-09-12 Thread Robert Kern
On Mon, Sep 12, 2011 at 01:52, David Froger wrote: > Hy everybody, > > I'm wondering what is the (best) way to apply the same function to multiple > arrays. > > For example, in the following code: > > from numpy import * > > def f(arr): >     return arr*2 > > a = array( [1,1,1] ) > b = array( [2,2

Re: [Numpy-discussion] f2py : NotImplementedError: Only MS compiler supported with gfortran on win64

2011-09-12 Thread Jim Vickroy
On 9/12/2011 11:17 AM, Jonathan T. Niehof wrote: Is anyone successfully using f2py and gfortran on a Windows machine without relying on cygwin? SpacePy uses mingw32 for both gcc and gfortran; I didn't have any trouble with f2py. I haven't tried a build with 64-bit Python or with EPD; I just buil

Re: [Numpy-discussion] f2py : NotImplementedError: Only MS compiler supported with gfortran on win64

2011-09-12 Thread Jonathan T. Niehof
> Is anyone successfully using f2py and gfortran on a Windows machine > without relying on cygwin? SpacePy uses mingw32 for both gcc and gfortran; I didn't have any trouble with f2py. I haven't tried a build with 64-bit Python or with EPD; I just build the installer against python.org's python and

Re: [Numpy-discussion] Matrix addition, +=

2011-09-12 Thread Alan G Isaac
On 9/12/2011 7:18 AM, Jonas Wallin wrote: > Why does > > MuY += MuY.transpose() > > and > > MuY = MuY + MuY.transpose() > > give different answers? Because the first one is done in-place, so you are changing MuY (and thus MuY.transpose) as the operation proceeds. MuY.transpose() is gene

[Numpy-discussion] Matrix addition, +=

2011-09-12 Thread Jonas Wallin
Hello, I am sure this question has been answered before but I can't find the right search word to find it. Why does MuY += MuY.transpose() and MuY = MuY + MuY.transpose() give different answers? thanks /Jonas Wallin ___ NumPy-Discussion m

Re: [Numpy-discussion] iterate over multiple arrays

2011-09-12 Thread Olivier Delalleau
If you can make f work in-place then you can just call map(f, [a, b, c, d]): def f(arr): arr *= 2 Otherwise, you can: - Work with a list instead (a_b_c_d = map(f, a_b_c_d), with a_b_c_d = [a, b, c, d], but this won't update the local definitions of a, b, c, d). - Use locals(): for x in ('a', 'b