pymc-devs / pymc-devs/pytensor

Should PyTensor extend its Numba overloads to support all `scipy.sparse.cs[r|c]_matrix` initialization modes?

Open
#1,872 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

numba request discussion sparse variables
Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Description

PyTensor’s Numba overloads for scipy.sparse.cs[r|c]_matrix currently support only a subset of the initialization behaviors provided by the corresponding SciPy constructors.

For example, calling

scipy.sparse.csr_matrix(a_csr_matrix)
scipy.sparse.csc_matrix(a_csc_matrix)

always creates a copy in our Numba overloads, while SciPy allows users to control this behavior via the copy parameter.

I’m opening this issue to:

  • Avoid losing track of the discussion started in https://github.com/pymc-devs/pytensor/pull/1860/changes#r2751489368
  • Open a broader discussion about whether PyTensor’s Numba overloads for SciPy sparse matrix constructors should support more (or all) of the input combinations and behaviors already supported by SciPy.
    • If we decide to expand support, should this work be done here or in numba-sparse?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the Numba overloads for scipy.sparse.csr_matrix and scipy.sparse.csc_matrix, then review the discussion in pull request 1860. Compare the supported initialization modes with the SciPy constructors and clarify whether broader support belongs in PyTensor or numba-sparse. Done means the scope and ownership of the expansion are agreed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.