pydata / pydata/sparse

Store linearized indices instead of full coordinates

Open
#164 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion
Dominant language
Python
Stars
668
Forks
141
Avg merge
2d 8h
Merged PRs (30d)
4

Description

I was thinking of replacing the full coordinates (coords) with just a 1-D array of linearised indices.

Pros:

  • More memory efficient (this gives back a lot of benefits of #158)
  • Some O(N) operations become O(1) such as reshape, flatnonzero.
  • COO becomes a special case of the GCRS/GCCS scheme, which means we can drop CSD and go with GCRS/GCCS, but with the difference that any collection of axes (not just rows/columns) can be compressed.
  • CSR/CSC are represented exactly as in SciPy/other libraries (instead of having 2-D indices)

Cons:

  • Adds a small (my intuition says almost negligible) performance penalty in many operations.
  • Some O(1) operations become O(N) such as nonzero, the one-argument version of where.

cc @mrocklin, @stefanv

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

No files, tests, or entry points are named. Start by locating the current coords representation and the implementations of reshape, flatnonzero, nonzero, and where; review the linked GCRS/GCCS paper and SciPy's CSR/CSC conventions. Done requires an agreed representation, updated affected operations, and validated performance trade-offs.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.