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