static PyObject *Py_Correlate(PyObject *obj, PyObject *args) { PyArrayObject *input = NULL, *output = NULL, *weights = NULL; PyArray_Dims origin; int mode; double cval; if (!PyArg_ParseTuple(args, "O&O&O&idO&", NI_ObjectToInputArray, &input, NI_ObjectToInputArray, &weights, NI_ObjectToOutputArray, &output, &mode, &cval, PyArray_IntpConverter, &origin)) { goto exit; } if (!_validate_origin(input, origin)) { goto exit; } NI_Correlate(input, weights, output, (NI_ExtendMode)mode, cval, origin.ptr); #ifdef HAVE_WRITEBACKIFCOPY PyArray_ResolveWritebackIfCopy(output); #endif exit: Py_XDECREF(input); Py_XDECREF(weights); Py_XDECREF(output); PyDimMem_FREE(origin.ptr); return PyErr_Occurred() ? NULL : Py_BuildValue(""); }
static PyObject *Py_Correlate(PyObject *obj, PyObject *args) { PyArrayObject *input = NULL, *output = NULL, *weights = NULL; maybelong *origin = NULL; int mode; double cval; if (!PyArg_ParseTuple(args, "O&O&O&idO&", NI_ObjectToInputArray, &input, NI_ObjectToInputArray, &weights, NI_ObjectToOutputArray, &output, &mode, &cval, NI_ObjectToLongSequence, &origin)) goto exit; if (!NI_Correlate(input, weights, output, (NI_ExtendMode)mode, cval, origin)) goto exit; exit: Py_XDECREF(input); Py_XDECREF(weights); Py_XDECREF(output); if (origin) free(origin); return PyErr_Occurred() ? NULL : Py_BuildValue(""); }