Commit 9c252b21 authored by Peter Bell's avatar Peter Bell
Browse files

Handle keyword args in good_size

parent 8234f5c6
......@@ -374,11 +374,13 @@ py::array genuine_hartley(const py::array &in, const py::object &axes_,
}
// Export good_size in raw C-API to reduce overhead (~4x faster)
PyObject * good_size(PyObject * /*self*/, PyObject * args)
PyObject * good_size(PyObject * /*self*/, PyObject * args, PyObject * kwargs)
{
Py_ssize_t n_ = -1;
int real = false;
if (!PyArg_ParseTuple(args, "n|p:good_size", &n_, &real))
char * keywords[] = {"target", "real", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "n|p:good_size", keywords,
&n_, &real))
return nullptr;
if (n_<0)
......@@ -687,7 +689,7 @@ const char * good_size_DS = R"""(Returns a good length to pad an FFT to.
Parameters
----------
n : int
target : int
Minimum transform length
real : bool, optional
True if either input or output of FFT should be fully real.
......@@ -724,6 +726,7 @@ PYBIND11_MODULE(pypocketfft, m)
"out"_a=None, "nthreads"_a=1);
static PyMethodDef good_size_meth[] =
{{"good_size", good_size, METH_VARARGS, good_size_DS}, {0}};
{{"good_size", (PyCFunction)good_size,
METH_VARARGS | METH_KEYWORDS, good_size_DS}, {0}};
PyModule_AddFunctions(m.ptr(), good_size_meth);
}
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