Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEP: Deprecate ufunc.outer with matrix inputs #16232

Merged
merged 2 commits into from Jul 17, 2020
Merged

Conversation

@seberg
Copy link
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 seberg:ufunc-outer-matrix branch from 2dece73 to b7e5630 May 14, 2020
@mattip
Copy link
Member

@mattip mattip commented May 14, 2020

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

@charris - thoughts?

@seberg
Copy link
Member Author

@seberg 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
Member Author

@seberg 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 seberg:ufunc-outer-matrix branch from 7b9ad80 to f68ba8d Jul 16, 2020
@seberg
Copy link
Member Author

@seberg 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 seberg:ufunc-outer-matrix branch from f68ba8d to 4e8e928 Jul 16, 2020
@mattip mattip merged commit 56c7539 into numpy:master Jul 17, 2020
20 checks passed
20 checks passed
LGTM analysis: JavaScript No code changes detected
Details
LGTM analysis: C/C++ No new or fixed alerts
Details
LGTM analysis: Python No new or fixed alerts
Details
Shippable Run 12158 status is SUCCESS.
Details
azure-pipeline numpy.numpy Build #20200716.19 succeeded
Details
azure-pipeline numpy.numpy (ComprehensiveTests Linux_PyPy3) ComprehensiveTests Linux_PyPy3 succeeded
Details
azure-pipeline numpy.numpy (ComprehensiveTests Linux_Python_38_32bit_full_with_asserts) ComprehensiveTests Linux_Python_38_32bit_full_with_asserts succeeded
Details
azure-pipeline numpy.numpy (ComprehensiveTests Linux_gcc48) ComprehensiveTests Linux_gcc48 succeeded
Details
azure-pipeline numpy.numpy (ComprehensiveTests Windows Python36-64bit-full) ComprehensiveTests Windows Python36-64bit-full succeeded
Details
azure-pipeline numpy.numpy (ComprehensiveTests Windows Python37-64bit-full) ComprehensiveTests Windows Python37-64bit-full succeeded
Details
azure-pipeline numpy.numpy (ComprehensiveTests Windows Python38-32bit-fast) ComprehensiveTests Windows Python38-32bit-fast succeeded
Details
azure-pipeline numpy.numpy (ComprehensiveTests Windows Python38-64bit-full) ComprehensiveTests Windows Python38-64bit-full succeeded
Details
azure-pipeline numpy.numpy (ComprehensiveTests macOS Python36) ComprehensiveTests macOS Python36 succeeded
Details
azure-pipeline numpy.numpy (ComprehensiveTests macOS Python36-ILP64) ComprehensiveTests macOS Python36-ILP64 succeeded
Details
azure-pipeline numpy.numpy (InitialTests WindowsFast Python36-64bit-fast) InitialTests WindowsFast Python36-64bit-fast succeeded
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: build artifact Link to 0/doc/build/html/index.html
Details
codecov/patch 100.00% of diff hit (target 81.16%)
Details
codecov/project 81.16% (target 1.00%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@mattip
Copy link
Member

@mattip mattip commented Jul 17, 2020

Thanks @seberg.

@seberg seberg deleted the seberg:ufunc-outer-matrix branch Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants