Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve gcxs compression #601

Merged
merged 2 commits into from
Jan 5, 2024

Conversation

jamestwebber
Copy link
Contributor

This PR closes #596 in a fairly simple way: if all of the inputs are GCXS arrays and they have the same compression, it will return the output with the same compression. I just do this by storing a kwargs dictionary during the _Elemwise initialization.

A further enhancement that I'm exploring: if the ufunc has a single input, we could avoid the conversion to COO entirely, as well as skip some other checks. In this case we know that our argument is sparse (or we wouldn't be creating this class) and we know that it "broadcasts" to the same shape. The things to consider are the potential keywords for the ufunc: where, out, etc.

@codecov
Copy link

codecov bot commented Jul 2, 2023

Codecov Report

Merging #601 (0d04116) into master (e1990b2) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #601      +/-   ##
==========================================
+ Coverage   90.42%   90.43%   +0.01%     
==========================================
  Files          20       20              
  Lines        3560     3564       +4     
==========================================
+ Hits         3219     3223       +4     
  Misses        341      341              

@hameerabbasi
Copy link
Collaborator

@jamestwebber do you mind if we land #599 first? Should be done by tomorrow.

@jamestwebber
Copy link
Contributor Author

jamestwebber commented Jul 2, 2023 via email

@hameerabbasi
Copy link
Collaborator

@jamestwebber pre-commit and pyproject.toml is in, you can rebase this PR if you wish.

@jamestwebber jamestwebber force-pushed the preserve-gcxs-compression branch from 683b2b8 to 0d04116 Compare January 5, 2024 15:13
@hameerabbasi hameerabbasi merged commit 790f6d5 into pydata:master Jan 5, 2024
13 checks passed
@hameerabbasi
Copy link
Collaborator

Thanks for your patience and work on this, @jamestwebber!

@jamestwebber
Copy link
Contributor Author

One thing I didn't do is add a test for regression. "when I have time" 😂 I will open a new PR with a fast unary path and I can add tests then.

@jamestwebber jamestwebber deleted the preserve-gcxs-compression branch January 5, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

numpy ufuncs can change the compression of a gcxs array
2 participants