[SciPy-user] Re: [SciPy-dev] matrixmultiply()

Robert Kern rkern at ucsd.edu
Sat Apr 9 15:24:19 CDT 2005

David Grant wrote:

> What if I start by declaring my arrays using zeros() and ones(), do I
> have to pass it through mat()? That seems like a rather annoying second
> step.

def mzeros(shape, typecode=Float):
     return mat(zeros(shape, typecode))


class mymat(Matrix.Matrix):
     def zeros(cls, shape, typecode=Float):
         return cls(zeros(shape, typecode))
     zeroes = classmethod(zeros)


There's no way to make things syntactically convenient for everyone. 
*Someone* will always pay a bit of a price.

Robert Kern
rkern at ucsd.edu

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

More information about the SciPy-user mailing list