Skip to content

Commit 9c21452

Browse files
timholytkelman
authored andcommitted
Fix copy(region::Tuple) depwarn in FFTW (#17840)
1 parent 42c1b95 commit 9c21452

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

base/fft/FFTW.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:Complex128,"fftw",libfftw),
459459
region, flags::Integer, timelimit::Real)
460460
direction = K
461461
set_timelimit($Tr, timelimit)
462-
R = copy(region)
462+
R = isa(region, Tuple) ? region : copy(region)
463463
dims, howmany = dims_howmany(X, Y, [size(X)...], R)
464464
plan = ccall(($(string(fftw,"_plan_guru64_dft")),$lib),
465465
PlanPtr,
@@ -477,7 +477,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:Complex128,"fftw",libfftw),
477477
@eval function (::Type{rFFTWPlan{$Tr,$FORWARD,inplace,N}}){inplace,N}(X::StridedArray{$Tr,N},
478478
Y::StridedArray{$Tc,N},
479479
region, flags::Integer, timelimit::Real)
480-
R = copy(region)
480+
R = isa(region, Tuple) ? region : copy(region)
481481
region = circshift([region...],-1) # FFTW halves last dim
482482
set_timelimit($Tr, timelimit)
483483
dims, howmany = dims_howmany(X, Y, [size(X)...], region)
@@ -497,7 +497,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:Complex128,"fftw",libfftw),
497497
@eval function (::Type{rFFTWPlan{$Tc,$BACKWARD,inplace,N}}){inplace,N}(X::StridedArray{$Tc,N},
498498
Y::StridedArray{$Tr,N},
499499
region, flags::Integer, timelimit::Real)
500-
R = copy(region)
500+
R = isa(region, Tuple) ? region : copy(region)
501501
region = circshift([region...],-1) # FFTW halves last dim
502502
set_timelimit($Tr, timelimit)
503503
dims, howmany = dims_howmany(X, Y, [size(Y)...], region)
@@ -518,7 +518,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:Complex128,"fftw",libfftw),
518518
Y::StridedArray{$Tr,N},
519519
region, kinds, flags::Integer,
520520
timelimit::Real)
521-
R = copy(region)
521+
R = isa(region, Tuple) ? region : copy(region)
522522
knd = fix_kinds(region, kinds)
523523
set_timelimit($Tr, timelimit)
524524
dims, howmany = dims_howmany(X, Y, [size(X)...], region)
@@ -540,7 +540,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:Complex128,"fftw",libfftw),
540540
Y::StridedArray{$Tc,N},
541541
region, kinds, flags::Integer,
542542
timelimit::Real)
543-
R = copy(region)
543+
R = isa(region, Tuple) ? region : copy(region)
544544
knd = fix_kinds(region, kinds)
545545
set_timelimit($Tr, timelimit)
546546
dims, howmany = dims_howmany(X, Y, [size(X)...], region)

test/fft.jl

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
# fft
44
a = rand(8) + im*rand(8)
55
@test norm(ifft(fft(a)) - a) < 1e-8
6+
@test norm(ifft(fft(a,1),1) - a) < 1e-8
7+
@test norm(ifft(fft(a,[1]),[1]) - a) < 1e-8
8+
@test norm(ifft(fft(a,(1,)),(1,)) - a) < 1e-8
69

710
m4 = [16. 2 3 13;
811
5 11 10 8;

0 commit comments

Comments
 (0)