[Numpy-discussion] deprecate numpy.matrix
josef.pktd at gmail.com
josef.pktd at gmail.com
Mon Feb 10 11:27:42 EST 2014
On Mon, Feb 10, 2014 at 10:09 AM, Alan G Isaac <alan.isaac at gmail.com> wrote:
> On 2/9/2014 5:55 PM, alex wrote:
> > I'm working on the same kinds of problems in scipy development
> > (functions involving sparse matrices and abstract linear operators)
> And how is numpy's matrix object getting in your way?
> Your initial post simply treated the desirability of
> deprecation as a given and did not lay out reasons.
> A strong reason would be e.g. if the matrix object
> is creating a serious maintenance headache. Eliminating
> this should be a big enough gain to offset any lost interest
> in numpy from users of Matlab, GAUSS, IDL etc. from the
> disappearance of a user-friendly notation.
> I accept that a numpy matrix has some warts. In the past,
> I've proposed changes to address these. E.g.,
> However these went nowhere, so effectively the status quo was
> defended. I can live with that.
> A bit of the notational advantage of the `matrix` object was undercut
> by the addition of the `dot` method to arrays. If `matrix` is deprecated,
> I would hope that a matrix-power method would be added. (One that works
> correctly with boolean arrays and has a short name.) I ideally an inverse
> method would be added as well (with a short name). I think adding the
> hermitian transpose as `.H()` already has some support, but I forget its
> Right now, to give a simple example, students can write a simple projection
> matrix as `X * (X.T * X).I * X.T` instead of
or even better assign pinv(X) to a name and reuse it.
(I never taught statistics or econometrics to undergraduates in Social
How do we calculate the diagonal of the hat matrix without using N by N
> The advantage is obvious and even bigger with more complex expressions.
> If we were to get `.I` for matrix inverse of an array (which I expect to be
> vociferously resisted) it would be `X.dot(X.T.dot(X).I).dot(X.T)` which
> at the moment I'm inclined to see as acceptable for teaching. (Not sure.)
> Just to forestall the usual "just start them with arrays, eventually
> be grateful" reply, I would want to hear that suggestion only from someone
> who has used it successfully with undergraduates in the social sciences.
> Alan Isaac
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion