Skip to content

repeated indices in axes keyword for N-dimensional FFT are ignored #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vtavana opened this issue May 30, 2024 · 0 comments
Open

repeated indices in axes keyword for N-dimensional FFT are ignored #104

vtavana opened this issue May 30, 2024 · 0 comments

Comments

@vtavana
Copy link
Collaborator

vtavana commented May 30, 2024

Repeated indices in axes keyword are ignored while the transform over the repeated axis should be performed multiple times.
Result from stock NumPy

>>> import numpy, mkl_fft
>>> in_arr = [[5, 4, 6, 3, 7], [-1, -3, -4, -7, 0]]
>>> dtype = numpy.complex64
>>> a_np = numpy.array(in_arr, dtype=dtype)
>>> numpy.fft.fft2(a_np, axes=(0,1))   
# array([[10.       +0.j       ,  8.09017  +2.1796277j,
#        -3.09017  +9.23305j  , -3.09017  -9.23305j  ,
#         8.09017  -2.1796277j],
#       [40.       +0.j       , -5.854102 +0.j       ,
#         0.8541019+0.j       ,  0.8541019+0.j       ,
#        -5.854102 +0.j       ]], dtype=complex64)
		
>>> numpy.fft.fft2(a_np, axes=(0,1,1))
# array([[ 20.+0.j,  35.+0.j, -20.+0.j,  10.+0.j,   5.+0.j],
#       [ 30.+0.j,  35.+0.j,  50.+0.j,  50.+0.j,  35.+0.j]],
#      dtype=complex64)


>>> mkl_fft.fft2(a_np, axes=(0,1))   
# array([[10.        +0.j      ,  8.09017   +2.179628j,
#        -3.09017   +9.233051j, -3.09017   -9.233051j,
#         8.09017   -2.179628j],
#       [40.        +0.j      , -5.854102  +0.j      ,
#         0.85410213+0.j      ,  0.85410213+0.j      ,
#        -5.854102  +0.j      ]], dtype=complex64)

>>> mkl_fft.fft2(a_np, axes=(0,1,1)) # returns the same data as axes=(0,1)	 
# array([[10.        +0.j      ,  8.09017   +2.179628j,
#        -3.09017   +9.233051j, -3.09017   -9.233051j,
#         8.09017   -2.179628j],
#       [40.        +0.j      , -5.854102  +0.j      ,
#         0.85410213+0.j      ,  0.85410213+0.j      ,
#        -5.854102  +0.j      ]], dtype=complex64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant