Re: [Numpy-discussion] matlab to numpy help

2007-12-23 Thread Alex
if m = 5, then Uns = ones(1,m) means 1x5 matrix(vector) of 1: [1 1 1 1 1] Xijm(:,Uns) is called Tony's trick where you actually replicate the Xijm (vector i guess) 5 times (according to the Uns.) e.g. http://xtargets.com/snippets/posts/show/55 Matlab introduced repmat() function that does the job "

Re: [Numpy-discussion] setting items in a matrix

2007-12-23 Thread Tim Michelsen
> To learn array basics: > http://pages.physics.cornell.edu/~myers/teaching/ComputationalMethods/python/arrays.html> > http://www.scipy.org/Numpy_Example_List#head-a8a8874581c2ebfc69a37ab513974a229ff3bfaa> > http://www.scipy.org/Numpy_Example_List#head-a261b8dd10bda6a5fc268fe4f4171acee2f83968> > ht

Re: [Numpy-discussion] matlab to numpy help

2007-12-23 Thread Eric Firing
Gabriel J.L. Beckers wrote: > I found a matlab script that I want to translate into numpy, but have > difficulties with understanding indexing in matlab. I haven't used > matlab very much and I was hoping that someone could help with the > following: > > It says: > > Uns = ones(1,m); >

[Numpy-discussion] gfortran/g77+f2py vs gcc+Cython speed comparison

2007-12-23 Thread Ondrej Certik
Hi, I needed to write 2D Ising model simulation into my school and I decided to compare the two possible solutions how to do it, so I of course wrote it in Python, then rewrote it in Fortran + f2py, and also Cython. What is better? Read below. :) But for the impatient, I am going to use Cython, r

Re: [Numpy-discussion] ising model: f2py vs cython comparison

2007-12-23 Thread Pearu Peterson
On Sun, December 23, 2007 3:29 am, Ondrej Certik wrote: > Hi, > > I need to write 2D Ising model simulation into my school, so I wrote > it in Python, then rewrote it in Fortran + f2py, and also Cython: > > http://hg.sharesource.org/isingmodel/ > > And Cython solution is 2x faster than f2py. I unde

Re: [Numpy-discussion] ising model: f2py vs cython comparison

2007-12-23 Thread Pearu Peterson
On Sun, December 23, 2007 3:29 am, Ondrej Certik wrote: > Hi, > > I need to write 2D Ising model simulation into my school, so I wrote > it in Python, then rewrote it in Fortran + f2py, and also Cython: > > http://hg.sharesource.org/isingmodel/ > > And Cython solution is 2x faster than f2py. I unde

[Numpy-discussion] matlab to numpy help

2007-12-23 Thread Gabriel J.L. Beckers
I found a matlab script that I want to translate into numpy, but have difficulties with understanding indexing in matlab. I haven't used matlab very much and I was hoping that someone could help with the following: It says: Uns = ones(1,m); ... and then later Xijm(:,Uns)