|
From: Andrew J. <a.h...@gm...> - 2006-01-25 09:56:51
|
If I start with what I thought was an appropriate (n, n/2+1) complex
matrix which should have a real inverse fft, and then take its real fft,
I don't get back the original matrix.
Note the presence of very small but nonzero reals in the final matrix,
and the fact that the 2d and 4th rows are duplicates. This seems to be a
mistake somewhere.
Or am I just misunderstanding/misremembering something about 2d real ffts?
Andrew
In [41]: dims=(4,4)
In [42]: delta_k = aniso.dft_realizn(dims, P)
#### this just makes an appropriate matrix
In [43]: delta_k
Out[43]:
array([[-0. +0.j , 0.5904+0.0429j, 0.9063+0.j ],
[-0.221 +0.j , 0.4169+0.4602j, -0.6909+0.j ],
[ 0.9059+0.j , -0.8037+0.2604j, 1.835 +0.j ],
[ 1.7436+0.j , -0.2382+0.221j , -0.0607+0.j ]])
#### 16 real numbers
In [44]: delta_r = N.dft.inverse_real_fft2d(delta_k)
In [45]: delta_r
Out[45]:
array([[ 0.2718, -0.0956, 0.2805, 0.1505],
[ 0.0297, -0.0533, -0.259 , 0.0561],
[ 0.1308, -0.2096, 0.2288, -0.3041],
[ 0.0895, 0.1105, -0.3188, -0.1076]])
In [46]: delta_kp = N.dft.real_fft2d(delta_r)
In [47]: delta_kp
Out[47]:
array([[ 0. +0.00e+00j, 0.5904 +4.2938e-02j, 0.9063 +0.0000e+00j],
[ 0.7613 +5.5511e-17j,0.4169 +4.6020e-01j, -0.3758 +5.5511e-17j],
[ 0.9059 +0.0000e+00j,-0.8037+2.6038e-01j, 1.835 +0.0000e+00j],
[ 0.7613 -5.5511e-17j,-0.2382+2.2099e-01j,-0.3758-5.5511e-17j]])
In [48]: N.__version__
Out[48]: '0.9.5.1982'
------------------------
|
|
From: Andrew J. <a.h...@gm...> - 2006-01-25 10:04:22
|
Andrew Jaffe wrote: > If I start with what I thought was an appropriate (n, n/2+1) complex > matrix which should have a real inverse fft, and then take its real fft, > I don't get back the original matrix. > > Note the presence of very small but nonzero reals in the final matrix, > and the fact that the 2d and 4th rows are duplicates. This seems to be a > mistake somewhere. > > Or am I just misunderstanding/misremembering something about 2d real ffts? and I should point out that delta_rp = N.dft.real_fft2d(delta_kp) is 'allclose' to the original delta_r (which leads me to believe that I may indeed be misunderstanding something). Andrew > > Andrew > > > In [41]: dims=(4,4) > > In [42]: delta_k = aniso.dft_realizn(dims, P) > #### this just makes an appropriate matrix > > In [43]: delta_k > Out[43]: > array([[-0. +0.j , 0.5904+0.0429j, 0.9063+0.j ], > [-0.221 +0.j , 0.4169+0.4602j, -0.6909+0.j ], > [ 0.9059+0.j , -0.8037+0.2604j, 1.835 +0.j ], > [ 1.7436+0.j , -0.2382+0.221j , -0.0607+0.j ]]) > #### 16 real numbers > > In [44]: delta_r = N.dft.inverse_real_fft2d(delta_k) > > In [45]: delta_r > Out[45]: > array([[ 0.2718, -0.0956, 0.2805, 0.1505], > [ 0.0297, -0.0533, -0.259 , 0.0561], > [ 0.1308, -0.2096, 0.2288, -0.3041], > [ 0.0895, 0.1105, -0.3188, -0.1076]]) > > In [46]: delta_kp = N.dft.real_fft2d(delta_r) > > In [47]: delta_kp > Out[47]: > array([[ 0. +0.00e+00j, 0.5904 +4.2938e-02j, 0.9063 +0.0000e+00j], > [ 0.7613 +5.5511e-17j,0.4169 +4.6020e-01j, -0.3758 +5.5511e-17j], > [ 0.9059 +0.0000e+00j,-0.8037+2.6038e-01j, 1.835 +0.0000e+00j], > [ 0.7613 -5.5511e-17j,-0.2382+2.2099e-01j,-0.3758-5.5511e-17j]]) > > In [48]: N.__version__ > Out[48]: '0.9.5.1982' > ------------------------ |
|
From: Warren F. <fo...@sl...> - 2006-01-27 02:35:35
|
On Wed, 25 Jan 2006, Andrew Jaffe wrote: > Andrew Jaffe wrote: > > If I start with what I thought was an appropriate (n, n/2+1) complex > > matrix which should have a real inverse fft, and then take its real fft, > > I don't get back the original matrix. > > > > Note the presence of very small but nonzero reals in the final matrix, That's just roundoff. > > and the fact that the 2d and 4th rows are duplicates. This seems to be a > > mistake somewhere. > > > > Or am I just misunderstanding/misremembering something about 2d real ffts? It looks wrong to me, and I think I wrote those functions. I get the same results in Numeric. I'll try to look into the problem. > and I should point out that > delta_rp = N.dft.real_fft2d(delta_kp) > is 'allclose' to the original delta_r (which leads me to believe that I > may indeed be misunderstanding something). "Stable" does not neccessarily imply "correct". w > > Andrew > > > > > > Andrew > > > > > > In [41]: dims=(4,4) > > > > In [42]: delta_k = aniso.dft_realizn(dims, P) > > #### this just makes an appropriate matrix > > > > In [43]: delta_k > > Out[43]: > > array([[-0. +0.j , 0.5904+0.0429j, 0.9063+0.j ], > > [-0.221 +0.j , 0.4169+0.4602j, -0.6909+0.j ], > > [ 0.9059+0.j , -0.8037+0.2604j, 1.835 +0.j ], > > [ 1.7436+0.j , -0.2382+0.221j , -0.0607+0.j ]]) > > #### 16 real numbers > > > > In [44]: delta_r = N.dft.inverse_real_fft2d(delta_k) > > > > In [45]: delta_r > > Out[45]: > > array([[ 0.2718, -0.0956, 0.2805, 0.1505], > > [ 0.0297, -0.0533, -0.259 , 0.0561], > > [ 0.1308, -0.2096, 0.2288, -0.3041], > > [ 0.0895, 0.1105, -0.3188, -0.1076]]) > > > > In [46]: delta_kp = N.dft.real_fft2d(delta_r) > > > > In [47]: delta_kp > > Out[47]: > > array([[ 0. +0.00e+00j, 0.5904 +4.2938e-02j, 0.9063 +0.0000e+00j], > > [ 0.7613 +5.5511e-17j,0.4169 +4.6020e-01j, -0.3758 +5.5511e-17j], > > [ 0.9059 +0.0000e+00j,-0.8037+2.6038e-01j, 1.835 +0.0000e+00j], > > [ 0.7613 -5.5511e-17j,-0.2382+2.2099e-01j,-0.3758-5.5511e-17j]]) > > > > In [48]: N.__version__ > > Out[48]: '0.9.5.1982' > > ------------------------ > > > > ------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. Do you grep through log files > for problems? Stop! Download the new AJAX search engine that makes > searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion > |
|
From: Andrew J. <a.h...@gm...> - 2006-01-27 08:07:52
|
Dear Warren, > > On Wed, 25 Jan 2006, Andrew Jaffe wrote: > >> Andrew Jaffe wrote: >>> If I start with what I thought was an appropriate (n, n/2+1) complex >>> matrix which should have a real inverse fft, and then take its real fft, >>> I don't get back the original matrix. >>> >>> Note the presence of very small but nonzero reals in the final matrix, > > That's just roundoff. > >>> and the fact that the 2d and 4th rows are duplicates. This seems to be a >>> mistake somewhere. >>> >>> Or am I just misunderstanding/misremembering something about 2d real ffts? > > It looks wrong to me, and I think I wrote those functions. I get the same > results in Numeric. I'll try to look into the problem. > >> and I should point out that >> delta_rp = N.dft.real_fft2d(delta_kp) >> is 'allclose' to the original delta_r (which leads me to believe that I >> may indeed be misunderstanding something). > > "Stable" does not neccessarily imply "correct". Indeed! And more to the point, it's actually the case that "delta_kp" doesn't actually have the requisite 16 (non-small) real degrees of freedom -- so it can't really be right. Andrew |
|
From: Andrew J. <a.h...@gm...> - 2006-01-27 08:10:17
|
> On Wed, 25 Jan 2006, Andrew Jaffe wrote: > >> Andrew Jaffe wrote: >>> If I start with what I thought was an appropriate (n, n/2+1) complex >>> matrix which should have a real inverse fft, and then take its real fft, >>> I don't get back the original matrix. >>> >>> Note the presence of very small but nonzero reals in the final matrix, > > That's just roundoff. > >>> and the fact that the 2d and 4th rows are duplicates. This seems to be a >>> mistake somewhere. >>> >>> Or am I just misunderstanding/misremembering something about 2d real ffts? > > It looks wrong to me, and I think I wrote those functions. I get the same > results in Numeric. I'll try to look into the problem. > >> and I should point out that >> delta_rp = N.dft.real_fft2d(delta_kp) >> is 'allclose' to the original delta_r (which leads me to believe that I >> may indeed be misunderstanding something). > > "Stable" does not neccessarily imply "correct". Indeed! And more to the point, it's actually the case that "delta_kp" doesn't actually have the requisite 16 (non-small) real degrees of freedom -- so it can't really be right. Andrew |