MCPcopy Create free account
hub / github.com/numpy/numpy / arr_interp_complex

Function arr_interp_complex

numpy/core/src/multiarray/compiled_base.c:666–865  ·  view source on GitHub ↗

As for arr_interp but for complex fp values */

Source from the content-addressed store, hash-verified

664
665/* As for arr_interp but for complex fp values */
666NPY_NO_EXPORT PyObject *
667arr_interp_complex(PyObject *NPY_UNUSED(self), PyObject *const *args, Py_ssize_t len_args,
668 PyObject *kwnames)
669{
670
671 PyObject *fp, *xp, *x;
672 PyObject *left = NULL, *right = NULL;
673 PyArrayObject *afp = NULL, *axp = NULL, *ax = NULL, *af = NULL;
674 npy_intp i, lenx, lenxp;
675
676 const npy_double *dx, *dz;
677 const npy_cdouble *dy;
678 npy_cdouble lval, rval;
679 npy_cdouble *dres, *slopes = NULL;
680
681 NPY_BEGIN_THREADS_DEF;
682
683 NPY_PREPARE_ARGPARSER;
684 if (npy_parse_arguments("interp_complex", args, len_args, kwnames,
685 "x", NULL, &x,
686 "xp", NULL, &xp,
687 "fp", NULL, &fp,
688 "|left", NULL, &left,
689 "|right", NULL, &right,
690 NULL, NULL, NULL) < 0) {
691 return NULL;
692 }
693
694 afp = (PyArrayObject *)PyArray_ContiguousFromAny(fp, NPY_CDOUBLE, 1, 1);
695
696 if (afp == NULL) {
697 return NULL;
698 }
699
700 axp = (PyArrayObject *)PyArray_ContiguousFromAny(xp, NPY_DOUBLE, 1, 1);
701 if (axp == NULL) {
702 goto fail;
703 }
704 ax = (PyArrayObject *)PyArray_ContiguousFromAny(x, NPY_DOUBLE, 0, 0);
705 if (ax == NULL) {
706 goto fail;
707 }
708 lenxp = PyArray_SIZE(axp);
709 if (lenxp == 0) {
710 PyErr_SetString(PyExc_ValueError,
711 "array of sample points is empty");
712 goto fail;
713 }
714 if (PyArray_SIZE(afp) != lenxp) {
715 PyErr_SetString(PyExc_ValueError,
716 "fp and xp are not of the same length.");
717 goto fail;
718 }
719
720 lenx = PyArray_SIZE(ax);
721 dx = (const npy_double *)PyArray_DATA(axp);
722 dz = (const npy_double *)PyArray_DATA(ax);
723

Callers

nothing calls this directly

Calls 5

PyArray_DATAFunction · 0.85
PyArray_NDIMFunction · 0.85
PyArray_DIMSFunction · 0.85
binary_search_with_guessFunction · 0.85
PyArray_ReturnFunction · 0.85

Tested by

no test coverage detected