-
Notifications
You must be signed in to change notification settings - Fork 7
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
Faster czt #43
Faster czt #43
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #43 +/- ##
=======================================
Coverage 92.92% 92.93%
=======================================
Files 18 18
Lines 1018 1019 +1
=======================================
+ Hits 946 947 +1
Misses 72 72 ☔ View full report in Codecov by Sentry. |
@@ -267,30 +269,38 @@ function czt_1d(xin, plan::CZTPlan_1D) | |||
# which (intentionally) leads to non-real results for even-sized arrays at non-unit zoom | |||
|
|||
L = size(plan.fft_fv, plan.d) | |||
nsz = ntuple((dd) -> (dd==plan.d) ? L : size(xin, dd), Val(ndims(xin))) | |||
nsz = ntuple((dd) -> (dd==plan.d) ? L : size(xin, dd), Val(D)) # sizes may vary per dimension, so a new array has to be generated | |||
# append zeros | |||
y = zeros(eltype(plan.aw), nsz) |
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.
If you want this CUDA runable, do
y = similar(xin, eltype(plan.aw), nsz)
fill!(y, 0)
In my code, I try to avoid zeros
or ones
.
# corner = ntuple((x)->1, Val(ndims(xin))) | ||
# select_region(xin .* plan.aw, new_size=nsz, center=corner, dst_center=corner) | ||
|
||
# g = ifft(fft(y, d) .* plan.fft_fv, d) | ||
g = plan.ifftw_plan * (plan.fftw_plan * y .* plan.fft_fv) | ||
plan.fftw_plan! * y # in-place application to y |
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.
in general avoid comments behind lines, do better above.
to speed up the czt performance. Also added support for arbitrary transform-dims.