Skip to content
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

result discrepancy of mkl_fft.irfftn integer data types and float data types #116

Open
vtavana opened this issue Aug 6, 2024 · 0 comments · May be fixed by #138
Open

result discrepancy of mkl_fft.irfftn integer data types and float data types #116

vtavana opened this issue Aug 6, 2024 · 0 comments · May be fixed by #138
Assignees

Comments

@vtavana
Copy link
Collaborator

vtavana commented Aug 6, 2024

For the following case, when input arrays data type is float, correct result is returned while for integer data type, result is incorrect.

import numpy, mkl_fft
from numpy.testing import assert_allclose

a_int = numpy.array([[[5, 7, 6, 5],
		  [4, 6, 4, 8],
		  [9, 3, 7, 5]],
		 [[5, 9, 0, 0],
		  [0, 8, 7, 8],
		  [9, 7, 4, 7]]], dtype=numpy.int32)			  
a = numpy.array(a_int, dtype=numpy.float32)		
	  
r1 = mkl_fft.irfftn(a, s=None, axes=None)
r2 = mkl_fft.irfftn(a_int, s=None, axes=None)

assert_allclose(r1, r2, atol=1e-6)
# AssertionError:
# Not equal to tolerance rtol=1e-07, atol=0

# Mismatched elements: 34 / 36 (94.4%)
# Max absolute difference among violations: 0.58333357
# Max relative difference among violations: 2.66666679
# ACTUAL: array([[[ 5.583334,  0.305556, -0.083333, -0.694444, -0.083333,
#         0.305556],
#       [-0.333333,  0.472222, -0.25    , -0.277778, -0.25    ,...
# DESIRED: array([[[ 5.      ,  0.333333,  0.      , -0.666667,  0.      ,
#          0.333333],
#        [-0.166667,  0.166667, -0.166667,  0.166667, -0.166667,...
@vtavana vtavana self-assigned this Mar 12, 2025
@vtavana vtavana changed the title result discrepancy of mkl_fft.irfftn_numpy integer data types and float data types result discrepancy of mkl_fft.irfftn integer data types and float data types Mar 14, 2025
@vtavana vtavana linked a pull request Mar 14, 2025 that will close this issue
@vtavana vtavana linked a pull request Mar 25, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant