From 51ce88aefd433186bf874f2ca53fd0d536bcc630 Mon Sep 17 00:00:00 2001 From: Clonkk Date: Wed, 3 Feb 2021 13:55:46 +0100 Subject: [PATCH 1/2] fixed bad mod axis --- src/fftw3/fftshift.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fftw3/fftshift.nim b/src/fftw3/fftshift.nim index 83b031c..bd3b349 100644 --- a/src/fftw3/fftshift.nim +++ b/src/fftw3/fftshift.nim @@ -50,8 +50,8 @@ proc circshift_impl[T](t: Tensor[T], xshift: int, yshift: int, zshift: int): Ten let coord = idx.get3DCoord(result) ii = (coord.I + xshift) mod X - jj = (coord.J + xshift) mod X - kk = (coord.K + xshift) mod X + jj = (coord.J + xshift) mod Y + kk = (coord.K + xshift) mod Z result[ii, jj, kk] = t[coord.I, coord.J, coord.K] proc circshift_impl[T](t: Tensor[T], xshift: int, yshift: int): Tensor[T] = @@ -64,7 +64,7 @@ proc circshift_impl[T](t: Tensor[T], xshift: int, yshift: int): Tensor[T] = let coord = idx.get2DCoord(result) ii = (coord.I + xshift) mod X - jj = (coord.J + xshift) mod X + jj = (coord.J + xshift) mod Y result[ii, jj] = t[coord.I, coord.J] proc circshift_impl[T](t: Tensor[T], xshift: int): Tensor[T] = From f8bc7b990a2554215df3b57ca338814bc170bee0 Mon Sep 17 00:00:00 2001 From: Clonkk Date: Wed, 3 Feb 2021 13:59:22 +0100 Subject: [PATCH 2/2] fix axis --- src/fftw3/fftshift.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fftw3/fftshift.nim b/src/fftw3/fftshift.nim index bd3b349..f33e577 100644 --- a/src/fftw3/fftshift.nim +++ b/src/fftw3/fftshift.nim @@ -50,8 +50,8 @@ proc circshift_impl[T](t: Tensor[T], xshift: int, yshift: int, zshift: int): Ten let coord = idx.get3DCoord(result) ii = (coord.I + xshift) mod X - jj = (coord.J + xshift) mod Y - kk = (coord.K + xshift) mod Z + jj = (coord.J + yshift) mod Y + kk = (coord.K + zshift) mod Z result[ii, jj, kk] = t[coord.I, coord.J, coord.K] proc circshift_impl[T](t: Tensor[T], xshift: int, yshift: int): Tensor[T] = @@ -64,7 +64,7 @@ proc circshift_impl[T](t: Tensor[T], xshift: int, yshift: int): Tensor[T] = let coord = idx.get2DCoord(result) ii = (coord.I + xshift) mod X - jj = (coord.J + xshift) mod Y + jj = (coord.J + yshift) mod Y result[ii, jj] = t[coord.I, coord.J] proc circshift_impl[T](t: Tensor[T], xshift: int): Tensor[T] =