[Numpy-discussion] Matrix Class

Stephan Hoyer shoyer at gmail.com
Wed Feb 11 13:22:28 EST 2015

On Wed, Feb 11, 2015 at 9:19 AM, Sebastian Berg <sebastian at sipsolutions.net>

> On Mi, 2015-02-11 at 11:38 -0500, cjw wrote:
> No, I just mean the fact that a matrix is always 2D. This makes some
> things like some indexing operations awkward and some functions that
> expect a numpy array (but think they can handle subclasses fine) may
> just plain brake. And then ndarray subclasses are just a bit
> problematic....

Indeed. In my opinion, a "fixed" version of np.matrix should (1) not be a
np.ndarray subclass and (2) exist in a third party library not numpy itself.

I don't think it's really feasible to fix np.matrix in its current state as
an ndarray subclass, but even a fixed matrix class doesn't really belong in
numpy itself, which has too long release cycles and compatibility
guarantees for experimentation -- not to mention that the mere existence of
the matrix class in numpy leads new users astray.

If you're really excited about using matrix objects, I really would
recommend starting a new project to implement the functionality (or maybe
such a project already exists -- I don't know). Numpy has some excellent
hooks for non-ndarray ndarray-like objects, so it's pretty straightforward
to integrate with numpy ufuncs, etc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150211/20b7ab6b/attachment.html>

More information about the NumPy-Discussion mailing list