Commit 1783e797 authored by Martin Reinecke's avatar Martin Reinecke

better parameter names for FFTPACK functions

parent 7103903a
......@@ -2871,7 +2871,8 @@ template<typename T> void r2c(const shape_t &shape_in,
template<typename T> void r2c(const shape_t &shape_in,
const stride_t &stride_in, const stride_t &stride_out, const shape_t &axes,
bool forward, const T *data_in, complex<T> *data_out, T fct, size_t nthreads=1)
bool forward, const T *data_in, complex<T> *data_out, T fct,
size_t nthreads=1)
{
if (util::prod(shape_in)==0) return;
util::sanity_check(shape_in, stride_in, stride_out, false, axes);
......@@ -2927,17 +2928,17 @@ template<typename T> void c2r(const shape_t &shape_out,
template<typename T> void r2r_fftpack(const shape_t &shape,
const stride_t &stride_in, const stride_t &stride_out, const shape_t &axes,
bool r2c, bool forward, const T *data_in, T *data_out, T fct,
bool r2hc, bool forward, const T *data_in, T *data_out, T fct,
size_t nthreads=1)
{
if (util::prod(shape)==0) return;
util::sanity_check(shape, stride_in, stride_out, data_in==data_out, axes);
cndarr<T> ain(data_in, shape, stride_in);
ndarr<T> aout(data_out, shape, stride_out);
general_r(ain, aout, axes, r2c, forward, fct, nthreads);
general_r(ain, aout, axes, r2hc, forward, fct, nthreads);
}
template<typename T> void r2r_hartley(const shape_t &shape,
template<typename T> void r2r_separable_hartley(const shape_t &shape,
const stride_t &stride_in, const stride_t &stride_out, const shape_t &axes,
const T *data_in, T *data_out, T fct, size_t nthreads=1)
{
......@@ -2958,7 +2959,7 @@ using detail::c2c;
using detail::c2r;
using detail::r2c;
using detail::r2r_fftpack;
using detail::r2r_hartley;
using detail::r2r_separable_hartley;
} // namespace pocketfft
......
......@@ -200,7 +200,7 @@ py::array r2c(const py::array &in, const py::object &axes_, bool forward,
}
template<typename T> py::array r2r_fftpack_internal(const py::array &in,
const py::object &axes_, bool input_halfcomplex, bool forward, int inorm,
const py::object &axes_, bool r2hc, bool forward, int inorm,
py::object &out_, size_t nthreads)
{
auto axes = makeaxes(in, axes_);
......@@ -213,18 +213,18 @@ template<typename T> py::array r2r_fftpack_internal(const py::array &in,
{
py::gil_scoped_release release;
T fct = norm_fct<T>(inorm, dims, axes);
pocketfft::r2r_fftpack(dims, s_in, s_out, axes, !input_halfcomplex, forward,
pocketfft::r2r_fftpack(dims, s_in, s_out, axes, r2hc, forward,
d_in, d_out, fct, nthreads);
}
return res;
}
py::array r2r_fftpack(const py::array &in, const py::object &axes_,
bool input_halfcomplex, bool forward, int inorm, py::object &out_,
bool r2hc, bool forward, int inorm, py::object &out_,
size_t nthreads)
{
DISPATCH(in, f64, f32, flong, r2r_fftpack_internal, (in, axes_,
input_halfcomplex, forward, inorm, out_, nthreads))
DISPATCH(in, f64, f32, flong, r2r_fftpack_internal, (in, axes_, r2hc,
forward, inorm, out_, nthreads))
}
template<typename T> py::array c2r_internal(const py::array &in,
......@@ -272,7 +272,8 @@ template<typename T> py::array separable_hartley_internal(const py::array &in,
{
py::gil_scoped_release release;
T fct = norm_fct<T>(inorm, dims, axes);
pocketfft::r2r_hartley(dims, s_in, s_out, axes, d_in, d_out, fct, nthreads);
pocketfft::r2r_separable_hartley(dims, s_in, s_out, axes, d_in, d_out, fct,
nthreads);
}
return res;
}
......@@ -436,9 +437,9 @@ a : numpy.ndarray (any real type)
axes : list of integers
The axes along which the FFT is carried out.
If not set, all axes will be transformed.
input_halfcomplex : bool
if True, the transform will go from halfcomplex to real format, else in
the other direction
r2hc : bool
if True, the input is purely real and the output will be halfcoplex,
otherwise the opposite
forward : bool
If `True`, a negative sign is used in the exponent, else a positive one.
inorm : int
......@@ -530,17 +531,16 @@ PYBIND11_MODULE(pypocketfft, m)
using namespace pybind11::literals;
m.doc() = pypocketfft_DS;
m.def("c2c",&c2c, c2c_DS, "a"_a, "axes"_a=None, "forward"_a=true,
m.def("c2c", c2c, c2c_DS, "a"_a, "axes"_a=None, "forward"_a=true,
"inorm"_a=0, "out"_a=None, "nthreads"_a=1);
m.def("r2c",&r2c, r2c_DS, "a"_a, "axes"_a=None, "forward"_a=true,
m.def("r2c", r2c, r2c_DS, "a"_a, "axes"_a=None, "forward"_a=true,
"inorm"_a=0, "out"_a=None, "nthreads"_a=1);
m.def("c2r",&c2r, c2r_DS, "a"_a, "axes"_a=None, "lastsize"_a=0,
m.def("c2r", c2r, c2r_DS, "a"_a, "axes"_a=None, "lastsize"_a=0,
"forward"_a=true, "inorm"_a=0, "out"_a=None, "nthreads"_a=1);
m.def("r2r_fftpack",&r2r_fftpack, r2r_fftpack_DS, "a"_a, "axes"_a,
"input_halfcomplex"_a, "forward"_a, "inorm"_a=0, "out"_a=None,
"nthreads"_a=1);
m.def("separable_hartley",&separable_hartley, separable_hartley_DS, "a"_a,
m.def("r2r_fftpack", r2r_fftpack, r2r_fftpack_DS, "a"_a, "axes"_a,
"r2hc"_a, "forward"_a, "inorm"_a=0, "out"_a=None, "nthreads"_a=1);
m.def("separable_hartley", separable_hartley, separable_hartley_DS, "a"_a,
"axes"_a=None, "inorm"_a=0, "out"_a=None, "nthreads"_a=1);
m.def("genuine_hartley",&genuine_hartley, genuine_hartley_DS, "a"_a,
m.def("genuine_hartley", genuine_hartley, genuine_hartley_DS, "a"_a,
"axes"_a=None, "inorm"_a=0, "out"_a=None, "nthreads"_a=1);
}
......@@ -32,11 +32,11 @@ def irfftn(a, axes=None, lastsize=0, inorm=0, nthreads=1):
inorm=inorm, nthreads=nthreads)
def rfft_scipy(a, axis, inorm=0, out=None, nthreads=1):
return pypocketfft.r2r_fftpack(a, axes=(axis,), input_halfcomplex=False,
return pypocketfft.r2r_fftpack(a, axes=(axis,), r2hc=True,
forward=True, inorm=inorm, out=out,
nthreads=nthreads)
def irfft_scipy(a, axis, inorm=0, out=None, nthreads=1):
return pypocketfft.r2r_fftpack(a, axes=(axis,), input_halfcomplex=True,
return pypocketfft.r2r_fftpack(a, axes=(axis,), r2hc=False,
forward=False, inorm=inorm, out=out,
nthreads=nthreads)
@pmp("len", len1D)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment