Skip to content

DEP: Deprecate ufunc.outer with matrix inputs#16232

Merged
mattip merged 2 commits into
numpy:masterfrom
seberg:ufunc-outer-matrix
Jul 17, 2020
Merged

DEP: Deprecate ufunc.outer with matrix inputs#16232
mattip merged 2 commits into
numpy:masterfrom
seberg:ufunc-outer-matrix

Conversation

@seberg
Copy link
Copy Markdown
Member

@seberg seberg commented May 13, 2020

Previously we converted matrices to arrays for the user, since
np.outer does not make sense for matrix. This deprecates that
usage (which in almost all cases will result in an error).

The main reason for this deprecation is to remove all direct
references of matrix from the NumPy codebase, so that it is
easier to move it out of NumPy eventually.


I can spin off the first maintenance commit if anyone feels the deprecation is trivial...

EDIT: xref gh-15105 which this closes, but I will remove the 1.19 milestone, since this doesn't really need to be in 1.19. It might just make the next steps to get rid of matrix a tiny bit simpler.

EDIT: For reviewers, the commits are probably best reviewed separately, just to disentangle things a bit. Both should be very straight forward.

@seberg seberg force-pushed the ufunc-outer-matrix branch from 2dece73 to b7e5630 Compare May 14, 2020 05:32
@mattip
Copy link
Copy Markdown
Member

mattip commented May 14, 2020

LGTM, and I would even vote for putting it into 1.19.

@charris - thoughts?

@seberg
Copy link
Copy Markdown
Member Author

seberg commented May 14, 2020

To be fair: np.diagonal, np.trace, np.ravel, np.apply_along_axis, and np.expand_dims still have python side isinstance checks (I may have missed some place). (May be a bit easier to cover with __array_function__ though, since its all single argument functions.)

@seberg
Copy link
Copy Markdown
Member Author

seberg commented May 19, 2020

Well, since its all branched, I updated the comments to say 1.20 (it was actually inconsistent before...)

This simplifies the reshaping logic to use the NewShape function
(this was previously impossible due to the split of umath and
multiarray).
It adds new errors if reshapes are bad, which currently is only
possible for bad subclasses. However, `np.matrix` is the main bad
subclass here, so this is in preparation of deprecating it.
@seberg seberg force-pushed the ufunc-outer-matrix branch from 7b9ad80 to f68ba8d Compare July 16, 2020 19:39
@seberg
Copy link
Copy Markdown
Member Author

seberg commented Jul 16, 2020

Should we just put this in now?

Previously we converted matrices to arrays for the user, since
`np.outer` does not make sense for matrix. This deprecates that
usage (which in almost all cases will result in an error).

The main reason for this deprecation is to remove all direct
references of matrix from the NumPy codebase, so that it is
easier to move it out of NumPy eventually.
@seberg seberg force-pushed the ufunc-outer-matrix branch from f68ba8d to 4e8e928 Compare July 16, 2020 19:40
@mattip mattip merged commit 56c7539 into numpy:master Jul 17, 2020
@mattip
Copy link
Copy Markdown
Member

mattip commented Jul 17, 2020

Thanks @seberg.

@seberg seberg deleted the ufunc-outer-matrix branch July 17, 2020 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants