-
Notifications
You must be signed in to change notification settings - Fork 1
Add min max #116
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
base: main
Are you sure you want to change the base?
Add min max #116
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #116 +/- ##
==========================================
- Coverage 98.33% 96.10% -2.24%
==========================================
Files 17 19 +2
Lines 421 462 +41
==========================================
+ Hits 414 444 +30
- Misses 7 18 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hi! Thanks for the PR! I did some of the deduplication, but all function bodies are identical except for the existence/non-existence of but I can do that later. |
Hi @flying-sheep, A few comments:
>>> import dask.array as da
>>> from fast_array_utils import stats
>>> x = da.random.random((1000, 1000), chunks=(100, 100))
>>> stats.sum(x).compute(), stats.sum(x, dtype=int).compute()
(np.float64(500227.801967892), np.int64(500173)) # large difference
>>> x.sum(dtype=int).compute()
0 # convert to int before summing |
Hi! I’m also responding late, since I was on a hackathon last week!
Probably not, I assume that
maybe no better way than to go back to manual
What numpy does is this:
ah, looks like we don’t test I guess that’s a bug then! #124 |
OK, new info here:
so we’re also circumventing the bug for scipy, which makes the |
Thanks for the in-depth analysis @flying-sheep, and good catch for the scipy bug! |
once the other PR is merged, I think we can progress here! Except for the overloads: I still don’t have a good idea on how to get them both into the docs and the typing without repeating ourselves. |
OK, I think I merged it all in, now we just need to fix mypy and the docs and this should be ready! |
Hello @flying-sheep @Zethson,
As mentioned in #112, I added support for min/max, but I'm unsure about my implementation, notably regarding code quality:
sum
function, but it has some minor differences due to the fact that the min/max operations don't use thedtype
argument. I think I could potentially make a function that is generic enough to handle all these "simple" operations at once, but I'm worried it would become too abstract and complex to read/maintain. What do you think?normalize_axis
andget_shape
) are shared forsum
andmin/max
, so I wanted to check with you where we should move them. E.g., I can createstats/_utils.py
?Closes #112