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

Fix gh-109 #111

Merged
merged 4 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: conda install conda-build
- name: Build conda package
run: |
CHANNELS="-c conda-forge -c intel --override-channels"
CHANNELS="-c conda-forge -c https://software.repos.intel.com/python/conda --override-channels"
VERSIONS="--python ${{ matrix.python }}"
TEST="--no-test"

Expand All @@ -67,7 +67,7 @@ jobs:
runner: [ubuntu-latest]
continue-on-error: ${{ matrix.experimental }}
env:
CHANNELS: -c intel -c main --override-channels
CHANNELS: -c https://software.repos.intel.com/python/conda -c main --override-channels

steps:
- name: Download artifact
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-python-${{ matrix.python }}-
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-
- name: Build conda package
run: conda build --no-test --python ${{ matrix.python }} -c intel -c conda-forge --override-channels conda-recipe
run: conda build --no-test --python ${{ matrix.python }} -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels conda-recipe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -171,7 +171,7 @@ jobs:
continue-on-error: ${{ matrix.experimental }}
env:
workdir: '${{ github.workspace }}'
CHANNELS: -c intel -c conda-forge --override-channels
CHANNELS: -c https://software.repos.intel.com/python/conda -c conda-forge --override-channels

steps:
- name: Download artifact
Expand Down
8 changes: 4 additions & 4 deletions mkl_fft/_pydfti.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -901,12 +901,12 @@ def _cook_nd_args(a, s=None, axes=None, invreal=0):
return s, axes


def _iter_fftnd(a, s=None, axes=None, function=fft, overwrite_arg=False, scale_function=lambda n: 1.0):
def _iter_fftnd(a, s=None, axes=None, function=fft, overwrite_arg=False, scale_function=lambda n, ind: 1.0):
a = np.asarray(a)
s, axes = _init_nd_shape_and_axes(a, s, axes)
ovwr = overwrite_arg
for ii in reversed(range(len(axes))):
a = function(a, n = s[ii], axis = axes[ii], overwrite_x=ovwr, forward_scale=scale_function(s[ii]))
a = function(a, n = s[ii], axis = axes[ii], overwrite_x=ovwr, forward_scale=scale_function(s[ii], ii))
ovwr = True
return a

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


Expand Down
11 changes: 11 additions & 0 deletions mkl_fft/tests/test_fftnd.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,14 @@ def test_scale_nd_axes(self):

r_tol, a_tol = _get_rtol_atol(X)
assert_allclose(f, 5*f_scale, rtol=r_tol, atol=a_tol)


def test_gh109():
b_int = np.array([[5, 7, 6, 5], [4, 6, 4, 8], [9, 3, 7, 5]], dtype=np.int64)
b = np.asarray(b_int, dtype=np.float32)

r1 = mkl_fft.fftn(b, shape=None, axes=(0,), overwrite_x=False, forward_scale=1/3)
r2 = mkl_fft.fftn(b_int, shape=None, axes=(0,), overwrite_x=False, forward_scale=1/3)

rtol, atol = _get_rtol_atol(b)
assert_allclose(r1, r2, rtol=rtol, atol=atol)
Loading