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

Add region(::Plan) for accessing transformed region #65

Merged
merged 8 commits into from
Jun 30, 2022
Merged

Conversation

devmotion
Copy link
Member

Currently, there is no official and consistent way for accessing the transformed region of a FFT plan. For many plans, plan.region works but e.g. it fails for ScaledPlan. This is problematic when one tries to write generic implementations, e.g., of derivatives (see, e.g., JuliaMath/FFTW.jl#182).

This PR adds a function region(p::Plan) that can be used to access the region of a plan. It falls back to p.region but can be specialized, e.g., for ScaledPlan.

test/runtests.jl Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Feb 28, 2022

Codecov Report

Merging #65 (8c4dcd9) into master (6434327) will increase coverage by 0.16%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #65      +/-   ##
==========================================
+ Coverage   82.92%   83.09%   +0.16%     
==========================================
  Files           2        2              
  Lines         205      207       +2     
==========================================
+ Hits          170      172       +2     
  Misses         35       35              
Impacted Files Coverage Δ
src/definitions.jl 66.01% <100.00%> (+0.67%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6434327...8c4dcd9. Read the comment docs.

@gaurav-arya
Copy link
Contributor

This should be merged before #67 or into #67?

@devmotion
Copy link
Member Author

This should be merged before #67 or into #67?

IMO it would be cleaner to keep this change separate.

@gaurav-arya
Copy link
Contributor

Sounds good -- since I use region in my PR it would be good to merge this first then. @stevengj would you be able to take a look?

src/AbstractFFTs.jl Outdated Show resolved Hide resolved
src/definitions.jl Outdated Show resolved Hide resolved
@stevengj
Copy link
Member

Thanks!

I renamed region(p) to fftdims(p) — the name dims seems more common nowadays in Julia for this kind of thing (see e.g. mapslices, sum, etcetera), and since this is an exported API we have to be more careful about the naming.

(We may want to go back and change the name region to dims in the docs at some point. No need to change the region field of plans, however, as that is a private field.)

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.

3 participants