calculating on matrix indices

Robert Kern robert.kern at gmail.com
Thu Feb 16 22:14:28 EST 2006


Brian Blais wrote:
> Hello,
> 
> In my attempt to learn python, migrating from matlab, I have the following problem. 
> Here is what I want to do, (with the wrong syntax):
> 
> from numpy import *
> 
> t=arange(0,20,.1)
> x=zeros(len(t),'f')

Also, you probably don't want to be using literal typecode strings. It's easy to
forget which code corresponds to which type. They are only accepted in numpy for
compatibility with Numeric. Use the real dtype objects instead: numpy.float32,
numpy.float64, etc. The builtin type objects int and float are also accepted for
convenience and correspond to the C types that underlie the respective Python
objects.

-- 
Robert Kern
robert.kern at gmail.com

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Python-list mailing list