question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dask Array's diag supporting diagonal selection

See original GitHub issue

Would be nice if Dask Array’s diag supported the k value to allow selection of the diagonal as NumPy’s implementation does. It seems like Dask Array’s API docs suggest diag does support k, but the code does not allow for this option.

https://github.com/dask/dask/blob/f015b5f0808420bdd23f8408f5822d2f5aff8ff1/dask/array/creation.py#L413

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jakirkhamcommented, May 20, 2019

Cool, thanks for working on this. Please let us know if you need pointers or would like someone to take a look.

0reactions
TAdeJongcommented, May 20, 2019

I am working on a pull request on this using #4431 for the diagonal extraction case. WIP though, as I was surprised by the $(n+k)*(n+k)$ output of np.diag(np.ones(n), k). I also want to have a look into cleaning up the shared but different code in da.triu, da.tril and da.diag.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dask.array.diag - Dask documentation
Extract a diagonal or construct a diagonal array. This docstring was copied from numpy.diag. Some inconsistencies with the Dask version may exist. See...
Read more >
dask.array.diagonal - Dask documentation
If a is 2-D, returns the diagonal of a with the given offset, i.e., the collection of elements of the form a[i, i+offset]...
Read more >
API - Dask documentation
compress (condition, a[, axis]). Return selected slices of an array along given axis. ... diag (v[, k]). Extract a diagonal or construct a...
Read more >
dask.array.creation - Dask documentation
Source code for dask.array.creation ... chunks="auto", M=None, k=0, dtype=float): """ Return a 2-D Array with ones on the diagonal and zeros elsewhere.
Read more >
Source code for dask.array.linalg - Dask documentation
Have only one column of blocks\n\n" "Note: This function (tsqr) supports QR ... matrix l: Array, lower triangular matrix with unit diagonal. u:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found