Skip to content

Commit c13a9a2

Browse files
authoredJul 19, 2024··
Merge pull request #111 from IntelPython/fix-gh-109
Fix gh-109
2 parents 6335c59 + abffaec commit c13a9a2

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed
 

Diff for: ‎.github/workflows/conda-package.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: conda install conda-build
4242
- name: Build conda package
4343
run: |
44-
CHANNELS="-c conda-forge -c intel --override-channels"
44+
CHANNELS="-c conda-forge -c https://software.repos.intel.com/python/conda --override-channels"
4545
VERSIONS="--python ${{ matrix.python }}"
4646
TEST="--no-test"
4747
@@ -67,7 +67,7 @@ jobs:
6767
runner: [ubuntu-latest]
6868
continue-on-error: ${{ matrix.experimental }}
6969
env:
70-
CHANNELS: -c intel -c main --override-channels
70+
CHANNELS: -c https://software.repos.intel.com/python/conda -c main --override-channels
7171

7272
steps:
7373
- name: Download artifact
@@ -150,7 +150,7 @@ jobs:
150150
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
151151
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
152152
- name: Build conda package
153-
run: conda build --no-test --python ${{ matrix.python }} -c intel -c conda-forge --override-channels conda-recipe
153+
run: conda build --no-test --python ${{ matrix.python }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
154154
- name: Upload artifact
155155
uses: actions/upload-artifact@v4
156156
with:
@@ -171,7 +171,7 @@ jobs:
171171
continue-on-error: ${{ matrix.experimental }}
172172
env:
173173
workdir: '${{ github.workspace }}'
174-
CHANNELS: -c intel -c conda-forge --override-channels
174+
CHANNELS: -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels
175175

176176
steps:
177177
- name: Download artifact

Diff for: ‎mkl_fft/_pydfti.pyx

+4-4
Original file line numberDiff line numberDiff line change
@@ -901,12 +901,12 @@ def _cook_nd_args(a, s=None, axes=None, invreal=0):
901901
return s, axes
902902

903903

904-
def _iter_fftnd(a, s=None, axes=None, function=fft, overwrite_arg=False, scale_function=lambda n: 1.0):
904+
def _iter_fftnd(a, s=None, axes=None, function=fft, overwrite_arg=False, scale_function=lambda n, ind: 1.0):
905905
a = np.asarray(a)
906906
s, axes = _init_nd_shape_and_axes(a, s, axes)
907907
ovwr = overwrite_arg
908908
for ii in reversed(range(len(axes))):
909-
a = function(a, n = s[ii], axis = axes[ii], overwrite_x=ovwr, forward_scale=scale_function(s[ii]))
909+
a = function(a, n = s[ii], axis = axes[ii], overwrite_x=ovwr, forward_scale=scale_function(s[ii], ii))
910910
ovwr = True
911911
return a
912912

@@ -1093,9 +1093,9 @@ def _fftnd_impl(x, shape=None, axes=None, overwrite_x=False, direction=+1, doubl
10931093
res
10941094
)
10951095
else:
1096-
sc = (<object> fsc)**(1/x.ndim)
1096+
sc = <object> fsc
10971097
return _iter_fftnd(x, s=shape, axes=axes,
1098-
overwrite_arg=overwrite_x, scale_function=lambda n: sc,
1098+
overwrite_arg=overwrite_x, scale_function=lambda n, i: sc if i == 0 else 1.,
10991099
function=fft if direction == 1 else ifft)
11001100

11011101

Diff for: ‎mkl_fft/tests/test_fftnd.py

+11
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,14 @@ def test_scale_nd_axes(self):
217217

218218
r_tol, a_tol = _get_rtol_atol(X)
219219
assert_allclose(f, 5*f_scale, rtol=r_tol, atol=a_tol)
220+
221+
222+
def test_gh109():
223+
b_int = np.array([[5, 7, 6, 5], [4, 6, 4, 8], [9, 3, 7, 5]], dtype=np.int64)
224+
b = np.asarray(b_int, dtype=np.float32)
225+
226+
r1 = mkl_fft.fftn(b, shape=None, axes=(0,), overwrite_x=False, forward_scale=1/3)
227+
r2 = mkl_fft.fftn(b_int, shape=None, axes=(0,), overwrite_x=False, forward_scale=1/3)
228+
229+
rtol, atol = _get_rtol_atol(b)
230+
assert_allclose(r1, r2, rtol=rtol, atol=atol)

0 commit comments

Comments
 (0)
Please sign in to comment.