Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: The examples for numpy.mat do not demonstrate numpy.mat #20522

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

Closed
hhoppe opened this issue Dec 5, 2021 · 4 comments
Closed

DOC: The examples for numpy.mat do not demonstrate numpy.mat #20522

hhoppe opened this issue Dec 5, 2021 · 4 comments

Comments

@hhoppe
Copy link

hhoppe commented Dec 5, 2021

Issue with current documentation:

On the doc page https://numpy.org/doc/stable/reference/generated/numpy.mat.html, the examples use np.asmatrix but not np.mat.

Idea or request for content:

No response

@WarrenWeckesser
Copy link
Member

Thanks @hhoppe, you're right, the docstring for mat actually refers to asmatrix.

But that is because mat is simply an alias for asmatrix. mat is defined here:

mat = asmatrix

I haven't dug into the history here, so I don't know why it is done this way. I'd recommend that we deprecate mat, but I don't know if there is interest in that code churn now, because the entire matrix class is destined for deprecation.

@melissawm
Copy link
Member

Should we just add a note in the docstring about this being an alias, while these are not deprecated?

@hhoppe would you be interested in submitting a pull request for this?

@linus-md
Copy link
Contributor

linus-md commented Dec 6, 2023

@melissawm @WarrenWeckesser has this been done yet? The it says "Unlike matrix, asmatrix does not make a copy if the input is already a matrix or an ndarray. Equivalent to matrix(data, copy=False)." Should "Equivalent to" be changed to "Alias for"? Also why are there empty lines in the example?

@melissawm
Copy link
Member

numpy.mat has been removed (see #24376) so this issue is not applicable anymore.

By the way, if you want to always look at the latest version of the docs @linus-md make sure you are looking at the devdocs by selecting "dev" in the upper right-hand corner of the documentation pages. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants