[Numpy-discussion] What's wrong with matrices?
Bill Baxter
wbaxter at gmail.com
Sat Jul 8 07:21:06 CDT 2006
My preferred way to import numpy currently is:
import numpy as num
It would be nice if I could do:
import numpy.matrix as num
And basically have access to all the same stuff that's in the base numpy but
have everything set up in a matrix-like way, so num.ones returns a matrix
instead of an array, etc. (I don't care so much about the particular
name... matlib, matrixlib, matrixdefault, or whatever -- I just care about
the functionality)
The way I understand this matlib module is that I would do something along
the lines of one of these:
1) import numpy as num
from numpy.matlib import ones, zeros,...
or
2) import numpy as num
import numpy.matlib as M
Either way, the matrix functions aren't in the same namespace as general
numpy functions, which makes it feel like something of a bolt-on rather than
a second equally valid way to use numpy. So what I'd like is
3) import numpy.matlib as num
I think the way to get 3) may be to just do a "from numpy import *" at the
beginning of the numpy.matlib module, before redefining particular functions
with matrix versions. Maybe that's a bad idea, though?
Or maybe this is the way Travis and others planned for it to work from the
beginning? At any rate, versions 1) and 2) should also be supported for the
times you don't want to use matlib as the default, but still want access to
it.
--bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060708/ed52247d/attachment-0001.html
More information about the Numpy-discussion
mailing list