@@ -56,7 +56,7 @@ function plan_r2r end
56
56
# # FFT: Implement fft by calling fftw.
57
57
58
58
const version = VersionNumber (split (unsafe_string (cglobal (
59
- (:fftw_version ,libfftw3[] ), UInt8)), [' -' , ' ' ])[2 ])
59
+ (:fftw_version ,libfftw3 () ), UInt8)), [' -' , ' ' ])[2 ])
60
60
61
61
# # Direction of FFT
62
62
@@ -141,32 +141,32 @@ alignment_of(A::FakeArray) = Int32(0)
141
141
@exclusive function export_wisdom (fname:: AbstractString )
142
142
f = ccall (:fopen , Ptr{Cvoid}, (Cstring,Cstring), fname, :w )
143
143
systemerror (" could not open wisdom file $fname for writing" , f == C_NULL )
144
- ccall ((:fftw_export_wisdom_to_file ,libfftw3[] ), Cvoid, (Ptr{Cvoid},), f)
144
+ ccall ((:fftw_export_wisdom_to_file ,libfftw3 () ), Cvoid, (Ptr{Cvoid},), f)
145
145
ccall (:fputs , Int32, (Ptr{UInt8},Ptr{Cvoid}), " " ^ 256 , f) # no NUL, hence no Cstring
146
- ccall ((:fftwf_export_wisdom_to_file ,libfftw3f[] ), Cvoid, (Ptr{Cvoid},), f)
146
+ ccall ((:fftwf_export_wisdom_to_file ,libfftw3f () ), Cvoid, (Ptr{Cvoid},), f)
147
147
ccall (:fclose , Cvoid, (Ptr{Cvoid},), f)
148
148
end
149
149
150
150
@exclusive function import_wisdom (fname:: AbstractString )
151
151
f = ccall (:fopen , Ptr{Cvoid}, (Cstring,Cstring), fname, :r )
152
152
systemerror (" could not open wisdom file $fname for reading" , f == C_NULL )
153
- if ccall ((:fftw_import_wisdom_from_file ,libfftw3[] ),Int32,(Ptr{Cvoid},),f)== 0 ||
154
- ccall ((:fftwf_import_wisdom_from_file ,libfftw3f[] ),Int32,(Ptr{Cvoid},),f)== 0
153
+ if ccall ((:fftw_import_wisdom_from_file ,libfftw3 () ),Int32,(Ptr{Cvoid},),f)== 0 ||
154
+ ccall ((:fftwf_import_wisdom_from_file ,libfftw3f () ),Int32,(Ptr{Cvoid},),f)== 0
155
155
error (" failed to import wisdom from $fname " )
156
156
end
157
157
ccall (:fclose , Cvoid, (Ptr{Cvoid},), f)
158
158
end
159
159
160
160
@exclusive function import_system_wisdom ()
161
- if ccall ((:fftw_import_system_wisdom ,libfftw3[] ), Int32, ()) == 0 ||
162
- ccall ((:fftwf_import_system_wisdom ,libfftw3f[] ), Int32, ()) == 0
161
+ if ccall ((:fftw_import_system_wisdom ,libfftw3 () ), Int32, ()) == 0 ||
162
+ ccall ((:fftwf_import_system_wisdom ,libfftw3f () ), Int32, ()) == 0
163
163
error (" failed to import system wisdom" )
164
164
end
165
165
end
166
166
167
167
@exclusive function forget_wisdom ()
168
- ccall ((:fftw_forget_wisdom ,libfftw3[] ), Cvoid, ())
169
- ccall ((:fftwf_forget_wisdom ,libfftw3f[] ), Cvoid, ())
168
+ ccall ((:fftw_forget_wisdom ,libfftw3 () ), Cvoid, ())
169
+ ccall ((:fftwf_forget_wisdom ,libfftw3f () ), Cvoid, ())
170
170
end
171
171
172
172
# Threads
@@ -176,15 +176,15 @@ function _set_num_threads(num_threads::Integer)
176
176
@static if fftw_provider == " mkl"
177
177
_last_num_threads[] = num_threads
178
178
end
179
- ccall ((:fftw_plan_with_nthreads ,libfftw3[] ), Cvoid, (Int32,), num_threads)
180
- ccall ((:fftwf_plan_with_nthreads ,libfftw3f[] ), Cvoid, (Int32,), num_threads)
179
+ ccall ((:fftw_plan_with_nthreads ,libfftw3 () ), Cvoid, (Int32,), num_threads)
180
+ ccall ((:fftwf_plan_with_nthreads ,libfftw3f () ), Cvoid, (Int32,), num_threads)
181
181
end
182
182
183
183
@exclusive set_num_threads (num_threads:: Integer ) = _set_num_threads (num_threads)
184
184
185
185
function get_num_threads ()
186
186
@static if fftw_provider == " fftw"
187
- ccall ((:fftw_planner_nthreads ,libfftw3[] ), Cint, ())
187
+ ccall ((:fftw_planner_nthreads ,libfftw3 () ), Cint, ())
188
188
else
189
189
_last_num_threads[]
190
190
end
@@ -211,9 +211,9 @@ const NO_TIMELIMIT = -1.0 # from fftw3.h
211
211
212
212
# only call these when fftwlock is held:
213
213
unsafe_set_timelimit (precision:: fftwTypeDouble ,seconds) =
214
- ccall ((:fftw_set_timelimit ,libfftw3[] ), Cvoid, (Float64,), seconds)
214
+ ccall ((:fftw_set_timelimit ,libfftw3 () ), Cvoid, (Float64,), seconds)
215
215
unsafe_set_timelimit (precision:: fftwTypeSingle ,seconds) =
216
- ccall ((:fftwf_set_timelimit ,libfftw3f[] ), Cvoid, (Float64,), seconds)
216
+ ccall ((:fftwf_set_timelimit ,libfftw3f () ), Cvoid, (Float64,), seconds)
217
217
@exclusive set_timelimit (precision, seconds) = unsafe_set_timelimit (precision, seconds)
218
218
219
219
# Array alignment mod 16:
@@ -234,9 +234,9 @@ unsafe_set_timelimit(precision::fftwTypeSingle,seconds) =
234
234
convert (Int32, convert (Int64, pointer (A)) % 16 )
235
235
else
236
236
alignment_of (A:: StridedArray{T} ) where {T<: fftwDouble } =
237
- ccall ((:fftw_alignment_of , libfftw3[] ), Int32, (Ptr{T},), A)
237
+ ccall ((:fftw_alignment_of , libfftw3 () ), Int32, (Ptr{T},), A)
238
238
alignment_of (A:: StridedArray{T} ) where {T<: fftwSingle } =
239
- ccall ((:fftwf_alignment_of , libfftw3f[] ), Int32, (Ptr{T},), A)
239
+ ccall ((:fftwf_alignment_of , libfftw3f () ), Int32, (Ptr{T},), A)
240
240
end
241
241
242
242
# FFTWPlan (low-level)
@@ -320,9 +320,9 @@ unsafe_convert(::Type{PlanPtr}, p::FFTWPlan) = p.plan
320
320
321
321
# these functions should only be called while the fftwlock is held
322
322
unsafe_destroy_plan (@nospecialize (plan:: FFTWPlan{<:fftwDouble} )) =
323
- ccall ((:fftw_destroy_plan ,libfftw3[] ), Cvoid, (PlanPtr,), plan)
323
+ ccall ((:fftw_destroy_plan ,libfftw3 () ), Cvoid, (PlanPtr,), plan)
324
324
unsafe_destroy_plan (@nospecialize (plan:: FFTWPlan{<:fftwSingle} )) =
325
- ccall ((:fftwf_destroy_plan ,libfftw3f[] ), Cvoid, (PlanPtr,), plan)
325
+ ccall ((:fftwf_destroy_plan ,libfftw3f () ), Cvoid, (PlanPtr,), plan)
326
326
327
327
const deferred_destroy_lock = ReentrantLock () # lock protecting the deferred_destroy_plans list
328
328
const deferred_destroy_plans = FFTWPlan[]
@@ -388,19 +388,19 @@ end
388
388
# ################################################################################################
389
389
390
390
cost (plan:: FFTWPlan{<:fftwDouble} ) =
391
- ccall ((:fftw_cost ,libfftw3[] ), Float64, (PlanPtr,), plan)
391
+ ccall ((:fftw_cost ,libfftw3 () ), Float64, (PlanPtr,), plan)
392
392
cost (plan:: FFTWPlan{<:fftwSingle} ) =
393
- ccall ((:fftwf_cost ,libfftw3f[] ), Float64, (PlanPtr,), plan)
393
+ ccall ((:fftwf_cost ,libfftw3f () ), Float64, (PlanPtr,), plan)
394
394
395
395
@exclusive function arithmetic_ops (plan:: FFTWPlan{<:fftwDouble} )
396
396
add, mul, fma = Ref (0.0 ), Ref (0.0 ), Ref (0.0 )
397
- ccall ((:fftw_flops ,libfftw3[] ), Cvoid,
397
+ ccall ((:fftw_flops ,libfftw3 () ), Cvoid,
398
398
(PlanPtr,Ref{Float64},Ref{Float64},Ref{Float64}), plan, add, mul, fma)
399
399
return (round (Int64, add[]), round (Int64, mul[]), round (Int64, fma[]))
400
400
end
401
401
@exclusive function arithmetic_ops (plan:: FFTWPlan{<:fftwSingle} )
402
402
add, mul, fma = Ref (0.0 ), Ref (0.0 ), Ref (0.0 )
403
- ccall ((:fftwf_flops ,libfftw3f[] ), Cvoid,
403
+ ccall ((:fftwf_flops ,libfftw3f () ), Cvoid,
404
404
(PlanPtr,Ref{Float64},Ref{Float64},Ref{Float64}), plan, add, mul, fma)
405
405
return (round (Int64, add[]), round (Int64, mul[]), round (Int64, fma[]))
406
406
end
@@ -431,9 +431,9 @@ const has_sprint_plan = version >= v"3.3.4" && fftw_provider == "fftw"
431
431
432
432
@static if has_sprint_plan
433
433
sprint_plan_ (plan:: FFTWPlan{<:fftwDouble} ) =
434
- ccall ((:fftw_sprint_plan ,libfftw3[] ), Ptr{UInt8}, (PlanPtr,), plan)
434
+ ccall ((:fftw_sprint_plan ,libfftw3 () ), Ptr{UInt8}, (PlanPtr,), plan)
435
435
sprint_plan_ (plan:: FFTWPlan{<:fftwSingle} ) =
436
- ccall ((:fftwf_sprint_plan ,libfftw3f[] ), Ptr{UInt8}, (PlanPtr,), plan)
436
+ ccall ((:fftwf_sprint_plan ,libfftw3f () ), Ptr{UInt8}, (PlanPtr,), plan)
437
437
function sprint_plan (plan:: FFTWPlan )
438
438
p = sprint_plan_ (plan)
439
439
str = unsafe_string (p)
@@ -515,49 +515,49 @@ _colmajorstrides(p) = ()
515
515
# Execute
516
516
517
517
unsafe_execute! (plan:: FFTWPlan{<:fftwDouble} ) =
518
- ccall ((:fftw_execute ,libfftw3[] ), Cvoid, (PlanPtr,), plan)
518
+ ccall ((:fftw_execute ,libfftw3 () ), Cvoid, (PlanPtr,), plan)
519
519
520
520
unsafe_execute! (plan:: FFTWPlan{<:fftwSingle} ) =
521
- ccall ((:fftwf_execute ,libfftw3f[] ), Cvoid, (PlanPtr,), plan)
521
+ ccall ((:fftwf_execute ,libfftw3f () ), Cvoid, (PlanPtr,), plan)
522
522
523
523
unsafe_execute! (plan:: cFFTWPlan{T} ,
524
524
X:: StridedArray{T} , Y:: StridedArray{T} ) where {T<: fftwDouble } =
525
- ccall ((:fftw_execute_dft ,libfftw3[] ), Cvoid,
525
+ ccall ((:fftw_execute_dft ,libfftw3 () ), Cvoid,
526
526
(PlanPtr,Ptr{T},Ptr{T}), plan, X, Y)
527
527
528
528
unsafe_execute! (plan:: cFFTWPlan{T} ,
529
529
X:: StridedArray{T} , Y:: StridedArray{T} ) where {T<: fftwSingle } =
530
- ccall ((:fftwf_execute_dft ,libfftw3f[] ), Cvoid,
530
+ ccall ((:fftwf_execute_dft ,libfftw3f () ), Cvoid,
531
531
(PlanPtr,Ptr{T},Ptr{T}), plan, X, Y)
532
532
533
533
unsafe_execute! (plan:: rFFTWPlan{Float64,FORWARD} ,
534
534
X:: StridedArray{Float64} , Y:: StridedArray{Complex{Float64}} ) =
535
- ccall ((:fftw_execute_dft_r2c ,libfftw3[] ), Cvoid,
535
+ ccall ((:fftw_execute_dft_r2c ,libfftw3 () ), Cvoid,
536
536
(PlanPtr,Ptr{Float64},Ptr{Complex{Float64}}), plan, X, Y)
537
537
538
538
unsafe_execute! (plan:: rFFTWPlan{Float32,FORWARD} ,
539
539
X:: StridedArray{Float32} , Y:: StridedArray{Complex{Float32}} ) =
540
- ccall ((:fftwf_execute_dft_r2c ,libfftw3f[] ), Cvoid,
540
+ ccall ((:fftwf_execute_dft_r2c ,libfftw3f () ), Cvoid,
541
541
(PlanPtr,Ptr{Float32},Ptr{Complex{Float32}}), plan, X, Y)
542
542
543
543
unsafe_execute! (plan:: rFFTWPlan{Complex{Float64},BACKWARD} ,
544
544
X:: StridedArray{Complex{Float64}} , Y:: StridedArray{Float64} ) =
545
- ccall ((:fftw_execute_dft_c2r ,libfftw3[] ), Cvoid,
545
+ ccall ((:fftw_execute_dft_c2r ,libfftw3 () ), Cvoid,
546
546
(PlanPtr,Ptr{Complex{Float64}},Ptr{Float64}), plan, X, Y)
547
547
548
548
unsafe_execute! (plan:: rFFTWPlan{Complex{Float32},BACKWARD} ,
549
549
X:: StridedArray{Complex{Float32}} , Y:: StridedArray{Float32} ) =
550
- ccall ((:fftwf_execute_dft_c2r ,libfftw3f[] ), Cvoid,
550
+ ccall ((:fftwf_execute_dft_c2r ,libfftw3f () ), Cvoid,
551
551
(PlanPtr,Ptr{Complex{Float32}},Ptr{Float32}), plan, X, Y)
552
552
553
553
unsafe_execute! (plan:: r2rFFTWPlan{T} ,
554
554
X:: StridedArray{T} , Y:: StridedArray{T} ) where {T<: fftwDouble } =
555
- ccall ((:fftw_execute_r2r ,libfftw3[] ), Cvoid,
555
+ ccall ((:fftw_execute_r2r ,libfftw3 () ), Cvoid,
556
556
(PlanPtr,Ptr{T},Ptr{T}), plan, X, Y)
557
557
558
558
unsafe_execute! (plan:: r2rFFTWPlan{T} ,
559
559
X:: StridedArray{T} , Y:: StridedArray{T} ) where {T<: fftwSingle } =
560
- ccall ((:fftwf_execute_r2r ,libfftw3f[] ), Cvoid,
560
+ ccall ((:fftwf_execute_r2r ,libfftw3f () ), Cvoid,
561
561
(PlanPtr,Ptr{T},Ptr{T}), plan, X, Y)
562
562
563
563
# NOTE ON GC (garbage collection):
@@ -654,7 +654,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:(Complex{Float64}),"fftw",:libfftw3),
654
654
unsafe_set_timelimit ($ Tr, timelimit)
655
655
R = isa (region, Tuple) ? region : copy (region)
656
656
dims, howmany = dims_howmany (X, Y, size (X), R)
657
- plan = ccall (($ (string (fftw," _plan_guru64_dft" )),$ lib[] ),
657
+ plan = ccall (($ (string (fftw," _plan_guru64_dft" )),$ lib () ),
658
658
PlanPtr,
659
659
(Int32, Ptr{Int}, Int32, Ptr{Int},
660
660
Ptr{$ Tc}, Ptr{$ Tc}, Int32, UInt32),
@@ -674,7 +674,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:(Complex{Float64}),"fftw",:libfftw3),
674
674
regionshft = _circshiftmin1 (region) # FFTW halves last dim
675
675
unsafe_set_timelimit ($ Tr, timelimit)
676
676
dims, howmany = dims_howmany (X, Y, size (X), regionshft)
677
- plan = ccall (($ (string (fftw," _plan_guru64_dft_r2c" )),$ lib[] ),
677
+ plan = ccall (($ (string (fftw," _plan_guru64_dft_r2c" )),$ lib () ),
678
678
PlanPtr,
679
679
(Int32, Ptr{Int}, Int32, Ptr{Int},
680
680
Ptr{$ Tr}, Ptr{$ Tc}, UInt32),
@@ -694,7 +694,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:(Complex{Float64}),"fftw",:libfftw3),
694
694
regionshft = _circshiftmin1 (region) # FFTW halves last dim
695
695
unsafe_set_timelimit ($ Tr, timelimit)
696
696
dims, howmany = dims_howmany (X, Y, size (Y), regionshft)
697
- plan = ccall (($ (string (fftw," _plan_guru64_dft_c2r" )),$ lib[] ),
697
+ plan = ccall (($ (string (fftw," _plan_guru64_dft_c2r" )),$ lib () ),
698
698
PlanPtr,
699
699
(Int32, Ptr{Int}, Int32, Ptr{Int},
700
700
Ptr{$ Tc}, Ptr{$ Tr}, UInt32),
@@ -716,7 +716,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:(Complex{Float64}),"fftw",:libfftw3),
716
716
knd = fix_kinds (region, kinds)
717
717
unsafe_set_timelimit ($ Tr, timelimit)
718
718
dims, howmany = dims_howmany (X, Y, size (X), region)
719
- plan = ccall (($ (string (fftw," _plan_guru64_r2r" )),$ lib[] ),
719
+ plan = ccall (($ (string (fftw," _plan_guru64_r2r" )),$ lib () ),
720
720
PlanPtr,
721
721
(Int32, Ptr{Int}, Int32, Ptr{Int},
722
722
Ptr{$ Tr}, Ptr{$ Tr}, Ptr{Int32}, UInt32),
@@ -744,7 +744,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:(Complex{Float64}),"fftw",:libfftw3),
744
744
howmany[2 : 3 , :] .*= 2
745
745
end
746
746
howmany = [howmany [2 ,1 ,1 ]] # append loop over real/imag parts
747
- plan = ccall (($ (string (fftw," _plan_guru64_r2r" )),$ lib[] ),
747
+ plan = ccall (($ (string (fftw," _plan_guru64_r2r" )),$ lib () ),
748
748
PlanPtr,
749
749
(Int32, Ptr{Int}, Int32, Ptr{Int},
750
750
Ptr{$ Tc}, Ptr{$ Tc}, Ptr{Int32}, UInt32),
0 commit comments