-
-
Notifications
You must be signed in to change notification settings - Fork 131
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
Add elemwise ops for GCXS #412
Conversation
Codecov Report
@@ Coverage Diff @@
## master #412 +/- ##
==========================================
+ Coverage 95.06% 95.17% +0.10%
==========================================
Files 19 19
Lines 2819 2818 -1
==========================================
+ Hits 2680 2682 +2
+ Misses 139 136 -3 |
Unfortunately linearized coords don't work for broadcasting cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @daletovar. Overall, this looks pretty awesome. I've suggested a couple of minor changes.
sparse/_compressed/compressed.py
Outdated
self.data = other.data | ||
self.indices = other.indices | ||
self.indptr = other.indptr | ||
self.compressed_axes = other.compressed_axes | ||
super().__init__(other.shape, fill_value=other.fill_value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.data = other.data | |
self.indices = other.indices | |
self.indptr = other.indptr | |
self.compressed_axes = other.compressed_axes | |
super().__init__(other.shape, fill_value=other.fill_value) | |
return self.copy(deep=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite see how this makes a copy of other
. I tried this and it makes most of the tests fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a misunderstanding on my part.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, no worries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try self.__dict__ = other.__dict__.copy()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, definitely. Should I change it for COO as well?
Thanks so much for the review, @hameerabbasi. |
round, clip, astype, mean, var, std
In the future I like the idea of converting all SparseArrays to a linearized representation and do the computations on that and then convert the result to the desired format. It looks like this is basically what's done anyway considering that
_match_arrays
works with linearized coords. I just think it's currently wasteful to convert GCXS -> COO -> linearized -> COO -> GCXS.