I guess the docs are clear but for some reason I didn't understand it
correctly after reading it a couple of times. Probably because I think of d
as in Array{Float, d} rather than length. Should have looked more
carefully. Sorry for the noise.
d is the length of the transformed real array along the dims[1] dimension,
which must satisfy d == floor(size(A,dims[1])/2)+1. (This parameter cannot
be inferred fromsize(A) due to the possibility of rounding by the floor
function
here.)
On Wednesday, June 18, 2014 11:54:33 PM UTC-7, Ethan Anderes wrote:
>
> That does it! I never would have guessed that dims would refer to the side
> length of the matrix. Thanks a ton.
>
> On Wednesday, June 18, 2014 11:47:47 PM UTC-7, Alex wrote:
>>
>> Hi Ethan,
>>
>> irfft and brfft take an additional argument d, which roughly speaking
>> denotes the size of the transformed matrix. See also the docs on brfft
>> and irfft
>> <http://julia.readthedocs.org/en/latest/stdlib/base/?highlight=brfft#Base.brfft>
>>
>> The following should work for you
>> julia> a = rand(64, 64);
>>
>> julia> a_from_rfft = rfft(a);
>>
>> julia> back_to_a = irfft(a_from_rfft, size(a,1));
>>
>> julia> norm(back_to_a-a)
>> 5.185263941656865e-15
>>
>> Hope that helps,
>>
>> Alex.
>>
>> On Thursday, 19 June 2014 06:37:38 UTC+2, Ethan Anderes wrote:
>>>
>>> Does anyone have experience with brfft or irfft? I’m trying to optimize
>>> some code and I noticed a huge performance gain if I use rfft over fft for
>>> 2-d real matrices. However
>>> I need to filter in the Fourier domain, then use irfft (or brfft) to
>>> return to spatial corridinates but I can’t seem to get irfft or brfft to
>>> work.
>>>
>>> a = rand(1024, 1024);
>>>
>>> a_from_fft = fft(a);
>>> a_from_rfft = rfft(a);
>>>
>>> ### each one of these gives an error
>>> back_to_a = brfft(a_from_fft);
>>> back_to_a = brfft(a_from_rfft);
>>> back_to_a = irfft(a_from_fft);
>>> back_to_a = irfft(a_from_rfft);
>>>
>>> Here is my version info
>>>
>>> julia> versioninfo()
>>>
>>> Julia Version 0.3.0-prerelease+3730
>>> Commit 8f1fbec (2014-06-17 23:55 UTC)
>>> Platform Info:
>>> System: Darwin (x86_64-apple-darwin13.2.0)
>>> CPU: Intel(R) Core(TM) i5-4250U CPU @ 1.30GHz
>>> WORD_SIZE: 64
>>> BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY)
>>> LAPACK: libopenblas
>>> LIBM: libopenlibm
>>>
>>>
>>>
>>