On Sun, Feb 9, 2025 at 6:34 PM Carlos Martin <cgmar...@andrew.cmu.edu>
wrote:

> The following functions accept a diagonal offset argument:
> - https://numpy.org/doc/stable/reference/generated/numpy.diag.html
> - https://numpy.org/doc/stable/reference/generated/numpy.diagflat.html
> - https://numpy.org/doc/stable/reference/generated/numpy.diagonal.html
> - https://numpy.org/doc/stable/reference/generated/numpy.eye.html
> - https://numpy.org/doc/stable/reference/generated/numpy.trace.html
> - https://numpy.org/doc/stable/reference/generated/numpy.tri.html
> - https://numpy.org/doc/stable/reference/generated/numpy.tril.html
> - https://numpy.org/doc/stable/reference/generated/numpy.tril_indices.html
> -
> https://numpy.org/doc/stable/reference/generated/numpy.tril_indices_from.html
> - https://numpy.org/doc/stable/reference/generated/numpy.triu.html
> - https://numpy.org/doc/stable/reference/generated/numpy.triu_indices.html
> -
> https://numpy.org/doc/stable/reference/generated/numpy.triu_indices_from.html
>
> The following functions lack such an argument:
> - https://numpy.org/doc/stable/reference/generated/numpy.diag_indices.html
> -
> https://numpy.org/doc/stable/reference/generated/numpy.diag_indices_from.html
> -
> https://numpy.org/doc/stable/reference/generated/numpy.fill_diagonal.html
>     - https://github.com/numpy/numpy/issues/14402
>     - https://github.com/numpy/numpy/issues/18000
>     - https://github.com/numpy/numpy/pull/15079
> - https://numpy.org/doc/stable/reference/generated/numpy.identity.html
>
> Feature request: Add a diagonal offset argument to all of the functions
> that are missing it. (fill_diagonal is already tracked by the
> aforementioned issues, but the rest aren't, to my knowledge.)
>

This sounds quite reasonable to me. The `k=0` keyword is quite badly named,
which is my one concern. Especially when tacking it on at the end of a
signature with already 3-4 keywords, it's not a good name. How about
something like `diag_offset`?

Cheers,
Ralf
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to