[SciPy-user] Re: [SciPy-dev] matrixmultiply()
Robert Kern
rkern at ucsd.edu
Sat Apr 9 16:24:19 EDT 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))
or
class mymat(Matrix.Matrix):
def zeros(cls, shape, typecode=Float):
return cls(zeros(shape, typecode))
zeroes = classmethod(zeros)
mymat.zeros((3,3))
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