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.

Support for batched `cupyx.scipy.sparse.linalg.spsolve`

See original GitHub issue

Description

Currently, cupy.linalg.solve supports batch processing. Such functionality for cupyx.scipy.sparse.linalg.spsolve would be a great asset and would prevent slow, manual loops.

For example: N being the batch dimension A x = b , with

  • A: Sparse matrix with dimension (N, M, M) or as list with N-Sparse matrices (M, M).

  • b: Dense matrix with dimension (N, M) or as list with N-Dense vectors (M).

  • x: Dense matrix with dimension (N, M) or as list with N-Dense vectors (M).

Additional Information

No response

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
asoriecommented, Mar 29, 2022

In the meantime, I found another solution to enable “batched” spsolve. I combined all my A input matrices into one global matrix and reshaped the b vectors into one vector. After that, instead of many systems of equations, you can solve just the one. Then the output vector x can be reshaped into the desired batched shape. The basic idea came from this post.

3reactions
leofangcommented, Mar 28, 2022

@kmaehashi @emcastillo can we reopen this for now? batched spsolve is one of the most frequent asks I’ve run into and it’d be nice to discuss further.

Read more comments on GitHub >

github_iconTop Results From Across the Web

cupyx.scipy.sparse.linalg.spsolve — CuPy 11.4.0 documentation
cupyx.scipy.sparse.linalg.spsolve(A, b)[source]#. Solves a sparse linear system A x = b. Parameters. A (cupyx.scipy.sparse.spmatrix) – Sparse matrix with ...
Read more >
scipy.sparse.linalg.spsolve — SciPy v1.9.3 Manual
Solve the sparse linear system Ax=b, where b may be a vector or a matrix. Parameters. Andarray or sparse matrix. The square matrix...
Read more >
CuPy Documentation - Read the Docs
Supports the semantics identical to numpy.ndarray, including basic / advanced indexing and broadcasting. • Sparse matrices: cupyx.scipy.
Read more >
cupy-cuda102: Versions - Openbase
Fix 1-dim lexsort (#7191); Fix cupyx.scipy.ndimage.zoom for outputs of size ... RHS in cupyx.scipy.sparse.linalg.spsolve (#5180); Fix poisson to support lam ...
Read more >
Scipy sparse invert or spsolve lead to ... - Stack Overflow
ones(N) ) as you question falsely assumes. The point here is that matrix inverses are seldom useful in numerical linear algebra: the solution...
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