@@ -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,39 +141,39 @@ 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
173
173
174
174
@exclusive function set_num_threads (nthreads:: Integer )
175
- ccall ((:fftw_plan_with_nthreads ,libfftw3), Cvoid, (Int32,), nthreads)
176
- ccall ((:fftwf_plan_with_nthreads ,libfftw3f), Cvoid, (Int32,), nthreads)
175
+ ccall ((:fftw_plan_with_nthreads ,libfftw3[] ), Cvoid, (Int32,), nthreads)
176
+ ccall ((:fftwf_plan_with_nthreads ,libfftw3f[] ), Cvoid, (Int32,), nthreads)
177
177
end
178
178
179
179
# pointer type for fftw_plan (opaque pointer)
@@ -187,9 +187,9 @@ const NO_TIMELIMIT = -1.0 # from fftw3.h
187
187
188
188
# only call these when fftwlock is held:
189
189
unsafe_set_timelimit (precision:: fftwTypeDouble ,seconds) =
190
- ccall ((:fftw_set_timelimit ,libfftw3), Cvoid, (Float64,), seconds)
190
+ ccall ((:fftw_set_timelimit ,libfftw3[] ), Cvoid, (Float64,), seconds)
191
191
unsafe_set_timelimit (precision:: fftwTypeSingle ,seconds) =
192
- ccall ((:fftwf_set_timelimit ,libfftw3f), Cvoid, (Float64,), seconds)
192
+ ccall ((:fftwf_set_timelimit ,libfftw3f[] ), Cvoid, (Float64,), seconds)
193
193
@exclusive set_timelimit (precision, seconds) = unsafe_set_timelimit (precision, seconds)
194
194
195
195
# Array alignment mod 16:
@@ -210,9 +210,9 @@ unsafe_set_timelimit(precision::fftwTypeSingle,seconds) =
210
210
convert (Int32, convert (Int64, pointer (A)) % 16 )
211
211
else
212
212
alignment_of (A:: StridedArray{T} ) where {T<: fftwDouble } =
213
- ccall ((:fftw_alignment_of , libfftw3), Int32, (Ptr{T},), A)
213
+ ccall ((:fftw_alignment_of , libfftw3[] ), Int32, (Ptr{T},), A)
214
214
alignment_of (A:: StridedArray{T} ) where {T<: fftwSingle } =
215
- ccall ((:fftwf_alignment_of , libfftw3f), Int32, (Ptr{T},), A)
215
+ ccall ((:fftwf_alignment_of , libfftw3f[] ), Int32, (Ptr{T},), A)
216
216
end
217
217
218
218
# FFTWPlan (low-level)
@@ -268,9 +268,9 @@ unsafe_convert(::Type{PlanPtr}, p::FFTWPlan) = p.plan
268
268
269
269
# these functions should only be called while the fftwlock is held
270
270
unsafe_destroy_plan (plan:: FFTWPlan{<:fftwDouble} ) =
271
- ccall ((:fftw_destroy_plan ,libfftw3), Cvoid, (PlanPtr,), plan)
271
+ ccall ((:fftw_destroy_plan ,libfftw3[] ), Cvoid, (PlanPtr,), plan)
272
272
unsafe_destroy_plan (plan:: FFTWPlan{<:fftwSingle} ) =
273
- ccall ((:fftwf_destroy_plan ,libfftw3f), Cvoid, (PlanPtr,), plan)
273
+ ccall ((:fftwf_destroy_plan ,libfftw3f[] ), Cvoid, (PlanPtr,), plan)
274
274
275
275
const deferred_destroy_lock = ReentrantLock () # lock protecting the deferred_destroy_plans list
276
276
const deferred_destroy_plans = FFTWPlan[]
@@ -331,19 +331,19 @@ end
331
331
# ################################################################################################
332
332
333
333
cost (plan:: FFTWPlan{<:fftwDouble} ) =
334
- ccall ((:fftw_cost ,libfftw3), Float64, (PlanPtr,), plan)
334
+ ccall ((:fftw_cost ,libfftw3[] ), Float64, (PlanPtr,), plan)
335
335
cost (plan:: FFTWPlan{<:fftwSingle} ) =
336
- ccall ((:fftwf_cost ,libfftw3f), Float64, (PlanPtr,), plan)
336
+ ccall ((:fftwf_cost ,libfftw3f[] ), Float64, (PlanPtr,), plan)
337
337
338
338
@exclusive function arithmetic_ops (plan:: FFTWPlan{<:fftwDouble} )
339
339
add, mul, fma = Ref (0.0 ), Ref (0.0 ), Ref (0.0 )
340
- ccall ((:fftw_flops ,libfftw3), Cvoid,
340
+ ccall ((:fftw_flops ,libfftw3[] ), Cvoid,
341
341
(PlanPtr,Ref{Float64},Ref{Float64},Ref{Float64}), plan, add, mul, fma)
342
342
return (round (Int64, add[]), round (Int64, mul[]), round (Int64, fma[]))
343
343
end
344
344
@exclusive function arithmetic_ops (plan:: FFTWPlan{<:fftwSingle} )
345
345
add, mul, fma = Ref (0.0 ), Ref (0.0 ), Ref (0.0 )
346
- ccall ((:fftwf_flops ,libfftw3f), Cvoid,
346
+ ccall ((:fftwf_flops ,libfftw3f[] ), Cvoid,
347
347
(PlanPtr,Ref{Float64},Ref{Float64},Ref{Float64}), plan, add, mul, fma)
348
348
return (round (Int64, add[]), round (Int64, mul[]), round (Int64, fma[]))
349
349
end
@@ -374,9 +374,9 @@ const has_sprint_plan = version >= v"3.3.4" && fftw_provider == "fftw"
374
374
375
375
@static if has_sprint_plan
376
376
sprint_plan_ (plan:: FFTWPlan{<:fftwDouble} ) =
377
- ccall ((:fftw_sprint_plan ,libfftw3), Ptr{UInt8}, (PlanPtr,), plan)
377
+ ccall ((:fftw_sprint_plan ,libfftw3[] ), Ptr{UInt8}, (PlanPtr,), plan)
378
378
sprint_plan_ (plan:: FFTWPlan{<:fftwSingle} ) =
379
- ccall ((:fftwf_sprint_plan ,libfftw3f), Ptr{UInt8}, (PlanPtr,), plan)
379
+ ccall ((:fftwf_sprint_plan ,libfftw3f[] ), Ptr{UInt8}, (PlanPtr,), plan)
380
380
function sprint_plan (plan:: FFTWPlan )
381
381
p = sprint_plan_ (plan)
382
382
str = unsafe_string (p)
@@ -457,49 +457,49 @@ _colmajorstrides(p) = ()
457
457
# Execute
458
458
459
459
unsafe_execute! (plan:: FFTWPlan{<:fftwDouble} ) =
460
- ccall ((:fftw_execute ,libfftw3), Cvoid, (PlanPtr,), plan)
460
+ ccall ((:fftw_execute ,libfftw3[] ), Cvoid, (PlanPtr,), plan)
461
461
462
462
unsafe_execute! (plan:: FFTWPlan{<:fftwSingle} ) =
463
- ccall ((:fftwf_execute ,libfftw3f), Cvoid, (PlanPtr,), plan)
463
+ ccall ((:fftwf_execute ,libfftw3f[] ), Cvoid, (PlanPtr,), plan)
464
464
465
465
unsafe_execute! (plan:: cFFTWPlan{T} ,
466
466
X:: StridedArray{T} , Y:: StridedArray{T} ) where {T<: fftwDouble } =
467
- ccall ((:fftw_execute_dft ,libfftw3), Cvoid,
467
+ ccall ((:fftw_execute_dft ,libfftw3[] ), Cvoid,
468
468
(PlanPtr,Ptr{T},Ptr{T}), plan, X, Y)
469
469
470
470
unsafe_execute! (plan:: cFFTWPlan{T} ,
471
471
X:: StridedArray{T} , Y:: StridedArray{T} ) where {T<: fftwSingle } =
472
- ccall ((:fftwf_execute_dft ,libfftw3f), Cvoid,
472
+ ccall ((:fftwf_execute_dft ,libfftw3f[] ), Cvoid,
473
473
(PlanPtr,Ptr{T},Ptr{T}), plan, X, Y)
474
474
475
475
unsafe_execute! (plan:: rFFTWPlan{Float64,FORWARD} ,
476
476
X:: StridedArray{Float64} , Y:: StridedArray{Complex{Float64}} ) =
477
- ccall ((:fftw_execute_dft_r2c ,libfftw3), Cvoid,
477
+ ccall ((:fftw_execute_dft_r2c ,libfftw3[] ), Cvoid,
478
478
(PlanPtr,Ptr{Float64},Ptr{Complex{Float64}}), plan, X, Y)
479
479
480
480
unsafe_execute! (plan:: rFFTWPlan{Float32,FORWARD} ,
481
481
X:: StridedArray{Float32} , Y:: StridedArray{Complex{Float32}} ) =
482
- ccall ((:fftwf_execute_dft_r2c ,libfftw3f), Cvoid,
482
+ ccall ((:fftwf_execute_dft_r2c ,libfftw3f[] ), Cvoid,
483
483
(PlanPtr,Ptr{Float32},Ptr{Complex{Float32}}), plan, X, Y)
484
484
485
485
unsafe_execute! (plan:: rFFTWPlan{Complex{Float64},BACKWARD} ,
486
486
X:: StridedArray{Complex{Float64}} , Y:: StridedArray{Float64} ) =
487
- ccall ((:fftw_execute_dft_c2r ,libfftw3), Cvoid,
487
+ ccall ((:fftw_execute_dft_c2r ,libfftw3[] ), Cvoid,
488
488
(PlanPtr,Ptr{Complex{Float64}},Ptr{Float64}), plan, X, Y)
489
489
490
490
unsafe_execute! (plan:: rFFTWPlan{Complex{Float32},BACKWARD} ,
491
491
X:: StridedArray{Complex{Float32}} , Y:: StridedArray{Float32} ) =
492
- ccall ((:fftwf_execute_dft_c2r ,libfftw3f), Cvoid,
492
+ ccall ((:fftwf_execute_dft_c2r ,libfftw3f[] ), Cvoid,
493
493
(PlanPtr,Ptr{Complex{Float32}},Ptr{Float32}), plan, X, Y)
494
494
495
495
unsafe_execute! (plan:: r2rFFTWPlan{T} ,
496
496
X:: StridedArray{T} , Y:: StridedArray{T} ) where {T<: fftwDouble } =
497
- ccall ((:fftw_execute_r2r ,libfftw3), Cvoid,
497
+ ccall ((:fftw_execute_r2r ,libfftw3[] ), Cvoid,
498
498
(PlanPtr,Ptr{T},Ptr{T}), plan, X, Y)
499
499
500
500
unsafe_execute! (plan:: r2rFFTWPlan{T} ,
501
501
X:: StridedArray{T} , Y:: StridedArray{T} ) where {T<: fftwSingle } =
502
- ccall ((:fftwf_execute_r2r ,libfftw3f), Cvoid,
502
+ ccall ((:fftwf_execute_r2r ,libfftw3f[] ), Cvoid,
503
503
(PlanPtr,Ptr{T},Ptr{T}), plan, X, Y)
504
504
505
505
# NOTE ON GC (garbage collection):
@@ -565,7 +565,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:(Complex{Float64}),"fftw",:libfftw3),
565
565
unsafe_set_timelimit ($ Tr, timelimit)
566
566
R = isa (region, Tuple) ? region : copy (region)
567
567
dims, howmany = dims_howmany (X, Y, [size (X)... ], R)
568
- plan = ccall (($ (string (fftw," _plan_guru64_dft" )),$ lib),
568
+ plan = ccall (($ (string (fftw," _plan_guru64_dft" )),$ lib[] ),
569
569
PlanPtr,
570
570
(Int32, Ptr{Int}, Int32, Ptr{Int},
571
571
Ptr{$ Tc}, Ptr{$ Tc}, Int32, UInt32),
@@ -585,7 +585,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:(Complex{Float64}),"fftw",:libfftw3),
585
585
region = circshift (Int[region... ],- 1 ) # FFTW halves last dim
586
586
unsafe_set_timelimit ($ Tr, timelimit)
587
587
dims, howmany = dims_howmany (X, Y, [size (X)... ], region)
588
- plan = ccall (($ (string (fftw," _plan_guru64_dft_r2c" )),$ lib),
588
+ plan = ccall (($ (string (fftw," _plan_guru64_dft_r2c" )),$ lib[] ),
589
589
PlanPtr,
590
590
(Int32, Ptr{Int}, Int32, Ptr{Int},
591
591
Ptr{$ Tr}, Ptr{$ Tc}, UInt32),
@@ -605,7 +605,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:(Complex{Float64}),"fftw",:libfftw3),
605
605
region = circshift (Int[region... ],- 1 ) # FFTW halves last dim
606
606
unsafe_set_timelimit ($ Tr, timelimit)
607
607
dims, howmany = dims_howmany (X, Y, [size (Y)... ], region)
608
- plan = ccall (($ (string (fftw," _plan_guru64_dft_c2r" )),$ lib),
608
+ plan = ccall (($ (string (fftw," _plan_guru64_dft_c2r" )),$ lib[] ),
609
609
PlanPtr,
610
610
(Int32, Ptr{Int}, Int32, Ptr{Int},
611
611
Ptr{$ Tc}, Ptr{$ Tr}, UInt32),
@@ -626,7 +626,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:(Complex{Float64}),"fftw",:libfftw3),
626
626
knd = fix_kinds (region, kinds)
627
627
unsafe_set_timelimit ($ Tr, timelimit)
628
628
dims, howmany = dims_howmany (X, Y, [size (X)... ], region)
629
- plan = ccall (($ (string (fftw," _plan_guru64_r2r" )),$ lib),
629
+ plan = ccall (($ (string (fftw," _plan_guru64_r2r" )),$ lib[] ),
630
630
PlanPtr,
631
631
(Int32, Ptr{Int}, Int32, Ptr{Int},
632
632
Ptr{$ Tr}, Ptr{$ Tr}, Ptr{Int32}, UInt32),
@@ -651,7 +651,7 @@ for (Tr,Tc,fftw,lib) in ((:Float64,:(Complex{Float64}),"fftw",:libfftw3),
651
651
dims[2 : 3 , 1 : size (dims,2 )] *= 2
652
652
howmany[2 : 3 , 1 : size (howmany,2 )] *= 2
653
653
howmany = [howmany [2 ,1 ,1 ]] # append loop over real/imag parts
654
- plan = ccall (($ (string (fftw," _plan_guru64_r2r" )),$ lib),
654
+ plan = ccall (($ (string (fftw," _plan_guru64_r2r" )),$ lib[] ),
655
655
PlanPtr,
656
656
(Int32, Ptr{Int}, Int32, Ptr{Int},
657
657
Ptr{$ Tc}, Ptr{$ Tc}, Ptr{Int32}, UInt32),
0 commit comments