Hi Juan,

You would also need to change Complex64 to Complex128.

-Simon

On Sunday, 14 June 2015 22:25:21 UTC+1, Juan Carlos Cuevas Bautista wrote:
>
> Hi Everybody,
>
> I am new in Julia Programming. I have been following this post to optimize
> my code of time series in which I have big heavy files of data. I changed 
> the line
> float32([1:38192]) by float64([1:38192]) but the script does not work,
> I know this is related with this method 
>
> Base.FFTW.Plan(ri, ro, 1, Base.FFTW.PATIENT, Base.FFTW.NO_TIMELIMIT),
>
> I was wondering if this just work for float32 arrays? In case to be 
> positive
> could anyone recommend me another way to optimize the fft routine?
>
> Thank you so much and I like so much Julia.
>
>
> On Monday, November 4, 2013 at 6:50:14 PM UTC-5, SYoon wrote:
>>
>> I am trying to optimize FFT performance following the suggestion in the 
>> discussion 
>> <https://groups.google.com/forum/?fromgroups=#!searchin/julia-users/fft/julia-users/JsI2i80f-uU/YofekNinMH0J>
>>  .
>> I have the following testing function:
>>
>> function test()
>>     a = float32([1:38192])
>>     b = Array(Complex64, length(a))
>>
>>     tic()
>>     for i = 1:100
>>         b = fft(a)
>>     end
>>     toc();
>> end
>>
>>
>> This takes about 0.146 seconds (Matlab takes about 0.06 seconds)
>>
>>
>> Now, I have implemented three helper functions:
>>
>>
>> function get_fft_plan(ri)
>>     ro = Array(Complex64, length(ri)>>1 + 1)
>>     r2c = Base.FFTW.Plan(ri, ro, 1, Base.FFTW.PATIENT, Base.FFTW.
>> NO_TIMELIMIT)
>>     return ro, r2c
>> end
>>  
>> function execute_fft_plan(ri, ro, r2c, symmetry)
>>     Base.FFTW.execute(r2c.plan, ri, ro)
>>
>>     if ~(symmetry)
>>         return ro
>>     else symmetry
>>         roo = make_fft_symmetry(ro)
>>         return roo
>>     end
>> end
>>
>> function make_fft_symmetry(ro)
>>     len = 2*(length(ro) - 1)
>>     roo = Array(Complex64, len)
>>     roo[1] = ro[1]
>>  
>>     for i = 2:len/2+1
>>         roo[i] = conj(ro[i])
>>         roo[end-i+2] = ro[i]
>>     end
>>     return roo
>> end
>>
>>
>> Now, my updated test function looks like
>>
>>
>> function test()
>>     a = float32([1:38192])
>>     b = Array(Complex64, length(a))
>>     ro, r2c = get_fft_plan(a)
>>
>>     tic()
>>     for i = 1:100
>>         b = execute_fft_plan(a, ro, r2c, true)
>>     end
>>     toc();
>> end
>>
>> This takes about 0.074 seconds. When I change "true" to "false", it takes 
>> about 0.053 seconds. So, it takes about 0.02 seconds longer to make the FFT 
>> output array full length. Can somebody suggest a better way to implement 
>> the function "make_fft_symmetry" so that 0.074 seconds becomes closer to 
>> Matlab performance (0.06 seconds) or better?
>>
>> Thanks.
>>
>

Reply via email to