Hello, 

I have a question about the best way to implement a grid similar to a mesh 
grid: 
My first intuition was to do the following: 

nx = 256
nb = 195

kx = [-nx/2:-1+nx/2]

tic()
k1   = repmat(kx,1,nx)
k1v = vec(k1)'#/nx
k1m = repmat(k1v,nb,1)
toc()
# 0.0256 sec 

Then I tried in one operation the following: 
tic()
ka = repeat(kx,outer=[nx,nb])'# reshape( 
repeat(repeat(kx,inner=[nb]),outer=[nx]) ,nb,nx*nx )
toc()
# 0.477

Does somebody knows why the repeat is ~20 times slower than the 
repeat/vec/repmat 
Is it the best way to do this ?

Thanks in advance

Bests.

Antony

Reply via email to