/* File: spheroidalwavefunctionsmodule.c
 * This file is auto-generated with f2py (version:2.1.1).
 * f2py is a Fortran to Python Interface Generator (FPIG), Second Edition,
 * written by Pearu Peterson <pearu@cens.ioc.ee>.
 * Generation date: Tue Sep 17 05:45:16 2024
 * Do not edit this file directly unless you know what you are doing!!!
 */

#ifdef __cplusplus
extern "C" {
#endif

#ifndef PY_SSIZE_T_CLEAN
#define PY_SSIZE_T_CLEAN
#endif /* PY_SSIZE_T_CLEAN */

/* Unconditionally included */
#include <Python.h>
#include <numpy/npy_os.h>

/*********************** See f2py2e/cfuncs.py: includes ***********************/
#include "fortranobject.h"
#include <math.h>

/**************** See f2py2e/rules.py: mod_rules['modulebody'] ****************/
static PyObject *spheroidalwavefunctions_error;
static PyObject *spheroidalwavefunctions_module;

/*********************** See f2py2e/cfuncs.py: typedefs ***********************/
/*need_typedefs*/

/****************** See f2py2e/cfuncs.py: typedefs_generated ******************/
/*need_typedefs_generated*/

/********************** See f2py2e/cfuncs.py: cppmacros **********************/

/* See fortranobject.h for definitions. The macros here are provided for BC. */
#define rank f2py_rank
#define shape f2py_shape
#define fshape f2py_shape
#define len f2py_len
#define flen f2py_flen
#define slen f2py_slen
#define size f2py_size


#define CHECKSCALAR(check,tcheck,name,show,var)\
    if (!(check)) {\
        char errstring[256];\
        sprintf(errstring, "%s: "show, "("tcheck") failed for "name, var);\
        PyErr_SetString(spheroidalwavefunctions_error,errstring);\
        /*goto capi_fail;*/\
    } else 

#ifdef DEBUGCFUNCS
#define CFUNCSMESS(mess) fprintf(stderr,"debug-capi:"mess);
#define CFUNCSMESSPY(mess,obj) CFUNCSMESS(mess) \
    PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\
    fprintf(stderr,"\n");
#else
#define CFUNCSMESS(mess)
#define CFUNCSMESSPY(mess,obj)
#endif


#ifndef max
#define max(a,b) ((a > b) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) ((a < b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) ((a > b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b) ((a < b) ? (a) : (b))
#endif


#if defined(PREPEND_FORTRAN)
#if defined(NO_APPEND_FORTRAN)
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) _##F
#else
#define F_FUNC(f,F) _##f
#endif
#else
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) _##F##_
#else
#define F_FUNC(f,F) _##f##_
#endif
#endif
#else
#if defined(NO_APPEND_FORTRAN)
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F
#else
#define F_FUNC(f,F) f
#endif
#else
#if defined(UPPERCASE_FORTRAN)
#define F_FUNC(f,F) F##_
#else
#define F_FUNC(f,F) f##_
#endif
#endif
#endif
#if defined(UNDERSCORE_G77)
#define F_FUNC_US(f,F) F_FUNC(f##_,F##_)
#else
#define F_FUNC_US(f,F) F_FUNC(f,F)
#endif


/************************ See f2py2e/cfuncs.py: cfuncs ************************/

static int
double_from_pyobj(double* v, PyObject *obj, const char *errmess)
{
    PyObject* tmp = NULL;
    if (PyFloat_Check(obj)) {
        *v = PyFloat_AsDouble(obj);
        return !(*v == -1.0 && PyErr_Occurred());
    }

    tmp = PyNumber_Float(obj);
    if (tmp) {
        *v = PyFloat_AsDouble(tmp);
        Py_DECREF(tmp);
        return !(*v == -1.0 && PyErr_Occurred());
    }

    if (PyComplex_Check(obj)) {
        PyErr_Clear();
        tmp = PyObject_GetAttrString(obj,"real");
    }
    else if (PyBytes_Check(obj) || PyUnicode_Check(obj)) {
        /*pass*/;
    }
    else if (PySequence_Check(obj)) {
        PyErr_Clear();
        tmp = PySequence_GetItem(obj, 0);
    }

    if (tmp) {
        if (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;}
        Py_DECREF(tmp);
    }
    {
        PyObject* err = PyErr_Occurred();
        if (err==NULL) err = spheroidalwavefunctions_error;
        PyErr_SetString(err,errmess);
    }
    return 0;
}


static int
int_from_pyobj(int* v, PyObject *obj, const char *errmess)
{
    PyObject* tmp = NULL;

    if (PyLong_Check(obj)) {
        *v = Npy__PyLong_AsInt(obj);
        return !(*v == -1 && PyErr_Occurred());
    }

    tmp = PyNumber_Long(obj);
    if (tmp) {
        *v = Npy__PyLong_AsInt(tmp);
        Py_DECREF(tmp);
        return !(*v == -1 && PyErr_Occurred());
    }

    if (PyComplex_Check(obj)) {
        PyErr_Clear();
        tmp = PyObject_GetAttrString(obj,"real");
    }
    else if (PyBytes_Check(obj) || PyUnicode_Check(obj)) {
        /*pass*/;
    }
    else if (PySequence_Check(obj)) {
        PyErr_Clear();
        tmp = PySequence_GetItem(obj, 0);
    }

    if (tmp) {
        if (int_from_pyobj(v, tmp, errmess)) {
            Py_DECREF(tmp);
            return 1;
        }
        Py_DECREF(tmp);
    }

    {
        PyObject* err = PyErr_Occurred();
        if (err == NULL) {
            err = spheroidalwavefunctions_error;
        }
        PyErr_SetString(err, errmess);
    }
    return 0;
}


/********************* See f2py2e/cfuncs.py: userincludes *********************/
/*need_userincludes*/

/********************* See f2py2e/capi_rules.py: usercode *********************/


/* See f2py2e/rules.py */
/*eof externroutines*/

/******************** See f2py2e/capi_rules.py: usercode1 ********************/


/******************* See f2py2e/cb_rules.py: buildcallback *******************/
/*need_callbacks*/

/*********************** See f2py2e/rules.py: buildapi ***********************/

/*********************************** profcn ***********************************/
static char doc_f2py_rout_spheroidalwavefunctions_prolate_swf_profcn[] = "\
r1c,ir1e,r1dc,ir1de,r2c,ir2e,r2dc,ir2de,naccr,s1c,is1e,s1dc,is1de,naccs = profcn(c,m,lnum,ioprad,x1,iopang,iopnorm,arg,[narg])\n\nWrapper for ``profcn``.\
\n\nParameters\n----------\n"
"c : input float\n"
"m : input int\n"
"lnum : input int\n"
"ioprad : input int\n"
"x1 : input float\n"
"iopang : input int\n"
"iopnorm : input int\n"
"arg : input rank-1 array('d') with bounds (narg)\n"
"\nOther Parameters\n----------------\n"
"narg : input int, optional\n    Default: shape(arg, 0)\n"
"\nReturns\n-------\n"
"r1c : rank-1 array('d') with bounds (lnum)\n"
"ir1e : rank-1 array('i') with bounds (lnum)\n"
"r1dc : rank-1 array('d') with bounds (lnum)\n"
"ir1de : rank-1 array('i') with bounds (lnum)\n"
"r2c : rank-1 array('d') with bounds (lnum)\n"
"ir2e : rank-1 array('i') with bounds (lnum)\n"
"r2dc : rank-1 array('d') with bounds (lnum)\n"
"ir2de : rank-1 array('i') with bounds (lnum)\n"
"naccr : rank-1 array('i') with bounds (lnum)\n"
"s1c : rank-2 array('d') with bounds (lnum,narg)\n"
"is1e : rank-2 array('i') with bounds (lnum,narg)\n"
"s1dc : rank-2 array('d') with bounds (lnum,narg)\n"
"is1de : rank-2 array('i') with bounds (lnum,narg)\n"
"naccs : rank-2 array('i') with bounds (lnum,narg)";
/*  */
static PyObject *f2py_rout_spheroidalwavefunctions_prolate_swf_profcn(const PyObject *capi_self,
                           PyObject *capi_args,
                           PyObject *capi_keywds,
                           void (*f2py_func)(double*,int*,int*,int*,double*,int*,int*,int*,double*,double*,int*,double*,int*,double*,int*,double*,int*,int*,double*,int*,double*,int*,int*)) {
    PyObject * volatile capi_buildvalue = NULL;
    volatile int f2py_success = 1;
/*decl*/

    double c = 0;
    PyObject *c_capi = Py_None;
    int m = 0;
    PyObject *m_capi = Py_None;
    int lnum = 0;
    PyObject *lnum_capi = Py_None;
    int ioprad = 0;
    PyObject *ioprad_capi = Py_None;
    double x1 = 0;
    PyObject *x1_capi = Py_None;
    int iopang = 0;
    PyObject *iopang_capi = Py_None;
    int iopnorm = 0;
    PyObject *iopnorm_capi = Py_None;
    int narg = 0;
    PyObject *narg_capi = Py_None;
    double *arg = NULL;
    npy_intp arg_Dims[1] = {-1};
    const int arg_Rank = 1;
    PyArrayObject *capi_arg_as_array = NULL;
    int capi_arg_intent = 0;
    PyObject *arg_capi = Py_None;
    double *r1c = NULL;
    npy_intp r1c_Dims[1] = {-1};
    const int r1c_Rank = 1;
    PyArrayObject *capi_r1c_as_array = NULL;
    int capi_r1c_intent = 0;
    int *ir1e = NULL;
    npy_intp ir1e_Dims[1] = {-1};
    const int ir1e_Rank = 1;
    PyArrayObject *capi_ir1e_as_array = NULL;
    int capi_ir1e_intent = 0;
    double *r1dc = NULL;
    npy_intp r1dc_Dims[1] = {-1};
    const int r1dc_Rank = 1;
    PyArrayObject *capi_r1dc_as_array = NULL;
    int capi_r1dc_intent = 0;
    int *ir1de = NULL;
    npy_intp ir1de_Dims[1] = {-1};
    const int ir1de_Rank = 1;
    PyArrayObject *capi_ir1de_as_array = NULL;
    int capi_ir1de_intent = 0;
    double *r2c = NULL;
    npy_intp r2c_Dims[1] = {-1};
    const int r2c_Rank = 1;
    PyArrayObject *capi_r2c_as_array = NULL;
    int capi_r2c_intent = 0;
    int *ir2e = NULL;
    npy_intp ir2e_Dims[1] = {-1};
    const int ir2e_Rank = 1;
    PyArrayObject *capi_ir2e_as_array = NULL;
    int capi_ir2e_intent = 0;
    double *r2dc = NULL;
    npy_intp r2dc_Dims[1] = {-1};
    const int r2dc_Rank = 1;
    PyArrayObject *capi_r2dc_as_array = NULL;
    int capi_r2dc_intent = 0;
    int *ir2de = NULL;
    npy_intp ir2de_Dims[1] = {-1};
    const int ir2de_Rank = 1;
    PyArrayObject *capi_ir2de_as_array = NULL;
    int capi_ir2de_intent = 0;
    int *naccr = NULL;
    npy_intp naccr_Dims[1] = {-1};
    const int naccr_Rank = 1;
    PyArrayObject *capi_naccr_as_array = NULL;
    int capi_naccr_intent = 0;
    double *s1c = NULL;
    npy_intp s1c_Dims[2] = {-1, -1};
    const int s1c_Rank = 2;
    PyArrayObject *capi_s1c_as_array = NULL;
    int capi_s1c_intent = 0;
    int *is1e = NULL;
    npy_intp is1e_Dims[2] = {-1, -1};
    const int is1e_Rank = 2;
    PyArrayObject *capi_is1e_as_array = NULL;
    int capi_is1e_intent = 0;
    double *s1dc = NULL;
    npy_intp s1dc_Dims[2] = {-1, -1};
    const int s1dc_Rank = 2;
    PyArrayObject *capi_s1dc_as_array = NULL;
    int capi_s1dc_intent = 0;
    int *is1de = NULL;
    npy_intp is1de_Dims[2] = {-1, -1};
    const int is1de_Rank = 2;
    PyArrayObject *capi_is1de_as_array = NULL;
    int capi_is1de_intent = 0;
    int *naccs = NULL;
    npy_intp naccs_Dims[2] = {-1, -1};
    const int naccs_Rank = 2;
    PyArrayObject *capi_naccs_as_array = NULL;
    int capi_naccs_intent = 0;
    static char *capi_kwlist[] = {"c","m","lnum","ioprad","x1","iopang","iopnorm","arg","narg",NULL};

/*routdebugenter*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_clock();
#endif
    if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\
        "OOOOOOOO|O:spheroidalwavefunctions.prolate_swf.profcn",\
        capi_kwlist,&c_capi,&m_capi,&lnum_capi,&ioprad_capi,&x1_capi,&iopang_capi,&iopnorm_capi,&arg_capi,&narg_capi))
        return NULL;
/*frompyobj*/
    /* Processing variable c */
        f2py_success = double_from_pyobj(&c,c_capi,"spheroidalwavefunctions.prolate_swf.profcn() 1st argument (c) can't be converted to double");
    if (f2py_success) {
    /* Processing variable x1 */
        f2py_success = double_from_pyobj(&x1,x1_capi,"spheroidalwavefunctions.prolate_swf.profcn() 5th argument (x1) can't be converted to double");
    if (f2py_success) {
    /* Processing variable arg */
    ;
    capi_arg_intent |= F2PY_INTENT_IN;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the 8th argument `arg`";
    capi_arg_as_array = ndarray_from_pyobj(  NPY_DOUBLE,1,arg_Dims,arg_Rank,  capi_arg_intent,arg_capi,capi_errmess);
    if (capi_arg_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        arg = (double *)(PyArray_DATA(capi_arg_as_array));

    /* Processing variable m */
        f2py_success = int_from_pyobj(&m,m_capi,"spheroidalwavefunctions.prolate_swf.profcn() 2nd argument (m) can't be converted to int");
    if (f2py_success) {
    /* Processing variable lnum */
        f2py_success = int_from_pyobj(&lnum,lnum_capi,"spheroidalwavefunctions.prolate_swf.profcn() 3rd argument (lnum) can't be converted to int");
    if (f2py_success) {
    /* Processing variable ioprad */
        f2py_success = int_from_pyobj(&ioprad,ioprad_capi,"spheroidalwavefunctions.prolate_swf.profcn() 4th argument (ioprad) can't be converted to int");
    if (f2py_success) {
    /* Processing variable iopang */
        f2py_success = int_from_pyobj(&iopang,iopang_capi,"spheroidalwavefunctions.prolate_swf.profcn() 6th argument (iopang) can't be converted to int");
    if (f2py_success) {
    /* Processing variable iopnorm */
        f2py_success = int_from_pyobj(&iopnorm,iopnorm_capi,"spheroidalwavefunctions.prolate_swf.profcn() 7th argument (iopnorm) can't be converted to int");
    if (f2py_success) {
    /* Processing variable narg */
    if (narg_capi == Py_None) narg = shape(arg, 0); else
        f2py_success = int_from_pyobj(&narg,narg_capi,"spheroidalwavefunctions.prolate_swf.profcn() 1st keyword (narg) can't be converted to int");
    if (f2py_success) {
    CHECKSCALAR(shape(arg, 0) == narg,"shape(arg, 0) == narg","1st keyword narg","profcn:narg=%d",narg) {
    /* Processing variable r1c */
    r1c_Dims[0]=lnum;
    capi_r1c_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `r1c`";
    capi_r1c_as_array = ndarray_from_pyobj(  NPY_DOUBLE,1,r1c_Dims,r1c_Rank,  capi_r1c_intent,Py_None,capi_errmess);
    if (capi_r1c_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        r1c = (double *)(PyArray_DATA(capi_r1c_as_array));

    /* Processing variable r1dc */
    r1dc_Dims[0]=lnum;
    capi_r1dc_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `r1dc`";
    capi_r1dc_as_array = ndarray_from_pyobj(  NPY_DOUBLE,1,r1dc_Dims,r1dc_Rank,  capi_r1dc_intent,Py_None,capi_errmess);
    if (capi_r1dc_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        r1dc = (double *)(PyArray_DATA(capi_r1dc_as_array));

    /* Processing variable r2c */
    r2c_Dims[0]=lnum;
    capi_r2c_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `r2c`";
    capi_r2c_as_array = ndarray_from_pyobj(  NPY_DOUBLE,1,r2c_Dims,r2c_Rank,  capi_r2c_intent,Py_None,capi_errmess);
    if (capi_r2c_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        r2c = (double *)(PyArray_DATA(capi_r2c_as_array));

    /* Processing variable r2dc */
    r2dc_Dims[0]=lnum;
    capi_r2dc_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `r2dc`";
    capi_r2dc_as_array = ndarray_from_pyobj(  NPY_DOUBLE,1,r2dc_Dims,r2dc_Rank,  capi_r2dc_intent,Py_None,capi_errmess);
    if (capi_r2dc_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        r2dc = (double *)(PyArray_DATA(capi_r2dc_as_array));

    /* Processing variable s1c */
    s1c_Dims[0]=lnum,s1c_Dims[1]=narg;
    capi_s1c_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `s1c`";
    capi_s1c_as_array = ndarray_from_pyobj(  NPY_DOUBLE,1,s1c_Dims,s1c_Rank,  capi_s1c_intent,Py_None,capi_errmess);
    if (capi_s1c_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        s1c = (double *)(PyArray_DATA(capi_s1c_as_array));

    /* Processing variable s1dc */
    s1dc_Dims[0]=lnum,s1dc_Dims[1]=narg;
    capi_s1dc_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `s1dc`";
    capi_s1dc_as_array = ndarray_from_pyobj(  NPY_DOUBLE,1,s1dc_Dims,s1dc_Rank,  capi_s1dc_intent,Py_None,capi_errmess);
    if (capi_s1dc_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        s1dc = (double *)(PyArray_DATA(capi_s1dc_as_array));

    /* Processing variable ir1e */
    ir1e_Dims[0]=lnum;
    capi_ir1e_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `ir1e`";
    capi_ir1e_as_array = ndarray_from_pyobj(  NPY_INT,1,ir1e_Dims,ir1e_Rank,  capi_ir1e_intent,Py_None,capi_errmess);
    if (capi_ir1e_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        ir1e = (int *)(PyArray_DATA(capi_ir1e_as_array));

    /* Processing variable ir1de */
    ir1de_Dims[0]=lnum;
    capi_ir1de_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `ir1de`";
    capi_ir1de_as_array = ndarray_from_pyobj(  NPY_INT,1,ir1de_Dims,ir1de_Rank,  capi_ir1de_intent,Py_None,capi_errmess);
    if (capi_ir1de_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        ir1de = (int *)(PyArray_DATA(capi_ir1de_as_array));

    /* Processing variable ir2e */
    ir2e_Dims[0]=lnum;
    capi_ir2e_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `ir2e`";
    capi_ir2e_as_array = ndarray_from_pyobj(  NPY_INT,1,ir2e_Dims,ir2e_Rank,  capi_ir2e_intent,Py_None,capi_errmess);
    if (capi_ir2e_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        ir2e = (int *)(PyArray_DATA(capi_ir2e_as_array));

    /* Processing variable ir2de */
    ir2de_Dims[0]=lnum;
    capi_ir2de_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `ir2de`";
    capi_ir2de_as_array = ndarray_from_pyobj(  NPY_INT,1,ir2de_Dims,ir2de_Rank,  capi_ir2de_intent,Py_None,capi_errmess);
    if (capi_ir2de_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        ir2de = (int *)(PyArray_DATA(capi_ir2de_as_array));

    /* Processing variable is1e */
    is1e_Dims[0]=lnum,is1e_Dims[1]=narg;
    capi_is1e_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `is1e`";
    capi_is1e_as_array = ndarray_from_pyobj(  NPY_INT,1,is1e_Dims,is1e_Rank,  capi_is1e_intent,Py_None,capi_errmess);
    if (capi_is1e_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        is1e = (int *)(PyArray_DATA(capi_is1e_as_array));

    /* Processing variable is1de */
    is1de_Dims[0]=lnum,is1de_Dims[1]=narg;
    capi_is1de_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `is1de`";
    capi_is1de_as_array = ndarray_from_pyobj(  NPY_INT,1,is1de_Dims,is1de_Rank,  capi_is1de_intent,Py_None,capi_errmess);
    if (capi_is1de_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        is1de = (int *)(PyArray_DATA(capi_is1de_as_array));

    /* Processing variable naccr */
    naccr_Dims[0]=lnum;
    capi_naccr_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `naccr`";
    capi_naccr_as_array = ndarray_from_pyobj(  NPY_INT,1,naccr_Dims,naccr_Rank,  capi_naccr_intent,Py_None,capi_errmess);
    if (capi_naccr_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        naccr = (int *)(PyArray_DATA(capi_naccr_as_array));

    /* Processing variable naccs */
    naccs_Dims[0]=lnum,naccs_Dims[1]=narg;
    capi_naccs_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE;
    const char * capi_errmess = "spheroidalwavefunctions.spheroidalwavefunctions.prolate_swf.profcn: failed to create array from the hidden `naccs`";
    capi_naccs_as_array = ndarray_from_pyobj(  NPY_INT,1,naccs_Dims,naccs_Rank,  capi_naccs_intent,Py_None,capi_errmess);
    if (capi_naccs_as_array == NULL) {
        PyObject* capi_err = PyErr_Occurred();
        if (capi_err == NULL) {
            capi_err = spheroidalwavefunctions_error;
            PyErr_SetString(capi_err, capi_errmess);
        }
    } else {
        naccs = (int *)(PyArray_DATA(capi_naccs_as_array));

/*end of frompyobj*/
#ifdef F2PY_REPORT_ATEXIT
f2py_start_call_clock();
#endif
/*callfortranroutine*/
                (*f2py_func)(&c,&m,&lnum,&ioprad,&x1,&iopang,&iopnorm,&narg,arg,r1c,ir1e,r1dc,ir1de,r2c,ir2e,r2dc,ir2de,naccr,s1c,is1e,s1dc,is1de,naccs);
if (PyErr_Occurred())
  f2py_success = 0;
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_call_clock();
#endif
/*end of callfortranroutine*/
        if (f2py_success) {
/*pyobjfrom*/
/*end of pyobjfrom*/
        CFUNCSMESS("Building return value.\n");
        capi_buildvalue = Py_BuildValue("NNNNNNNNNNNNNN",capi_r1c_as_array,capi_ir1e_as_array,capi_r1dc_as_array,capi_ir1de_as_array,capi_r2c_as_array,capi_ir2e_as_array,capi_r2dc_as_array,capi_ir2de_as_array,capi_naccr_as_array,capi_s1c_as_array,capi_is1e_as_array,capi_s1dc_as_array,capi_is1de_as_array,capi_naccs_as_array);
/*closepyobjfrom*/
/*end of closepyobjfrom*/
        } /*if (f2py_success) after callfortranroutine*/
/*cleanupfrompyobj*/
    }  /* if (capi_naccs_as_array == NULL) ... else of naccs */
    /* End of cleaning variable naccs */
    }  /* if (capi_naccr_as_array == NULL) ... else of naccr */
    /* End of cleaning variable naccr */
    }  /* if (capi_is1de_as_array == NULL) ... else of is1de */
    /* End of cleaning variable is1de */
    }  /* if (capi_is1e_as_array == NULL) ... else of is1e */
    /* End of cleaning variable is1e */
    }  /* if (capi_ir2de_as_array == NULL) ... else of ir2de */
    /* End of cleaning variable ir2de */
    }  /* if (capi_ir2e_as_array == NULL) ... else of ir2e */
    /* End of cleaning variable ir2e */
    }  /* if (capi_ir1de_as_array == NULL) ... else of ir1de */
    /* End of cleaning variable ir1de */
    }  /* if (capi_ir1e_as_array == NULL) ... else of ir1e */
    /* End of cleaning variable ir1e */
    }  /* if (capi_s1dc_as_array == NULL) ... else of s1dc */
    /* End of cleaning variable s1dc */
    }  /* if (capi_s1c_as_array == NULL) ... else of s1c */
    /* End of cleaning variable s1c */
    }  /* if (capi_r2dc_as_array == NULL) ... else of r2dc */
    /* End of cleaning variable r2dc */
    }  /* if (capi_r2c_as_array == NULL) ... else of r2c */
    /* End of cleaning variable r2c */
    }  /* if (capi_r1dc_as_array == NULL) ... else of r1dc */
    /* End of cleaning variable r1dc */
    }  /* if (capi_r1c_as_array == NULL) ... else of r1c */
    /* End of cleaning variable r1c */
    } /*CHECKSCALAR(shape(arg, 0) == narg)*/
    } /*if (f2py_success) of narg*/
    /* End of cleaning variable narg */
    } /*if (f2py_success) of iopnorm*/
    /* End of cleaning variable iopnorm */
    } /*if (f2py_success) of iopang*/
    /* End of cleaning variable iopang */
    } /*if (f2py_success) of ioprad*/
    /* End of cleaning variable ioprad */
    } /*if (f2py_success) of lnum*/
    /* End of cleaning variable lnum */
    } /*if (f2py_success) of m*/
    /* End of cleaning variable m */
    if((PyObject *)capi_arg_as_array!=arg_capi) {
        Py_XDECREF(capi_arg_as_array); }
    }  /* if (capi_arg_as_array == NULL) ... else of arg */
    /* End of cleaning variable arg */
    } /*if (f2py_success) of x1*/
    /* End of cleaning variable x1 */
    } /*if (f2py_success) of c*/
    /* End of cleaning variable c */
/*end of cleanupfrompyobj*/
    if (capi_buildvalue == NULL) {
/*routdebugfailure*/
    } else {
/*routdebugleave*/
    }
    CFUNCSMESS("Freeing memory.\n");
/*freemem*/
#ifdef F2PY_REPORT_ATEXIT
f2py_stop_clock();
#endif
    return capi_buildvalue;
}
/******************************* end of profcn *******************************/
/*eof body*/

/******************* See f2py2e/f90mod_rules.py: buildhooks *******************/

static FortranDataDef f2py_prolate_swf_def[] = {
  {"profcn",-1,{{-1}},0,0,NULL,(void *)f2py_rout_spheroidalwavefunctions_prolate_swf_profcn,doc_f2py_rout_spheroidalwavefunctions_prolate_swf_profcn},
  {NULL}
};

static void f2py_setup_prolate_swf(char *profcn) {
  int i_f2py=0;
  f2py_prolate_swf_def[i_f2py++].data = profcn;
}
extern void F_FUNC_US(f2pyinitprolate_swf,F2PYINITPROLATE_SWF)(void (*)(char *));
static void f2py_init_prolate_swf(void) {
  F_FUNC_US(f2pyinitprolate_swf,F2PYINITPROLATE_SWF)(f2py_setup_prolate_swf);
}

/*need_f90modhooks*/

/************** See f2py2e/rules.py: module_rules['modulebody'] **************/

/******************* See f2py2e/common_rules.py: buildhooks *******************/

/*need_commonhooks*/

/**************************** See f2py2e/rules.py ****************************/

static FortranDataDef f2py_routine_defs[] = {

/*eof routine_defs*/
    {NULL}
};

static PyMethodDef f2py_module_methods[] = {

    {NULL,NULL}
};

static struct PyModuleDef moduledef = {
    PyModuleDef_HEAD_INIT,
    "spheroidalwavefunctions",
    NULL,
    -1,
    f2py_module_methods,
    NULL,
    NULL,
    NULL,
    NULL
};

PyMODINIT_FUNC PyInit_spheroidalwavefunctions(void) {
    int i;
    PyObject *m,*d, *s, *tmp;
    m = spheroidalwavefunctions_module = PyModule_Create(&moduledef);
    Py_SET_TYPE(&PyFortran_Type, &PyType_Type);
    import_array();
    if (PyErr_Occurred())
        {PyErr_SetString(PyExc_ImportError, "can't initialize module spheroidalwavefunctions (failed to import numpy)"); return m;}
    d = PyModule_GetDict(m);
    s = PyUnicode_FromString("2.1.1");
    PyDict_SetItemString(d, "__version__", s);
    Py_DECREF(s);
    s = PyUnicode_FromString(
        "This module 'spheroidalwavefunctions' is auto-generated with f2py (version:2.1.1).\nFunctions:\n"
"Fortran 90/95 modules:\n""  prolate_swf --- profcn()"".");
    PyDict_SetItemString(d, "__doc__", s);
    Py_DECREF(s);
    s = PyUnicode_FromString("2.1.1");
    PyDict_SetItemString(d, "__f2py_numpy_version__", s);
    Py_DECREF(s);
    spheroidalwavefunctions_error = PyErr_NewException ("spheroidalwavefunctions.error", NULL, NULL);
    /*
     * Store the error object inside the dict, so that it could get deallocated.
     * (in practice, this is a module, so it likely will not and cannot.)
     */
    PyDict_SetItemString(d, "_spheroidalwavefunctions_error", spheroidalwavefunctions_error);
    Py_DECREF(spheroidalwavefunctions_error);
    for(i=0;f2py_routine_defs[i].name!=NULL;i++) {
        tmp = PyFortranObject_NewAsAttr(&f2py_routine_defs[i]);
        PyDict_SetItemString(d, f2py_routine_defs[i].name, tmp);
        Py_DECREF(tmp);
    }

/*eof initf2pywraphooks*/
  PyDict_SetItemString(d, "prolate_swf", PyFortranObject_New(f2py_prolate_swf_def,f2py_init_prolate_swf));
/*eof initf90modhooks*/

/*eof initcommonhooks*/


#if Py_GIL_DISABLED
    // signal whether this module supports running with the GIL disabled
    PyUnstable_Module_SetGIL(m , Py_MOD_GIL_USED);
#endif

#ifdef F2PY_REPORT_ATEXIT
    if (! PyErr_Occurred())
        on_exit(f2py_report_on_exit,(void*)"spheroidalwavefunctions");
#endif
    return m;
}
#ifdef __cplusplus
}
#endif
