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

Allow np.fill_diagonal to fill sub or super diagonals too #14402

Open
ewmoore opened this issue Aug 30, 2019 · 7 comments
Open

Allow np.fill_diagonal to fill sub or super diagonals too #14402

ewmoore opened this issue Aug 30, 2019 · 7 comments

Comments

@ewmoore
Copy link
Contributor

ewmoore commented Aug 30, 2019

It would be really nice if np.fill_diagonal could fill other diagonals besides the main diagonal. This would match the offset argument of np.diagonal.

Shouldn't require much code to allow this.

@eric-wieser
Copy link
Member

If we made diagonal return a writeable view, as we have long been planning to do, then you could spell that as:

np.diagonal(a, offset)[...] = values

@Aa88s

This comment has been minimized.

@ewmoore
Copy link
Contributor Author

ewmoore commented Aug 31, 2019

Given that the docs currently say that 1.19 will return a read only view, I’d say our options are a little limited there. fill_diagonal can be changed to work now. There is no reason we can’t pursue both.

@eric-wieser
Copy link
Member

Don't they say 1.9 not 1.19? If we made it writeable, that's 9 release cycles for people to fix their code, which might be enough.

@ewmoore
Copy link
Contributor Author

ewmoore commented Aug 31, 2019

I should read more carefully. It does say 1.9. Maybe now is the time then.

@charris
Copy link
Member

charris commented Aug 31, 2019

I actually made that change some years ago, but it broke a (rather obscure) test. Maybe it is time to revisit it.

@numpy numpy deleted a comment from Aa88s Aug 31, 2019
@rgommers
Copy link
Member

@Aa88s please stop posting random comments. That's not acceptable on this repo nor any other open source project.

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

6 participants