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

change 1:ndims(X) to ntuple(identity, ndims(X)) #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jishnub
Copy link
Contributor

@jishnub jishnub commented Mar 29, 2023

Fix #97

@codecov
Copy link

codecov bot commented Mar 29, 2023

Codecov Report

Patch coverage: 83.33% and no project coverage change.

Comparison is base (a25656d) 87.08% compared to head (f3f1ead) 87.08%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #98   +/-   ##
=======================================
  Coverage   87.08%   87.08%           
=======================================
  Files           3        3           
  Lines         209      209           
=======================================
  Hits          182      182           
  Misses         27       27           
Impacted Files Coverage Δ
src/definitions.jl 74.03% <83.33%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@jishnub
Copy link
Contributor Author

jishnub commented Mar 29, 2023

Looks like FastTransforms and GenericFFT need updating

@@ -59,7 +59,7 @@ _to1(::Tuple, x) = copy1(eltype(x), x)
for f in (:fft, :bfft, :ifft, :fft!, :bfft!, :ifft!, :rfft)
pf = Symbol("plan_", f)
@eval begin
$f(x::AbstractArray) = $f(x, 1:ndims(x))
$f(x::AbstractArray) = $f(x, ntuple(identity, ndims(x)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just use

Suggested change
$f(x::AbstractArray) = $f(x, ntuple(identity, ndims(x)))
$f(x::AbstractArray) = $f(x, Base.OneTo(ndims(x)))

? Maybe that already fixes constant propagation? It would be less breaking (I think) and should also be more efficient if ndims(x) is large.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this necessarily fixes the issue without the compiler propagating ndims(x) as a constant.

Regarding large ndims, IIUC Tuples are performant till a length of 32, and it's uncommon to have arrays with that many dimensions. In any case, this could be an optimization for ndims(x)<4, which is perhaps the common case.

I fully understand and sympathize with your concern about breakages. I'll see if the direct dependants can be fixed first so that they accept arbitrary regions, before this is considered

@jishnub jishnub closed this Apr 3, 2023
@jishnub jishnub reopened this Apr 3, 2023
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.

Convert 1:ndims(X) to ntuple(identity, ndims(X))
2 participants