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

specialize sum for FillArrays #182

Merged
merged 6 commits into from
Sep 5, 2022
Merged

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Aug 30, 2022

The specialized sum was removed in #181, relying on the specialized mapreduce instead. While this is fine for finite-sized arrays, it doesn't seem to work for infinite arrays. This PR reverts that change. With sum specialized, the following works in O(1) time again:

julia> using FillArrays, InfiniteArrays

julia> A = Ones((InfiniteArrays.OneToInf(),))
ℵ₀-element Ones{Float64, 1, Tuple{InfiniteArrays.OneToInf{Int64}}} with indices OneToInf()

julia> @time sum(A)
  0.000006 seconds
+

Ideally, we would be able to get mapreduce to work for infinite arrays, but this should avoid breaking code meanwhile.

@codecov
Copy link

codecov bot commented Aug 30, 2022

Codecov Report

Merging #182 (4516ab6) into master (6ed6ec5) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #182   +/-   ##
=======================================
  Coverage   96.95%   96.96%           
=======================================
  Files           4        4           
  Lines         657      659    +2     
=======================================
+ Hits          637      639    +2     
  Misses         20       20           
Impacted Files Coverage Δ
src/FillArrays.jl 95.60% <100.00%> (+0.02%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jishnub
Copy link
Member Author

jishnub commented Sep 2, 2022

Gentle bump @dlfivefifty. This is a bugfix and restores previous behaviour, so would be good to have this merged soon. The CI for ApproxFun has been broken by this change.

@dlfivefifty
Copy link
Member

I'm a bit worried about depending on packages which depend on this package....couldn't we just implement a simple version of OneToInf in the tests?

You could use the version in Base:

https://github.com/JuliaLang/julia/blob/master/test/testhelpers/InfiniteArrays.jl

@jishnub
Copy link
Member Author

jishnub commented Sep 4, 2022

I've updated this now as suggested. I don't think the dependency resolution should be an issue, as the test environment will dev this package, which will ensure the same version downstream. However, I do agree that adding a test dependency is unnecessary in this case.

@dlfivefifty dlfivefifty merged commit 255f641 into JuliaArrays:master Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants