Skip to content

Commit 703fd38

Browse files
fixed type instabilies in czt
1 parent ff1fbdd commit 703fd38

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ChainRulesCore = "0.9, 0.10, 1.0, 1.1, 1"
1818
FFTW = "1.5"
1919
ImageTransformations = "0.9"
2020
IndexFunArrays = "0.2"
21-
NDTools = "0.4.2, 0.4.3, 0.4.4"
21+
NDTools = "0.4.2, 0.4.3, 0.4.4, 0.5"
2222
NFFT = "0.11, 0.12, 0.13"
2323
PaddedViews = "0.5"
2424
ShiftedArrays = "1"

src/czt.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ function czt_1d(xin, scaled, d)
4242
# is always 1d (small array)
4343
fv = fft(to_fft)
4444

45-
y = xin .* reorient(aa,d)
45+
y = xin .* reorient(aa,Val(d))
4646
# twice the size along direction d
47-
nsz = sz .* NDTools.single_dim_size(d,2,length(sz))
47+
nsz = sz .* NDTools.single_dim_size(d,2,Val(length(sz)))
4848
to_fft = NDTools.select_region(y, new_size=nsz, center=nsz2 .+1)
4949
# convolve on a larger grid along one dimension
50-
g = ifft(fft(to_fft, d) .* reorient(fv,d), d)
50+
g = ifft(fft(to_fft, d) .* reorient(fv,Val(d)), d)
5151
# return g
5252
oldctr = sz[d]÷2 + 1
5353
newctr = size(g) 2 .+1
@@ -62,7 +62,7 @@ function czt_1d(xin, scaled, d)
6262
# is a 1d list of factors
6363
fak = ww[dsize:(2*dsize-1)] .* cispi.(ramp(rtype,1,dsize, scale=1/scaled * extra_phase))
6464
# return select_region(g, new_size=sz,center=ctr)
65-
xout = select_region(g, new_size=sz,center=ctr) .* reorient(fak,d)
65+
xout = select_region(g, new_size=sz,center=ctr) .* reorient(fak,Val(d))
6666

6767
# this is a fix to deal with the problem that imaginary numbers are appearing for even-sized arrays, caused by the first entry
6868
if iseven(dsize) && (scaled>1.0)
@@ -73,7 +73,7 @@ function czt_1d(xin, scaled, d)
7373
end
7474
end
7575
return xout
76-
# xout .= g[dsize:(2*dsize-1)] .* reorient(fak,d)
76+
# xout .= g[dsize:(2*dsize-1)] .* reorient(fak,Val(d))
7777
end
7878

7979
"""

0 commit comments

Comments
 (0)