Skip to content

Commit

Permalink
minor: fix flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
mrava87 committed Dec 9, 2024
1 parent 94abe4c commit 02cfddd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions pylops/signalprocessing/_fourierradon2d_cuda.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from cmath import exp
from math import pi

import cupy as cp
from numba import cuda

TWO_PI_MINUS = cp.float32(-2.0 * pi)
TWO_PI_PLUS = cp.float32(2.0 * pi)
I = cp.complex64(1j)
IMG = cp.complex64(1j)


@cuda.jit
Expand All @@ -25,7 +24,7 @@ def _radon_inner_2d_kernel(x, y, f, px, h, flim0, flim1, npx, nh):
# y[ih, ifr] += x[ipx, ifr] * exp(TWO_PI_MINUS * f[ifr] * px[ipx] * h[ih])
# fast computation of exp(1j * x) - see https://stackoverflow.com/questions/9860711/cucomplex-h-and-exp/9863048#9863048
s, c = cuda.libdevice.sincosf(TWO_PI_MINUS * f[ifr] * px[ipx] * h[ih])
y[ih, ifr] += x[ipx, ifr] * (c + I * s)
y[ih, ifr] += x[ipx, ifr] * (c + IMG * s)


@cuda.jit
Expand All @@ -44,7 +43,7 @@ def _aradon_inner_2d_kernel(x, y, f, px, h, flim0, flim1, npx, nh):
# x[ipx, ifr] += y[ih, ifr] * exp(TWO_PI_I_PLUS * f[ifr] * px[ipx] * h[ih])
# fast computation of exp(1j * x) - see https://stackoverflow.com/questions/9860711/cucomplex-h-and-exp/9863048#9863048
s, c = cuda.libdevice.sincosf(TWO_PI_PLUS * f[ifr] * px[ipx] * h[ih])
x[ipx, ifr] += y[ih, ifr] * (c + I * s)
x[ipx, ifr] += y[ih, ifr] * (c + IMG * s)


def _radon_inner_2d_cuda(
Expand Down
7 changes: 3 additions & 4 deletions pylops/signalprocessing/_fourierradon3d_cuda.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
from cmath import exp
from math import pi

import cupy as cp
from numba import cuda

TWO_PI_MINUS = cp.float32(-2.0 * pi)
TWO_PI_PLUS = cp.float32(2.0 * pi)
I = cp.complex64(1j)
IMG = cp.complex64(1j)


@cuda.jit
Expand All @@ -30,7 +29,7 @@ def _radon_inner_3d_kernel(x, y, f, py, px, hy, hx, flim0, flim1, npy, npx, nhy,
s, c = cuda.libdevice.sincosf(
TWO_PI_MINUS * f[ifr] * (py[ipy] * hy[ihy] + px[ipx] * hx[ihx])
)
y[ihy, ihx, ifr] += x[ipy, ipx, ifr] * (c + I * s)
y[ihy, ihx, ifr] += x[ipy, ipx, ifr] * (c + IMG * s)


@cuda.jit
Expand All @@ -53,7 +52,7 @@ def _aradon_inner_3d_kernel(x, y, f, py, px, hy, hx, flim0, flim1, npy, npx, nhy
s, c = cuda.libdevice.sincosf(
TWO_PI_PLUS * f[ifr] * (py[ipy] * hy[ihy] + px[ipx] * hx[ihx])
)
x[ipy, ipx, ifr] += y[ihy, ihx, ifr] * (c + I * s)
x[ipy, ipx, ifr] += y[ihy, ihx, ifr] * (c + IMG * s)


def _radon_inner_3d_cuda(
Expand Down

0 comments on commit 02cfddd

Please sign in to comment.