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 "
> 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
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);
>
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
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
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
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)