From 7e77dfecef1d826822bca920e5e24b6cf6f8b264 Mon Sep 17 00:00:00 2001 From: Martin Reinecke Date: Fri, 19 Jul 2019 14:47:06 +0200 Subject: [PATCH] add docstrings --- pypocketfft.cc | 72 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 4 deletions(-) diff --git a/pypocketfft.cc b/pypocketfft.cc index c2b4b2c..35102e3 100644 --- a/pypocketfft.cc +++ b/pypocketfft.cc @@ -581,6 +581,70 @@ numpy.ndarray (same shape and data type as `a`) The transformed data )"""; +const char *dct_DS = R"""(Performs a discrete cosine transform. + +Parameters +---------- +a : numpy.ndarray (any real type) + The input data +type : integer + the type of DCT. Must be in [1; 4]. +axes : list of integers + The axes along which the transform is carried out. + If not set, all axes will be transformed. +inorm : int + Normalization type + 0 : no normalization + 1 : divide by sqrt(N) + 2 : divide by N + where N is the product of n_i for every transformed axis i. + n_i is 2*(-1 for type 1 and 2* + for types 2, 3, 4. +out : numpy.ndarray (same shape and data type as `a`) + May be identical to `a`, but if it isn't, it must not overlap with `a`. + If None, a new array is allocated to store the output. +nthreads : int + Number of threads to use. If 0, use the system default (typically governed + by the `OMP_NUM_THREADS` environment variable). + +Returns +------- +numpy.ndarray (same shape and data type as `a`) + The transformed data +)"""; + +const char *dst_DS = R"""(Performs a discrete sine transform. + +Parameters +---------- +a : numpy.ndarray (any real type) + The input data +type : integer + the type of DST. Must be in [1; 4]. +axes : list of integers + The axes along which the transform is carried out. + If not set, all axes will be transformed. +inorm : int + Normalization type + 0 : no normalization + 1 : divide by sqrt(N) + 2 : divide by N + where N is the product of n_i for every transformed axis i. + n_i is 2*(+1 for type 1 and 2* + for types 2, 3, 4. +out : numpy.ndarray (same shape and data type as `a`) + May be identical to `a`, but if it isn't, it must not overlap with `a`. + If None, a new array is allocated to store the output. +nthreads : int + Number of threads to use. If 0, use the system default (typically governed + by the `OMP_NUM_THREADS` environment variable). + +Returns +------- +numpy.ndarray (same shape and data type as `a`) + The transformed data +)"""; + } // unnamed namespace PYBIND11_MODULE(pypocketfft, m) @@ -600,8 +664,8 @@ PYBIND11_MODULE(pypocketfft, m) "axes"_a=None, "inorm"_a=0, "out"_a=None, "nthreads"_a=1); m.def("genuine_hartley", genuine_hartley, genuine_hartley_DS, "a"_a, "axes"_a=None, "inorm"_a=0, "out"_a=None, "nthreads"_a=1); - m.def("dct", dct, /*dct_DS,*/ "a"_a, "type"_a, "axes"_a=None, - "inorm"_a=0, "out"_a=None, "nthreads"_a=1); - m.def("dst", dst, /*dst_DS,*/ "a"_a, "type"_a, "axes"_a=None, - "inorm"_a=0, "out"_a=None, "nthreads"_a=1); + m.def("dct", dct, dct_DS, "a"_a, "type"_a, "axes"_a=None, "inorm"_a=0, + "out"_a=None, "nthreads"_a=1); + m.def("dst", dst, dst_DS, "a"_a, "type"_a, "axes"_a=None, "inorm"_a=0, + "out"_a=None, "nthreads"_a=1); } -- GitLab