I was converting a matlab file to my new favority scientific language 
Numpy :)
In the old file I created a matrix  on the fly. I know that Numpy  and 
python cannot do that so I found a workaround
here's the code

lev2=empty((1,h))
ir=1
for j in arange(1,nstep+2):
  #a=gr[[arange(ir-1,ir+nstep)],:]
  a2=gr[arange(ir-1,ir+nstep)]
  #flev=dot(a2,dot(disper,a2.transpose()))
  clev=diag(dot(a2,dot(disper,a2.transpose())))
  lev2=vstack((lev2,clev))
  #print ir
  #print clev
  #print h
  ir=ir+nstep+1
lev=lev2[1:,]
print lev

So
First I create the empty matrix
Secon perform the calculation
Third take the matrix and exclude the first line since it has "dummy" 
values because after I need to plot it with

contour(lev)
H,K = meshgrid(lab,lab)
fig=p.figure()
ax=p3.Axes3D(fig)
ax.plot_wireframe(H,K,lev)
p.show()
p.close

everything works fine.. but is this really necessary ? could not an empy 
just just be "really empty" ?
Thanks for the answers

Cheers
Giorgio



_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to