-
Notifications
You must be signed in to change notification settings - Fork 27
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
Extend FTPlans to Arrays and higher dimensions #252
Extend FTPlans to Arrays and higher dimensions #252
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #252 +/- ##
==========================================
+ Coverage 82.78% 83.07% +0.29%
==========================================
Files 16 17 +1
Lines 2805 2930 +125
==========================================
+ Hits 2322 2434 +112
- Misses 483 496 +13 ☔ View full report in Codecov by Sentry. |
@dlfivefifty I've implemented the n-dimensional array * and \ for Works much faster than looping over columns naively. |
Cool! Note I implemented something very similar (but assuming its a matrix, not a 1D plan) here: Probably we should consolidate these two types? |
Ah yep, I was not aware. Am I right in thinking
|
Or is it only looping over the dims..? |
src/arrays.jl
Outdated
|
||
size(P::NDimsPlan) = P.szs | ||
size(P::NDimsPlan, k::Int) = P.szs[k] | ||
size(P::NDimsPlan, k...) = P.szs[[k...]] |
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.
Why the array construction in the indexing? Shouldn't this just be P.szs[k...]
?
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've probably misunderstood what k
is. I copied the size(P, k...)
structure from size(P::JacobiTransformPlan, k...) = size(P.chebtransform, k...) and assumed it is a tuple. In which case P.szs[k...]
does not work.
e.g.
julia> szs = (10,20,30);
julia> szs[[(1,2)...]]
(10, 20)
julia> szs[(1,2)...]
ERROR: MethodError: no method matching getindex(::Tuple{Int64, Int64, Int64}, ::Int64, ::Int64)
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.
Perhaps I've misunderstood this. Are you trying to obtain multiple indices in one go?
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.
That's the intention! Although I don't need that functionality in this PR.
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.
Perhaps best to remove it then, as it's not the conventional usage of size
. One may broadcast size
over indices to obtain the sizes along multiple dimensions at once.
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.
Note sizes of plans and arrays behave differently
compare w FFT
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.
judging by this line here https://github.com/JuliaMath/FFTW.jl/blob/f888022d7a1ff78491abf8f33f1055cc52a68f0a/src/fft.jl#L254 I think I should only really keep size(P::NDimsPlan) = P.szs
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.
...or maybe I should keep size(P::NDimsPlan, k::Int) = P.szs[k]
?
Any opposition to merging? @dlfivefifty @jishnub |
Hi @dlfivefifty @jishnub @MikaelSlevinsky unless someone is opposed, I will bump the version number, merge and tag in a couple of days! |
I don't have any objections |
It does what you want it to do? |
Yes! It makes it easy to take an FTPlan and turn it into an n-dimensional FTPlan applied across multiple array dimensions. |
b493372
into
JuliaApproximation:master
No description provided.