/* File: fitacf_fit_shortmodule.c * This file is auto-generated with f2py (version:2). * f2py is a Fortran to Python Interface Generator (FPIG), Second Edition, * written by Pearu Peterson . * Generation date: Wed Jan 8 13:23:37 2025 * Do not edit this file directly unless you know what you are doing!!! */ #ifdef __cplusplus extern "C" { #endif /*********************** See f2py2e/cfuncs.py: includes ***********************/ #include "Python.h" #include #include "fortranobject.h" #include #include #include /**************** See f2py2e/rules.py: mod_rules['modulebody'] ****************/ static PyObject *fitacf_fit_short_error; static PyObject *fitacf_fit_short_module; /*********************** See f2py2e/cfuncs.py: typedefs ***********************/ typedef signed char signed_char; typedef struct {float r,i;} complex_float; /****************** See f2py2e/cfuncs.py: typedefs_generated ******************/ typedef void(*cb_fcn_in_lmdif__user__routines_typedef)(int *,int *,float *,float *,int *); /********************** See f2py2e/cfuncs.py: cppmacros **********************/ #define PRINTPYOBJERR(obj)\ fprintf(stderr,"fitacf_fit_short.error is related to ");\ PyObject_Print((PyObject *)obj,stderr,Py_PRINT_RAW);\ fprintf(stderr,"\n"); \ #define FAILNULL(p) do { \ if ((p) == NULL) { \ PyErr_SetString(PyExc_MemoryError, "NULL pointer found"); \ goto capi_fail; \ } \ } while (0) #define MEMCOPY(to,from,n)\ do { FAILNULL(to); FAILNULL(from); (void)memcpy(to,from,n); } while (0) #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 #define pyobj_from_int1(v) (PyInt_FromLong(v)) #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 #define rank(var) var ## _Rank #define shape(var,dim) var ## _Dims[dim] #define old_rank(var) (PyArray_NDIM((PyArrayObject *)(capi_ ## var ## _tmp))) #define old_shape(var,dim) PyArray_DIM(((PyArrayObject *)(capi_ ## var ## _tmp)),dim) #define fshape(var,dim) shape(var,rank(var)-dim-1) #define len(var) shape(var,0) #define flen(var) fshape(var,0) #define old_size(var) PyArray_SIZE((PyArrayObject *)(capi_ ## var ## _tmp)) /* #define index(i) capi_i ## i */ #define slen(var) capi_ ## var ## _len #define size(var, ...) f2py_size((PyArrayObject *)(capi_ ## var ## _tmp), ## __VA_ARGS__, -1) #define CHECKSCALAR(check,tcheck,name,show,var)\ if (!(check)) {\ char errstring[256];\ sprintf(errstring, "%s: "show, "("tcheck") failed for "name, var);\ PyErr_SetString(fitacf_fit_short_error,errstring);\ /*goto capi_fail;*/\ } else #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_WRAPPEDFUNC(f,F) _F2PYWRAP##F #else #define F_WRAPPEDFUNC(f,F) _f2pywrap##f #endif #else #if defined(UPPERCASE_FORTRAN) #define F_WRAPPEDFUNC(f,F) _F2PYWRAP##F##_ #else #define F_WRAPPEDFUNC(f,F) _f2pywrap##f##_ #endif #endif #else #if defined(NO_APPEND_FORTRAN) #if defined(UPPERCASE_FORTRAN) #define F_WRAPPEDFUNC(f,F) F2PYWRAP##F #else #define F_WRAPPEDFUNC(f,F) f2pywrap##f #endif #else #if defined(UPPERCASE_FORTRAN) #define F_WRAPPEDFUNC(f,F) F2PYWRAP##F##_ #else #define F_WRAPPEDFUNC(f,F) f2pywrap##f##_ #endif #endif #endif #if defined(UNDERSCORE_G77) #define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f##_,F##_) #else #define F_WRAPPEDFUNC_US(f,F) F_WRAPPEDFUNC(f,F) #endif #define SWAP(a,b,t) {\ t *c;\ c = a;\ a = b;\ b = c;} /************************ See f2py2e/cfuncs.py: cfuncs ************************/ static int double_from_pyobj(double* v,PyObject *obj,const char *errmess) { PyObject* tmp = NULL; if (PyFloat_Check(obj)) { #ifdef __sgi *v = PyFloat_AsDouble(obj); #else *v = PyFloat_AS_DOUBLE(obj); #endif return 1; } tmp = PyNumber_Float(obj); if (tmp) { #ifdef __sgi *v = PyFloat_AsDouble(tmp); #else *v = PyFloat_AS_DOUBLE(tmp); #endif Py_DECREF(tmp); return 1; } if (PyComplex_Check(obj)) tmp = PyObject_GetAttrString(obj,"real"); else if (PyString_Check(obj) || PyUnicode_Check(obj)) /*pass*/; else if (PySequence_Check(obj)) tmp = PySequence_GetItem(obj,0); if (tmp) { PyErr_Clear(); if (double_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} Py_DECREF(tmp); } { PyObject* err = PyErr_Occurred(); if (err==NULL) err = fitacf_fit_short_error; PyErr_SetString(err,errmess); } return 0; } static int f2py_size(PyArrayObject* var, ...) { npy_int sz = 0; npy_int dim; npy_int rank; va_list argp; va_start(argp, var); dim = va_arg(argp, npy_int); if (dim==-1) { sz = PyArray_SIZE(var); } else { rank = PyArray_NDIM(var); if (dim>=1 && dim<=rank) sz = PyArray_DIM(var, dim-1); else fprintf(stderr, "f2py_size: 2nd argument value=%d fails to satisfy 1<=value<=%d. Result will be 0.\n", dim, rank); } va_end(argp); return sz; } static int float_from_pyobj(float* v,PyObject *obj,const char *errmess) { double d=0.0; if (double_from_pyobj(&d,obj,errmess)) { *v = (float)d; return 1; } return 0; } static int int_from_pyobj(int* v,PyObject *obj,const char *errmess) { PyObject* tmp = NULL; if (PyInt_Check(obj)) { *v = (int)PyInt_AS_LONG(obj); return 1; } tmp = PyNumber_Int(obj); if (tmp) { *v = PyInt_AS_LONG(tmp); Py_DECREF(tmp); return 1; } if (PyComplex_Check(obj)) tmp = PyObject_GetAttrString(obj,"real"); else if (PyString_Check(obj) || PyUnicode_Check(obj)) /*pass*/; else if (PySequence_Check(obj)) tmp = PySequence_GetItem(obj,0); if (tmp) { PyErr_Clear(); if (int_from_pyobj(v,tmp,errmess)) {Py_DECREF(tmp); return 1;} Py_DECREF(tmp); } { PyObject* err = PyErr_Occurred(); if (err==NULL) err = fitacf_fit_short_error; PyErr_SetString(err,errmess); } return 0; } static int create_cb_arglist(PyObject* fun,PyTupleObject* xa,const int maxnofargs,const int nofoptargs,int *nofargs,PyTupleObject **args,const char *errmess) { PyObject *tmp = NULL; PyObject *tmp_fun = NULL; int tot,opt,ext,siz,i,di=0; CFUNCSMESS("create_cb_arglist\n"); tot=opt=ext=siz=0; /* Get the total number of arguments */ if (PyFunction_Check(fun)) { tmp_fun = fun; Py_INCREF(tmp_fun); } else { di = 1; if (PyObject_HasAttrString(fun,"im_func")) { tmp_fun = PyObject_GetAttrString(fun,"im_func"); } else if (PyObject_HasAttrString(fun,"__call__")) { tmp = PyObject_GetAttrString(fun,"__call__"); if (PyObject_HasAttrString(tmp,"im_func")) tmp_fun = PyObject_GetAttrString(tmp,"im_func"); else { tmp_fun = fun; /* built-in function */ Py_INCREF(tmp_fun); tot = maxnofargs; if (PyCFunction_Check(fun)) { /* In case the function has a co_argcount (like on PyPy) */ di = 0; } if (xa != NULL) tot += PyTuple_Size((PyObject *)xa); } Py_XDECREF(tmp); } else if (PyFortran_Check(fun) || PyFortran_Check1(fun)) { tot = maxnofargs; if (xa != NULL) tot += PyTuple_Size((PyObject *)xa); tmp_fun = fun; Py_INCREF(tmp_fun); } else if (F2PyCapsule_Check(fun)) { tot = maxnofargs; if (xa != NULL) ext = PyTuple_Size((PyObject *)xa); if(ext>0) { fprintf(stderr,"extra arguments tuple cannot be used with CObject call-back\n"); goto capi_fail; } tmp_fun = fun; Py_INCREF(tmp_fun); } } if (tmp_fun==NULL) { fprintf(stderr,"Call-back argument must be function|instance|instance.__call__|f2py-function but got %s.\n",(fun==NULL?"NULL":Py_TYPE(fun)->tp_name)); goto capi_fail; } if (PyObject_HasAttrString(tmp_fun,"__code__")) { if (PyObject_HasAttrString(tmp = PyObject_GetAttrString(tmp_fun,"__code__"),"co_argcount")) { PyObject *tmp_argcount = PyObject_GetAttrString(tmp,"co_argcount"); Py_DECREF(tmp); if (tmp_argcount == NULL) { goto capi_fail; } tot = PyInt_AsLong(tmp_argcount) - di; Py_DECREF(tmp_argcount); } } /* Get the number of optional arguments */ if (PyObject_HasAttrString(tmp_fun,"__defaults__")) { if (PyTuple_Check(tmp = PyObject_GetAttrString(tmp_fun,"__defaults__"))) opt = PyTuple_Size(tmp); Py_XDECREF(tmp); } /* Get the number of extra arguments */ if (xa != NULL) ext = PyTuple_Size((PyObject *)xa); /* Calculate the size of call-backs argument list */ siz = MIN(maxnofargs+ext,tot); *nofargs = MAX(0,siz-ext); #ifdef DEBUGCFUNCS fprintf(stderr,"debug-capi:create_cb_arglist:maxnofargs(-nofoptargs),tot,opt,ext,siz,nofargs=%d(-%d),%d,%d,%d,%d,%d\n",maxnofargs,nofoptargs,tot,opt,ext,siz,*nofargs); #endif if (sizcapi_i) { int itemsize_ = NPY_FLOAT == NPY_STRING ? 1 : 0; /*XXX: Hmm, what will destroy this array??? */ PyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,1,x_Dims,NPY_FLOAT,NULL,(char*)x,itemsize_,NPY_ARRAY_FARRAY,NULL); if (tmp_arr==NULL) goto capi_fail; if (CAPI_ARGLIST_SETITEM(capi_i++,(PyObject *)tmp_arr)) goto capi_fail; } if (cb_fcn_in_lmdif__user__routines_nofargs>capi_i) { int itemsize_ = NPY_FLOAT == NPY_STRING ? 1 : 0; /*XXX: Hmm, what will destroy this array??? */ PyArrayObject *tmp_arr = (PyArrayObject *)PyArray_New(&PyArray_Type,1,fvec_Dims,NPY_FLOAT,NULL,(char*)fvec,itemsize_,NPY_ARRAY_FARRAY,NULL); if (tmp_arr==NULL) goto capi_fail; if (CAPI_ARGLIST_SETITEM(capi_i++,(PyObject *)tmp_arr)) goto capi_fail; } if (cb_fcn_in_lmdif__user__routines_nofargs>capi_i) if (CAPI_ARGLIST_SETITEM(capi_i++,pyobj_from_int1(iflag))) goto capi_fail; if (cb_fcn_in_lmdif__user__routines_nofargs>capi_i) if (CAPI_ARGLIST_SETITEM(capi_i++,pyobj_from_int1(m))) goto capi_fail; if (cb_fcn_in_lmdif__user__routines_nofargs>capi_i) if (CAPI_ARGLIST_SETITEM(capi_i++,pyobj_from_int1(n))) goto capi_fail; #undef CAPI_ARGLIST_SETITEM #ifdef PYPY_VERSION CFUNCSMESSPY("cb:capi_arglist=",capi_arglist_list); #else CFUNCSMESSPY("cb:capi_arglist=",capi_arglist); #endif CFUNCSMESS("cb:Call-back calling Python function fcn.\n"); #ifdef F2PY_REPORT_ATEXIT f2py_cb_start_call_clock(); #endif #ifdef PYPY_VERSION capi_return = PyObject_CallObject(cb_fcn_in_lmdif__user__routines_capi,(PyObject *)capi_arglist_list); Py_DECREF(capi_arglist_list); capi_arglist_list = NULL; #else capi_return = PyObject_CallObject(cb_fcn_in_lmdif__user__routines_capi,(PyObject *)capi_arglist); #endif #ifdef F2PY_REPORT_ATEXIT f2py_cb_stop_call_clock(); #endif CFUNCSMESSPY("cb:capi_return=",capi_return); if (capi_return == NULL) { fprintf(stderr,"capi_return is NULL\n"); goto capi_fail; } if (capi_return == Py_None) { Py_DECREF(capi_return); capi_return = Py_BuildValue("()"); } else if (!PyTuple_Check(capi_return)) { capi_return = Py_BuildValue("(N)",capi_return); } capi_j = PyTuple_Size(capi_return); capi_i = 0; /*frompyobj*/ CFUNCSMESS("cb:cb_fcn_in_lmdif__user__routines:successful\n"); Py_DECREF(capi_return); #ifdef F2PY_REPORT_ATEXIT f2py_cb_stop_clock(); #endif goto capi_return_pt; capi_fail: fprintf(stderr,"Call-back cb_fcn_in_lmdif__user__routines failed.\n"); Py_XDECREF(capi_return); Py_XDECREF(capi_arglist_list); if (capi_longjmp_ok) longjmp(cb_fcn_in_lmdif__user__routines_jmpbuf,-1); capi_return_pt: ; return; } /******************* end of cb_fcn_in_lmdif__user__routines *******************/ /*********************** See f2py2e/rules.py: buildapi ***********************/ /************************************ fit ************************************/ static char doc_f2py_rout_fitacf_fit_short_fit[] = "\ cinv,sigma2p,paramp,ebp,ist = fit(wl,taup,rhop,covar,cinv,sigma2p,paramp,bfldp,alphap,densp,alt,time,ifitp,ist,[nl])\n\nWrapper for ``fit``.\ \n\nParameters\n----------\n" "wl : input float\n" "taup : input rank-1 array('f') with bounds (nl)\n" "rhop : input rank-1 array('f') with bounds (nl)\n" "covar : input rank-2 array('f') with bounds (nl,nl)\n" "cinv : input rank-2 array('f') with bounds (nl,nl)\n" "sigma2p : input rank-1 array('f') with bounds (nl)\n" "paramp : input rank-1 array('f') with bounds (10)\n" "bfldp : input float\n" "alphap : input float\n" "densp : input float\n" "alt : input float\n" "time : input float\n" "ifitp : input rank-1 array('i') with bounds (10)\n" "ist : input int\n" "\nOther Parameters\n----------------\n" "nl : input int, optional\n Default: len(taup)\n" "\nReturns\n-------\n" "cinv : rank-2 array('f') with bounds (nl,nl)\n" "sigma2p : rank-1 array('f') with bounds (nl)\n" "paramp : rank-1 array('f') with bounds (10)\n" "ebp : rank-1 array('f') with bounds (10)\n" "ist : int"; /* extern void F_FUNC(fit,FIT)(float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,int*,int*,int*); */ static PyObject *f2py_rout_fitacf_fit_short_fit(const PyObject *capi_self, PyObject *capi_args, PyObject *capi_keywds, void (*f2py_func)(float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,float*,int*,int*,int*)) { PyObject * volatile capi_buildvalue = NULL; volatile int f2py_success = 1; /*decl*/ float wl = 0; PyObject *wl_capi = Py_None; float *taup = NULL; npy_intp taup_Dims[1] = {-1}; const int taup_Rank = 1; PyArrayObject *capi_taup_tmp = NULL; int capi_taup_intent = 0; PyObject *taup_capi = Py_None; float *rhop = NULL; npy_intp rhop_Dims[1] = {-1}; const int rhop_Rank = 1; PyArrayObject *capi_rhop_tmp = NULL; int capi_rhop_intent = 0; PyObject *rhop_capi = Py_None; float *covar = NULL; npy_intp covar_Dims[2] = {-1, -1}; const int covar_Rank = 2; PyArrayObject *capi_covar_tmp = NULL; int capi_covar_intent = 0; PyObject *covar_capi = Py_None; float *cinv = NULL; npy_intp cinv_Dims[2] = {-1, -1}; const int cinv_Rank = 2; PyArrayObject *capi_cinv_tmp = NULL; int capi_cinv_intent = 0; PyObject *cinv_capi = Py_None; float *sigma2p = NULL; npy_intp sigma2p_Dims[1] = {-1}; const int sigma2p_Rank = 1; PyArrayObject *capi_sigma2p_tmp = NULL; int capi_sigma2p_intent = 0; PyObject *sigma2p_capi = Py_None; float *paramp = NULL; npy_intp paramp_Dims[1] = {-1}; const int paramp_Rank = 1; PyArrayObject *capi_paramp_tmp = NULL; int capi_paramp_intent = 0; PyObject *paramp_capi = Py_None; float *ebp = NULL; npy_intp ebp_Dims[1] = {-1}; const int ebp_Rank = 1; PyArrayObject *capi_ebp_tmp = NULL; int capi_ebp_intent = 0; float bfldp = 0; PyObject *bfldp_capi = Py_None; float alphap = 0; PyObject *alphap_capi = Py_None; float densp = 0; PyObject *densp_capi = Py_None; float alt = 0; PyObject *alt_capi = Py_None; float time = 0; PyObject *time_capi = Py_None; int *ifitp = NULL; npy_intp ifitp_Dims[1] = {-1}; const int ifitp_Rank = 1; PyArrayObject *capi_ifitp_tmp = NULL; int capi_ifitp_intent = 0; PyObject *ifitp_capi = Py_None; int ist = 0; PyObject *ist_capi = Py_None; int nl = 0; PyObject *nl_capi = Py_None; static char *capi_kwlist[] = {"wl","taup","rhop","covar","cinv","sigma2p","paramp","bfldp","alphap","densp","alt","time","ifitp","ist","nl",NULL}; /*routdebugenter*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_clock(); #endif if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ "OOOOOOOOOOOOOO|O:fitacf_fit_short.fit",\ capi_kwlist,&wl_capi,&taup_capi,&rhop_capi,&covar_capi,&cinv_capi,&sigma2p_capi,¶mp_capi,&bfldp_capi,&alphap_capi,&densp_capi,&alt_capi,&time_capi,&ifitp_capi,&ist_capi,&nl_capi)) return NULL; /*frompyobj*/ /* Processing variable wl */ f2py_success = float_from_pyobj(&wl,wl_capi,"fitacf_fit_short.fit() 1st argument (wl) can't be converted to float"); if (f2py_success) { /* Processing variable taup */ ; capi_taup_intent |= F2PY_INTENT_IN; capi_taup_tmp = array_from_pyobj(NPY_FLOAT,taup_Dims,taup_Rank,capi_taup_intent,taup_capi); if (capi_taup_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 2nd argument `taup' of fitacf_fit_short.fit to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { taup = (float *)(PyArray_DATA(capi_taup_tmp)); /* Processing variable paramp */ paramp_Dims[0]=10; capi_paramp_intent |= F2PY_INTENT_IN|F2PY_INTENT_OUT; capi_paramp_tmp = array_from_pyobj(NPY_FLOAT,paramp_Dims,paramp_Rank,capi_paramp_intent,paramp_capi); if (capi_paramp_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 7th argument `paramp' of fitacf_fit_short.fit to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { paramp = (float *)(PyArray_DATA(capi_paramp_tmp)); /* Processing variable ebp */ ebp_Dims[0]=10; capi_ebp_intent |= F2PY_INTENT_OUT|F2PY_INTENT_HIDE; capi_ebp_tmp = array_from_pyobj(NPY_FLOAT,ebp_Dims,ebp_Rank,capi_ebp_intent,Py_None); if (capi_ebp_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting hidden `ebp' of fitacf_fit_short.fit to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { ebp = (float *)(PyArray_DATA(capi_ebp_tmp)); /* Processing variable bfldp */ f2py_success = float_from_pyobj(&bfldp,bfldp_capi,"fitacf_fit_short.fit() 8th argument (bfldp) can't be converted to float"); if (f2py_success) { /* Processing variable alphap */ f2py_success = float_from_pyobj(&alphap,alphap_capi,"fitacf_fit_short.fit() 9th argument (alphap) can't be converted to float"); if (f2py_success) { /* Processing variable densp */ f2py_success = float_from_pyobj(&densp,densp_capi,"fitacf_fit_short.fit() 10th argument (densp) can't be converted to float"); if (f2py_success) { /* Processing variable alt */ f2py_success = float_from_pyobj(&alt,alt_capi,"fitacf_fit_short.fit() 11st argument (alt) can't be converted to float"); if (f2py_success) { /* Processing variable time */ f2py_success = float_from_pyobj(&time,time_capi,"fitacf_fit_short.fit() 12nd argument (time) can't be converted to float"); if (f2py_success) { /* Processing variable ifitp */ ifitp_Dims[0]=10; capi_ifitp_intent |= F2PY_INTENT_IN; capi_ifitp_tmp = array_from_pyobj(NPY_INT,ifitp_Dims,ifitp_Rank,capi_ifitp_intent,ifitp_capi); if (capi_ifitp_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 13rd argument `ifitp' of fitacf_fit_short.fit to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { ifitp = (int *)(PyArray_DATA(capi_ifitp_tmp)); /* Processing variable ist */ f2py_success = int_from_pyobj(&ist,ist_capi,"fitacf_fit_short.fit() 14th argument (ist) can't be converted to int"); if (f2py_success) { /* Processing variable nl */ if (nl_capi == Py_None) nl = len(taup); else f2py_success = int_from_pyobj(&nl,nl_capi,"fitacf_fit_short.fit() 1st keyword (nl) can't be converted to int"); if (f2py_success) { CHECKSCALAR(len(taup)>=nl,"len(taup)>=nl","1st keyword nl","fit:nl=%d",nl) { /* Processing variable rhop */ rhop_Dims[0]=nl; capi_rhop_intent |= F2PY_INTENT_IN; capi_rhop_tmp = array_from_pyobj(NPY_FLOAT,rhop_Dims,rhop_Rank,capi_rhop_intent,rhop_capi); if (capi_rhop_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 3rd argument `rhop' of fitacf_fit_short.fit to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { rhop = (float *)(PyArray_DATA(capi_rhop_tmp)); /* Processing variable covar */ covar_Dims[0]=nl,covar_Dims[1]=nl; capi_covar_intent |= F2PY_INTENT_IN; capi_covar_tmp = array_from_pyobj(NPY_FLOAT,covar_Dims,covar_Rank,capi_covar_intent,covar_capi); if (capi_covar_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 4th argument `covar' of fitacf_fit_short.fit to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { covar = (float *)(PyArray_DATA(capi_covar_tmp)); /* Processing variable cinv */ cinv_Dims[0]=nl,cinv_Dims[1]=nl; capi_cinv_intent |= F2PY_INTENT_IN|F2PY_INTENT_OUT; capi_cinv_tmp = array_from_pyobj(NPY_FLOAT,cinv_Dims,cinv_Rank,capi_cinv_intent,cinv_capi); if (capi_cinv_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 5th argument `cinv' of fitacf_fit_short.fit to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { cinv = (float *)(PyArray_DATA(capi_cinv_tmp)); /* Processing variable sigma2p */ sigma2p_Dims[0]=nl; capi_sigma2p_intent |= F2PY_INTENT_IN|F2PY_INTENT_OUT; capi_sigma2p_tmp = array_from_pyobj(NPY_FLOAT,sigma2p_Dims,sigma2p_Rank,capi_sigma2p_intent,sigma2p_capi); if (capi_sigma2p_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 6th argument `sigma2p' of fitacf_fit_short.fit to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { sigma2p = (float *)(PyArray_DATA(capi_sigma2p_tmp)); /*end of frompyobj*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_call_clock(); #endif /*callfortranroutine*/ (*f2py_func)(&wl,taup,rhop,covar,cinv,sigma2p,paramp,ebp,&bfldp,&alphap,&densp,&alt,&time,ifitp,&ist,&nl); 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("NNNNi",capi_cinv_tmp,capi_sigma2p_tmp,capi_paramp_tmp,capi_ebp_tmp,ist); /*closepyobjfrom*/ /*end of closepyobjfrom*/ } /*if (f2py_success) after callfortranroutine*/ /*cleanupfrompyobj*/ } /*if (capi_sigma2p_tmp == NULL) ... else of sigma2p*/ /* End of cleaning variable sigma2p */ } /*if (capi_cinv_tmp == NULL) ... else of cinv*/ /* End of cleaning variable cinv */ if((PyObject *)capi_covar_tmp!=covar_capi) { Py_XDECREF(capi_covar_tmp); } } /*if (capi_covar_tmp == NULL) ... else of covar*/ /* End of cleaning variable covar */ if((PyObject *)capi_rhop_tmp!=rhop_capi) { Py_XDECREF(capi_rhop_tmp); } } /*if (capi_rhop_tmp == NULL) ... else of rhop*/ /* End of cleaning variable rhop */ } /*CHECKSCALAR(len(taup)>=nl)*/ } /*if (f2py_success) of nl*/ /* End of cleaning variable nl */ } /*if (f2py_success) of ist*/ /* End of cleaning variable ist */ if((PyObject *)capi_ifitp_tmp!=ifitp_capi) { Py_XDECREF(capi_ifitp_tmp); } } /*if (capi_ifitp_tmp == NULL) ... else of ifitp*/ /* End of cleaning variable ifitp */ } /*if (f2py_success) of time*/ /* End of cleaning variable time */ } /*if (f2py_success) of alt*/ /* End of cleaning variable alt */ } /*if (f2py_success) of densp*/ /* End of cleaning variable densp */ } /*if (f2py_success) of alphap*/ /* End of cleaning variable alphap */ } /*if (f2py_success) of bfldp*/ /* End of cleaning variable bfldp */ } /*if (capi_ebp_tmp == NULL) ... else of ebp*/ /* End of cleaning variable ebp */ } /*if (capi_paramp_tmp == NULL) ... else of paramp*/ /* End of cleaning variable paramp */ if((PyObject *)capi_taup_tmp!=taup_capi) { Py_XDECREF(capi_taup_tmp); } } /*if (capi_taup_tmp == NULL) ... else of taup*/ /* End of cleaning variable taup */ } /*if (f2py_success) of wl*/ /* End of cleaning variable wl */ /*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 fit *********************************/ /*********************************** spect1 ***********************************/ static char doc_f2py_rout_fitacf_fit_short_spect1[] = "\ spect1 = spect1(omega)\n\nWrapper for ``spect1``.\ \n\nParameters\n----------\n" "omega : input float\n" "\nReturns\n-------\n" "spect1 : float"; /* extern void F_WRAPPEDFUNC(spect1,SPECT1)(float*,float*); */ static PyObject *f2py_rout_fitacf_fit_short_spect1(const PyObject *capi_self, PyObject *capi_args, PyObject *capi_keywds, void (*f2py_func)(float*,float*)) { PyObject * volatile capi_buildvalue = NULL; volatile int f2py_success = 1; /*decl*/ float spect1 = 0; float omega = 0; PyObject *omega_capi = Py_None; static char *capi_kwlist[] = {"omega",NULL}; /*routdebugenter*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_clock(); #endif if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ "O|:fitacf_fit_short.spect1",\ capi_kwlist,&omega_capi)) return NULL; /*frompyobj*/ /* Processing variable omega */ f2py_success = float_from_pyobj(&omega,omega_capi,"fitacf_fit_short.spect1() 1st argument (omega) can't be converted to float"); if (f2py_success) { /* Processing variable spect1 */ /*end of frompyobj*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_call_clock(); #endif /*callfortranroutine*/ (*f2py_func)(&spect1,&omega); 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("f",spect1); /*closepyobjfrom*/ /*end of closepyobjfrom*/ } /*if (f2py_success) after callfortranroutine*/ /*cleanupfrompyobj*/ /* End of cleaning variable spect1 */ } /*if (f2py_success) of omega*/ /* End of cleaning variable omega */ /*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 spect1 *******************************/ /*********************************** gaussq ***********************************/ static char doc_f2py_rout_fitacf_fit_short_gaussq[] = "\ gaussq(tau,acf)\n\nWrapper for ``gaussq``.\ \n\nParameters\n----------\n" "tau : input float\n" "acf : input float"; /* extern void F_FUNC(gaussq,GAUSSQ)(float*,float*); */ static PyObject *f2py_rout_fitacf_fit_short_gaussq(const PyObject *capi_self, PyObject *capi_args, PyObject *capi_keywds, void (*f2py_func)(float*,float*)) { PyObject * volatile capi_buildvalue = NULL; volatile int f2py_success = 1; /*decl*/ float tau = 0; PyObject *tau_capi = Py_None; float acf = 0; PyObject *acf_capi = Py_None; static char *capi_kwlist[] = {"tau","acf",NULL}; /*routdebugenter*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_clock(); #endif if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ "OO|:fitacf_fit_short.gaussq",\ capi_kwlist,&tau_capi,&acf_capi)) return NULL; /*frompyobj*/ /* Processing variable tau */ f2py_success = float_from_pyobj(&tau,tau_capi,"fitacf_fit_short.gaussq() 1st argument (tau) can't be converted to float"); if (f2py_success) { /* Processing variable acf */ f2py_success = float_from_pyobj(&acf,acf_capi,"fitacf_fit_short.gaussq() 2nd argument (acf) can't be converted to float"); if (f2py_success) { /*end of frompyobj*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_call_clock(); #endif /*callfortranroutine*/ (*f2py_func)(&tau,&acf); 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(""); /*closepyobjfrom*/ /*end of closepyobjfrom*/ } /*if (f2py_success) after callfortranroutine*/ /*cleanupfrompyobj*/ } /*if (f2py_success) of acf*/ /* End of cleaning variable acf */ } /*if (f2py_success) of tau*/ /* End of cleaning variable tau */ /*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 gaussq *******************************/ /*********************************** lmdif1 ***********************************/ static char doc_f2py_rout_fitacf_fit_short_lmdif1[] = "\ lmdif1(fcn,x,fvec,tol,info,iwa,wa,[m,n,lwa,fcn_extra_args])\n\nWrapper for ``lmdif1``.\ \n\nParameters\n----------\n" "fcn : call-back function\n" "x : input rank-1 array('f') with bounds (n)\n" "fvec : input rank-1 array('f') with bounds (m)\n" "tol : input float\n" "info : input int\n" "iwa : input rank-1 array('i') with bounds (n)\n" "wa : input rank-1 array('f') with bounds (lwa)\n" "\nOther Parameters\n----------------\n" "fcn_extra_args : input tuple, optional\n Default: ()\n" "m : input int, optional\n Default: len(fvec)\n" "n : input int, optional\n Default: len(x)\n" "lwa : input int, optional\n Default: len(wa)\n" "\nNotes\n-----\nCall-back functions::\n\n" " def fcn(x,fvec,iflag,[m,n]): return \n\ Required arguments:\n" " x : input rank-1 array('f') with bounds (n)\n" " fvec : input rank-1 array('f') with bounds (m)\n" " iflag : input int\n" " Optional arguments:\n" " m : input int, optional\n Default: len(fvec)\n" " n : input int, optional\n Default: len(x)"; /* extern void F_FUNC(lmdif1,LMDIF1)(cb_fcn_in_lmdif__user__routines_typedef,int*,int*,float*,float*,float*,int*,int*,float*,int*); */ static PyObject *f2py_rout_fitacf_fit_short_lmdif1(const PyObject *capi_self, PyObject *capi_args, PyObject *capi_keywds, void (*f2py_func)(cb_fcn_in_lmdif__user__routines_typedef,int*,int*,float*,float*,float*,int*,int*,float*,int*)) { PyObject * volatile capi_buildvalue = NULL; volatile int f2py_success = 1; /*decl*/ PyObject *fcn_capi = Py_None; PyTupleObject *fcn_xa_capi = NULL; PyTupleObject *fcn_args_capi = NULL; int fcn_nofargs_capi = 0; cb_fcn_in_lmdif__user__routines_typedef fcn_cptr; int m = 0; PyObject *m_capi = Py_None; int n = 0; PyObject *n_capi = Py_None; float *x = NULL; npy_intp x_Dims[1] = {-1}; const int x_Rank = 1; PyArrayObject *capi_x_tmp = NULL; int capi_x_intent = 0; PyObject *x_capi = Py_None; float *fvec = NULL; npy_intp fvec_Dims[1] = {-1}; const int fvec_Rank = 1; PyArrayObject *capi_fvec_tmp = NULL; int capi_fvec_intent = 0; PyObject *fvec_capi = Py_None; float tol = 0; PyObject *tol_capi = Py_None; int info = 0; PyObject *info_capi = Py_None; int *iwa = NULL; npy_intp iwa_Dims[1] = {-1}; const int iwa_Rank = 1; PyArrayObject *capi_iwa_tmp = NULL; int capi_iwa_intent = 0; PyObject *iwa_capi = Py_None; float *wa = NULL; npy_intp wa_Dims[1] = {-1}; const int wa_Rank = 1; PyArrayObject *capi_wa_tmp = NULL; int capi_wa_intent = 0; PyObject *wa_capi = Py_None; int lwa = 0; PyObject *lwa_capi = Py_None; static char *capi_kwlist[] = {"fcn","x","fvec","tol","info","iwa","wa","m","n","lwa","fcn_extra_args",NULL}; /*routdebugenter*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_clock(); #endif if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ "OOOOOOO|OOOO!:fitacf_fit_short.lmdif1",\ capi_kwlist,&fcn_capi,&x_capi,&fvec_capi,&tol_capi,&info_capi,&iwa_capi,&wa_capi,&m_capi,&n_capi,&lwa_capi,&PyTuple_Type,&fcn_xa_capi)) return NULL; /*frompyobj*/ /* Processing variable fcn */ if(F2PyCapsule_Check(fcn_capi)) { fcn_cptr = F2PyCapsule_AsVoidPtr(fcn_capi); } else { fcn_cptr = cb_fcn_in_lmdif__user__routines; } fcn_nofargs_capi = cb_fcn_in_lmdif__user__routines_nofargs; if (create_cb_arglist(fcn_capi,fcn_xa_capi,5,2,&cb_fcn_in_lmdif__user__routines_nofargs,&fcn_args_capi,"failed in processing argument list for call-back fcn.")) { jmp_buf fcn_jmpbuf; CFUNCSMESS("Saving jmpbuf for `fcn`.\n"); SWAP(fcn_capi,cb_fcn_in_lmdif__user__routines_capi,PyObject); SWAP(fcn_args_capi,cb_fcn_in_lmdif__user__routines_args_capi,PyTupleObject); memcpy(&fcn_jmpbuf,&cb_fcn_in_lmdif__user__routines_jmpbuf,sizeof(jmp_buf)); /* Processing variable x */ ; capi_x_intent |= F2PY_INTENT_IN; capi_x_tmp = array_from_pyobj(NPY_FLOAT,x_Dims,x_Rank,capi_x_intent,x_capi); if (capi_x_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 2nd argument `x' of fitacf_fit_short.lmdif1 to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { x = (float *)(PyArray_DATA(capi_x_tmp)); /* Processing variable fvec */ ; capi_fvec_intent |= F2PY_INTENT_IN; capi_fvec_tmp = array_from_pyobj(NPY_FLOAT,fvec_Dims,fvec_Rank,capi_fvec_intent,fvec_capi); if (capi_fvec_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 3rd argument `fvec' of fitacf_fit_short.lmdif1 to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { fvec = (float *)(PyArray_DATA(capi_fvec_tmp)); /* Processing variable tol */ f2py_success = float_from_pyobj(&tol,tol_capi,"fitacf_fit_short.lmdif1() 4th argument (tol) can't be converted to float"); if (f2py_success) { /* Processing variable info */ f2py_success = int_from_pyobj(&info,info_capi,"fitacf_fit_short.lmdif1() 5th argument (info) can't be converted to int"); if (f2py_success) { /* Processing variable wa */ ; capi_wa_intent |= F2PY_INTENT_IN; capi_wa_tmp = array_from_pyobj(NPY_FLOAT,wa_Dims,wa_Rank,capi_wa_intent,wa_capi); if (capi_wa_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 7th argument `wa' of fitacf_fit_short.lmdif1 to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { wa = (float *)(PyArray_DATA(capi_wa_tmp)); /* Processing variable m */ if (m_capi == Py_None) m = len(fvec); else f2py_success = int_from_pyobj(&m,m_capi,"fitacf_fit_short.lmdif1() 1st keyword (m) can't be converted to int"); if (f2py_success) { CHECKSCALAR(len(fvec)>=m,"len(fvec)>=m","1st keyword m","lmdif1:m=%d",m) { /* Processing variable n */ if (n_capi == Py_None) n = len(x); else f2py_success = int_from_pyobj(&n,n_capi,"fitacf_fit_short.lmdif1() 2nd keyword (n) can't be converted to int"); if (f2py_success) { CHECKSCALAR(len(x)>=n,"len(x)>=n","2nd keyword n","lmdif1:n=%d",n) { /* Processing variable iwa */ iwa_Dims[0]=n; capi_iwa_intent |= F2PY_INTENT_IN; capi_iwa_tmp = array_from_pyobj(NPY_INT,iwa_Dims,iwa_Rank,capi_iwa_intent,iwa_capi); if (capi_iwa_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 6th argument `iwa' of fitacf_fit_short.lmdif1 to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { iwa = (int *)(PyArray_DATA(capi_iwa_tmp)); /* Processing variable lwa */ if (lwa_capi == Py_None) lwa = len(wa); else f2py_success = int_from_pyobj(&lwa,lwa_capi,"fitacf_fit_short.lmdif1() 3rd keyword (lwa) can't be converted to int"); if (f2py_success) { CHECKSCALAR(len(wa)>=lwa,"len(wa)>=lwa","3rd keyword lwa","lmdif1:lwa=%d",lwa) { /*end of frompyobj*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_call_clock(); #endif /*callfortranroutine*/ if ((setjmp(cb_fcn_in_lmdif__user__routines_jmpbuf))) { f2py_success = 0; } else { (*f2py_func)(fcn_cptr,&m,&n,x,fvec,&tol,&info,iwa,wa,&lwa); } 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(""); /*closepyobjfrom*/ /*end of closepyobjfrom*/ } /*if (f2py_success) after callfortranroutine*/ /*cleanupfrompyobj*/ } /*CHECKSCALAR(len(wa)>=lwa)*/ } /*if (f2py_success) of lwa*/ /* End of cleaning variable lwa */ if((PyObject *)capi_iwa_tmp!=iwa_capi) { Py_XDECREF(capi_iwa_tmp); } } /*if (capi_iwa_tmp == NULL) ... else of iwa*/ /* End of cleaning variable iwa */ } /*CHECKSCALAR(len(x)>=n)*/ } /*if (f2py_success) of n*/ /* End of cleaning variable n */ } /*CHECKSCALAR(len(fvec)>=m)*/ } /*if (f2py_success) of m*/ /* End of cleaning variable m */ if((PyObject *)capi_wa_tmp!=wa_capi) { Py_XDECREF(capi_wa_tmp); } } /*if (capi_wa_tmp == NULL) ... else of wa*/ /* End of cleaning variable wa */ } /*if (f2py_success) of info*/ /* End of cleaning variable info */ } /*if (f2py_success) of tol*/ /* End of cleaning variable tol */ if((PyObject *)capi_fvec_tmp!=fvec_capi) { Py_XDECREF(capi_fvec_tmp); } } /*if (capi_fvec_tmp == NULL) ... else of fvec*/ /* End of cleaning variable fvec */ if((PyObject *)capi_x_tmp!=x_capi) { Py_XDECREF(capi_x_tmp); } } /*if (capi_x_tmp == NULL) ... else of x*/ /* End of cleaning variable x */ CFUNCSMESS("Restoring jmpbuf for `fcn`.\n"); cb_fcn_in_lmdif__user__routines_capi = fcn_capi; Py_DECREF(cb_fcn_in_lmdif__user__routines_args_capi); cb_fcn_in_lmdif__user__routines_args_capi = fcn_args_capi; cb_fcn_in_lmdif__user__routines_nofargs = fcn_nofargs_capi; memcpy(&cb_fcn_in_lmdif__user__routines_jmpbuf,&fcn_jmpbuf,sizeof(jmp_buf)); } /* End of cleaning variable fcn */ /*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 lmdif1 *******************************/ /*********************************** lmdif ***********************************/ static char doc_f2py_rout_fitacf_fit_short_lmdif[] = "\ lmdif(fcn,x,fvec,ftol,xtol,gtol,maxfev,epsfcn,diag,mode,factor,nprint,info,nfev,fjac,ipvt,qtf,wa1,wa2,wa3,wa4,[m,n,ldfjac,fcn_extra_args])\n\nWrapper for ``lmdif``.\ \n\nParameters\n----------\n" "fcn : call-back function\n" "x : input rank-1 array('f') with bounds (n)\n" "fvec : input rank-1 array('f') with bounds (m)\n" "ftol : input float\n" "xtol : input float\n" "gtol : input float\n" "maxfev : input int\n" "epsfcn : input float\n" "diag : input rank-1 array('f') with bounds (n)\n" "mode : input int\n" "factor : input float\n" "nprint : input int\n" "info : input int\n" "nfev : input int\n" "fjac : input rank-2 array('f') with bounds (ldfjac,n)\n" "ipvt : input rank-1 array('i') with bounds (n)\n" "qtf : input rank-1 array('f') with bounds (n)\n" "wa1 : input rank-1 array('f') with bounds (n)\n" "wa2 : input rank-1 array('f') with bounds (n)\n" "wa3 : input rank-1 array('f') with bounds (n)\n" "wa4 : input rank-1 array('f') with bounds (m)\n" "\nOther Parameters\n----------------\n" "fcn_extra_args : input tuple, optional\n Default: ()\n" "m : input int, optional\n Default: len(fvec)\n" "n : input int, optional\n Default: len(x)\n" "ldfjac : input int, optional\n Default: shape(fjac,0)\n" "\nNotes\n-----\nCall-back functions::\n\n" " def fcn(x,fvec,iflag,[m,n]): return \n\ Required arguments:\n" " x : input rank-1 array('f') with bounds (n)\n" " fvec : input rank-1 array('f') with bounds (m)\n" " iflag : input int\n" " Optional arguments:\n" " m : input int, optional\n Default: len(fvec)\n" " n : input int, optional\n Default: len(x)"; /* extern void F_FUNC(lmdif,LMDIF)(cb_fcn_in_lmdif__user__routines_typedef,int*,int*,float*,float*,float*,float*,float*,int*,float*,float*,int*,float*,int*,int*,int*,float*,int*,int*,float*,float*,float*,float*,float*); */ static PyObject *f2py_rout_fitacf_fit_short_lmdif(const PyObject *capi_self, PyObject *capi_args, PyObject *capi_keywds, void (*f2py_func)(cb_fcn_in_lmdif__user__routines_typedef,int*,int*,float*,float*,float*,float*,float*,int*,float*,float*,int*,float*,int*,int*,int*,float*,int*,int*,float*,float*,float*,float*,float*)) { PyObject * volatile capi_buildvalue = NULL; volatile int f2py_success = 1; /*decl*/ PyObject *fcn_capi = Py_None; PyTupleObject *fcn_xa_capi = NULL; PyTupleObject *fcn_args_capi = NULL; int fcn_nofargs_capi = 0; cb_fcn_in_lmdif__user__routines_typedef fcn_cptr; int m = 0; PyObject *m_capi = Py_None; int n = 0; PyObject *n_capi = Py_None; float *x = NULL; npy_intp x_Dims[1] = {-1}; const int x_Rank = 1; PyArrayObject *capi_x_tmp = NULL; int capi_x_intent = 0; PyObject *x_capi = Py_None; float *fvec = NULL; npy_intp fvec_Dims[1] = {-1}; const int fvec_Rank = 1; PyArrayObject *capi_fvec_tmp = NULL; int capi_fvec_intent = 0; PyObject *fvec_capi = Py_None; float ftol = 0; PyObject *ftol_capi = Py_None; float xtol = 0; PyObject *xtol_capi = Py_None; float gtol = 0; PyObject *gtol_capi = Py_None; int maxfev = 0; PyObject *maxfev_capi = Py_None; float epsfcn = 0; PyObject *epsfcn_capi = Py_None; float *diag = NULL; npy_intp diag_Dims[1] = {-1}; const int diag_Rank = 1; PyArrayObject *capi_diag_tmp = NULL; int capi_diag_intent = 0; PyObject *diag_capi = Py_None; int mode = 0; PyObject *mode_capi = Py_None; float factor = 0; PyObject *factor_capi = Py_None; int nprint = 0; PyObject *nprint_capi = Py_None; int info = 0; PyObject *info_capi = Py_None; int nfev = 0; PyObject *nfev_capi = Py_None; float *fjac = NULL; npy_intp fjac_Dims[2] = {-1, -1}; const int fjac_Rank = 2; PyArrayObject *capi_fjac_tmp = NULL; int capi_fjac_intent = 0; PyObject *fjac_capi = Py_None; int ldfjac = 0; PyObject *ldfjac_capi = Py_None; int *ipvt = NULL; npy_intp ipvt_Dims[1] = {-1}; const int ipvt_Rank = 1; PyArrayObject *capi_ipvt_tmp = NULL; int capi_ipvt_intent = 0; PyObject *ipvt_capi = Py_None; float *qtf = NULL; npy_intp qtf_Dims[1] = {-1}; const int qtf_Rank = 1; PyArrayObject *capi_qtf_tmp = NULL; int capi_qtf_intent = 0; PyObject *qtf_capi = Py_None; float *wa1 = NULL; npy_intp wa1_Dims[1] = {-1}; const int wa1_Rank = 1; PyArrayObject *capi_wa1_tmp = NULL; int capi_wa1_intent = 0; PyObject *wa1_capi = Py_None; float *wa2 = NULL; npy_intp wa2_Dims[1] = {-1}; const int wa2_Rank = 1; PyArrayObject *capi_wa2_tmp = NULL; int capi_wa2_intent = 0; PyObject *wa2_capi = Py_None; float *wa3 = NULL; npy_intp wa3_Dims[1] = {-1}; const int wa3_Rank = 1; PyArrayObject *capi_wa3_tmp = NULL; int capi_wa3_intent = 0; PyObject *wa3_capi = Py_None; float *wa4 = NULL; npy_intp wa4_Dims[1] = {-1}; const int wa4_Rank = 1; PyArrayObject *capi_wa4_tmp = NULL; int capi_wa4_intent = 0; PyObject *wa4_capi = Py_None; static char *capi_kwlist[] = {"fcn","x","fvec","ftol","xtol","gtol","maxfev","epsfcn","diag","mode","factor","nprint","info","nfev","fjac","ipvt","qtf","wa1","wa2","wa3","wa4","m","n","ldfjac","fcn_extra_args",NULL}; /*routdebugenter*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_clock(); #endif if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ "OOOOOOOOOOOOOOOOOOOOO|OOOO!:fitacf_fit_short.lmdif",\ capi_kwlist,&fcn_capi,&x_capi,&fvec_capi,&ftol_capi,&xtol_capi,>ol_capi,&maxfev_capi,&epsfcn_capi,&diag_capi,&mode_capi,&factor_capi,&nprint_capi,&info_capi,&nfev_capi,&fjac_capi,&ipvt_capi,&qtf_capi,&wa1_capi,&wa2_capi,&wa3_capi,&wa4_capi,&m_capi,&n_capi,&ldfjac_capi,&PyTuple_Type,&fcn_xa_capi)) return NULL; /*frompyobj*/ /* Processing variable fcn */ if(F2PyCapsule_Check(fcn_capi)) { fcn_cptr = F2PyCapsule_AsVoidPtr(fcn_capi); } else { fcn_cptr = cb_fcn_in_lmdif__user__routines; } fcn_nofargs_capi = cb_fcn_in_lmdif__user__routines_nofargs; if (create_cb_arglist(fcn_capi,fcn_xa_capi,5,2,&cb_fcn_in_lmdif__user__routines_nofargs,&fcn_args_capi,"failed in processing argument list for call-back fcn.")) { jmp_buf fcn_jmpbuf; CFUNCSMESS("Saving jmpbuf for `fcn`.\n"); SWAP(fcn_capi,cb_fcn_in_lmdif__user__routines_capi,PyObject); SWAP(fcn_args_capi,cb_fcn_in_lmdif__user__routines_args_capi,PyTupleObject); memcpy(&fcn_jmpbuf,&cb_fcn_in_lmdif__user__routines_jmpbuf,sizeof(jmp_buf)); /* Processing variable x */ ; capi_x_intent |= F2PY_INTENT_IN; capi_x_tmp = array_from_pyobj(NPY_FLOAT,x_Dims,x_Rank,capi_x_intent,x_capi); if (capi_x_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 2nd argument `x' of fitacf_fit_short.lmdif to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { x = (float *)(PyArray_DATA(capi_x_tmp)); /* Processing variable fvec */ ; capi_fvec_intent |= F2PY_INTENT_IN; capi_fvec_tmp = array_from_pyobj(NPY_FLOAT,fvec_Dims,fvec_Rank,capi_fvec_intent,fvec_capi); if (capi_fvec_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 3rd argument `fvec' of fitacf_fit_short.lmdif to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { fvec = (float *)(PyArray_DATA(capi_fvec_tmp)); /* Processing variable ftol */ f2py_success = float_from_pyobj(&ftol,ftol_capi,"fitacf_fit_short.lmdif() 4th argument (ftol) can't be converted to float"); if (f2py_success) { /* Processing variable xtol */ f2py_success = float_from_pyobj(&xtol,xtol_capi,"fitacf_fit_short.lmdif() 5th argument (xtol) can't be converted to float"); if (f2py_success) { /* Processing variable gtol */ f2py_success = float_from_pyobj(>ol,gtol_capi,"fitacf_fit_short.lmdif() 6th argument (gtol) can't be converted to float"); if (f2py_success) { /* Processing variable maxfev */ f2py_success = int_from_pyobj(&maxfev,maxfev_capi,"fitacf_fit_short.lmdif() 7th argument (maxfev) can't be converted to int"); if (f2py_success) { /* Processing variable epsfcn */ f2py_success = float_from_pyobj(&epsfcn,epsfcn_capi,"fitacf_fit_short.lmdif() 8th argument (epsfcn) can't be converted to float"); if (f2py_success) { /* Processing variable mode */ f2py_success = int_from_pyobj(&mode,mode_capi,"fitacf_fit_short.lmdif() 10th argument (mode) can't be converted to int"); if (f2py_success) { /* Processing variable factor */ f2py_success = float_from_pyobj(&factor,factor_capi,"fitacf_fit_short.lmdif() 11st argument (factor) can't be converted to float"); if (f2py_success) { /* Processing variable nprint */ f2py_success = int_from_pyobj(&nprint,nprint_capi,"fitacf_fit_short.lmdif() 12nd argument (nprint) can't be converted to int"); if (f2py_success) { /* Processing variable info */ f2py_success = int_from_pyobj(&info,info_capi,"fitacf_fit_short.lmdif() 13rd argument (info) can't be converted to int"); if (f2py_success) { /* Processing variable nfev */ f2py_success = int_from_pyobj(&nfev,nfev_capi,"fitacf_fit_short.lmdif() 14th argument (nfev) can't be converted to int"); if (f2py_success) { /* Processing variable m */ if (m_capi == Py_None) m = len(fvec); else f2py_success = int_from_pyobj(&m,m_capi,"fitacf_fit_short.lmdif() 1st keyword (m) can't be converted to int"); if (f2py_success) { CHECKSCALAR(len(fvec)>=m,"len(fvec)>=m","1st keyword m","lmdif:m=%d",m) { /* Processing variable n */ if (n_capi == Py_None) n = len(x); else f2py_success = int_from_pyobj(&n,n_capi,"fitacf_fit_short.lmdif() 2nd keyword (n) can't be converted to int"); if (f2py_success) { CHECKSCALAR(len(x)>=n,"len(x)>=n","2nd keyword n","lmdif:n=%d",n) { /* Processing variable diag */ diag_Dims[0]=n; capi_diag_intent |= F2PY_INTENT_IN; capi_diag_tmp = array_from_pyobj(NPY_FLOAT,diag_Dims,diag_Rank,capi_diag_intent,diag_capi); if (capi_diag_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 9th argument `diag' of fitacf_fit_short.lmdif to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { diag = (float *)(PyArray_DATA(capi_diag_tmp)); /* Processing variable fjac */ fjac_Dims[1]=n; capi_fjac_intent |= F2PY_INTENT_IN; capi_fjac_tmp = array_from_pyobj(NPY_FLOAT,fjac_Dims,fjac_Rank,capi_fjac_intent,fjac_capi); if (capi_fjac_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 15th argument `fjac' of fitacf_fit_short.lmdif to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { fjac = (float *)(PyArray_DATA(capi_fjac_tmp)); /* Processing variable ldfjac */ if (ldfjac_capi == Py_None) ldfjac = shape(fjac,0); else f2py_success = int_from_pyobj(&ldfjac,ldfjac_capi,"fitacf_fit_short.lmdif() 3rd keyword (ldfjac) can't be converted to int"); if (f2py_success) { CHECKSCALAR(shape(fjac,0)==ldfjac,"shape(fjac,0)==ldfjac","3rd keyword ldfjac","lmdif:ldfjac=%d",ldfjac) { /* Processing variable ipvt */ ipvt_Dims[0]=n; capi_ipvt_intent |= F2PY_INTENT_IN; capi_ipvt_tmp = array_from_pyobj(NPY_INT,ipvt_Dims,ipvt_Rank,capi_ipvt_intent,ipvt_capi); if (capi_ipvt_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 16th argument `ipvt' of fitacf_fit_short.lmdif to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { ipvt = (int *)(PyArray_DATA(capi_ipvt_tmp)); /* Processing variable qtf */ qtf_Dims[0]=n; capi_qtf_intent |= F2PY_INTENT_IN; capi_qtf_tmp = array_from_pyobj(NPY_FLOAT,qtf_Dims,qtf_Rank,capi_qtf_intent,qtf_capi); if (capi_qtf_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 17th argument `qtf' of fitacf_fit_short.lmdif to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { qtf = (float *)(PyArray_DATA(capi_qtf_tmp)); /* Processing variable wa1 */ wa1_Dims[0]=n; capi_wa1_intent |= F2PY_INTENT_IN; capi_wa1_tmp = array_from_pyobj(NPY_FLOAT,wa1_Dims,wa1_Rank,capi_wa1_intent,wa1_capi); if (capi_wa1_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 18th argument `wa1' of fitacf_fit_short.lmdif to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { wa1 = (float *)(PyArray_DATA(capi_wa1_tmp)); /* Processing variable wa2 */ wa2_Dims[0]=n; capi_wa2_intent |= F2PY_INTENT_IN; capi_wa2_tmp = array_from_pyobj(NPY_FLOAT,wa2_Dims,wa2_Rank,capi_wa2_intent,wa2_capi); if (capi_wa2_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 19th argument `wa2' of fitacf_fit_short.lmdif to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { wa2 = (float *)(PyArray_DATA(capi_wa2_tmp)); /* Processing variable wa3 */ wa3_Dims[0]=n; capi_wa3_intent |= F2PY_INTENT_IN; capi_wa3_tmp = array_from_pyobj(NPY_FLOAT,wa3_Dims,wa3_Rank,capi_wa3_intent,wa3_capi); if (capi_wa3_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 20th argument `wa3' of fitacf_fit_short.lmdif to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { wa3 = (float *)(PyArray_DATA(capi_wa3_tmp)); /* Processing variable wa4 */ wa4_Dims[0]=m; capi_wa4_intent |= F2PY_INTENT_IN; capi_wa4_tmp = array_from_pyobj(NPY_FLOAT,wa4_Dims,wa4_Rank,capi_wa4_intent,wa4_capi); if (capi_wa4_tmp == NULL) { PyObject *exc, *val, *tb; PyErr_Fetch(&exc, &val, &tb); PyErr_SetString(exc ? exc : fitacf_fit_short_error,"failed in converting 21st argument `wa4' of fitacf_fit_short.lmdif to C/Fortran array" ); npy_PyErr_ChainExceptionsCause(exc, val, tb); } else { wa4 = (float *)(PyArray_DATA(capi_wa4_tmp)); /*end of frompyobj*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_call_clock(); #endif /*callfortranroutine*/ if ((setjmp(cb_fcn_in_lmdif__user__routines_jmpbuf))) { f2py_success = 0; } else { (*f2py_func)(fcn_cptr,&m,&n,x,fvec,&ftol,&xtol,>ol,&maxfev,&epsfcn,diag,&mode,&factor,&nprint,&info,&nfev,fjac,&ldfjac,ipvt,qtf,wa1,wa2,wa3,wa4); } 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(""); /*closepyobjfrom*/ /*end of closepyobjfrom*/ } /*if (f2py_success) after callfortranroutine*/ /*cleanupfrompyobj*/ if((PyObject *)capi_wa4_tmp!=wa4_capi) { Py_XDECREF(capi_wa4_tmp); } } /*if (capi_wa4_tmp == NULL) ... else of wa4*/ /* End of cleaning variable wa4 */ if((PyObject *)capi_wa3_tmp!=wa3_capi) { Py_XDECREF(capi_wa3_tmp); } } /*if (capi_wa3_tmp == NULL) ... else of wa3*/ /* End of cleaning variable wa3 */ if((PyObject *)capi_wa2_tmp!=wa2_capi) { Py_XDECREF(capi_wa2_tmp); } } /*if (capi_wa2_tmp == NULL) ... else of wa2*/ /* End of cleaning variable wa2 */ if((PyObject *)capi_wa1_tmp!=wa1_capi) { Py_XDECREF(capi_wa1_tmp); } } /*if (capi_wa1_tmp == NULL) ... else of wa1*/ /* End of cleaning variable wa1 */ if((PyObject *)capi_qtf_tmp!=qtf_capi) { Py_XDECREF(capi_qtf_tmp); } } /*if (capi_qtf_tmp == NULL) ... else of qtf*/ /* End of cleaning variable qtf */ if((PyObject *)capi_ipvt_tmp!=ipvt_capi) { Py_XDECREF(capi_ipvt_tmp); } } /*if (capi_ipvt_tmp == NULL) ... else of ipvt*/ /* End of cleaning variable ipvt */ } /*CHECKSCALAR(shape(fjac,0)==ldfjac)*/ } /*if (f2py_success) of ldfjac*/ /* End of cleaning variable ldfjac */ if((PyObject *)capi_fjac_tmp!=fjac_capi) { Py_XDECREF(capi_fjac_tmp); } } /*if (capi_fjac_tmp == NULL) ... else of fjac*/ /* End of cleaning variable fjac */ if((PyObject *)capi_diag_tmp!=diag_capi) { Py_XDECREF(capi_diag_tmp); } } /*if (capi_diag_tmp == NULL) ... else of diag*/ /* End of cleaning variable diag */ } /*CHECKSCALAR(len(x)>=n)*/ } /*if (f2py_success) of n*/ /* End of cleaning variable n */ } /*CHECKSCALAR(len(fvec)>=m)*/ } /*if (f2py_success) of m*/ /* End of cleaning variable m */ } /*if (f2py_success) of nfev*/ /* End of cleaning variable nfev */ } /*if (f2py_success) of info*/ /* End of cleaning variable info */ } /*if (f2py_success) of nprint*/ /* End of cleaning variable nprint */ } /*if (f2py_success) of factor*/ /* End of cleaning variable factor */ } /*if (f2py_success) of mode*/ /* End of cleaning variable mode */ } /*if (f2py_success) of epsfcn*/ /* End of cleaning variable epsfcn */ } /*if (f2py_success) of maxfev*/ /* End of cleaning variable maxfev */ } /*if (f2py_success) of gtol*/ /* End of cleaning variable gtol */ } /*if (f2py_success) of xtol*/ /* End of cleaning variable xtol */ } /*if (f2py_success) of ftol*/ /* End of cleaning variable ftol */ if((PyObject *)capi_fvec_tmp!=fvec_capi) { Py_XDECREF(capi_fvec_tmp); } } /*if (capi_fvec_tmp == NULL) ... else of fvec*/ /* End of cleaning variable fvec */ if((PyObject *)capi_x_tmp!=x_capi) { Py_XDECREF(capi_x_tmp); } } /*if (capi_x_tmp == NULL) ... else of x*/ /* End of cleaning variable x */ CFUNCSMESS("Restoring jmpbuf for `fcn`.\n"); cb_fcn_in_lmdif__user__routines_capi = fcn_capi; Py_DECREF(cb_fcn_in_lmdif__user__routines_args_capi); cb_fcn_in_lmdif__user__routines_args_capi = fcn_args_capi; cb_fcn_in_lmdif__user__routines_nofargs = fcn_nofargs_capi; memcpy(&cb_fcn_in_lmdif__user__routines_jmpbuf,&fcn_jmpbuf,sizeof(jmp_buf)); } /* End of cleaning variable fcn */ /*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 lmdif ********************************/ /*********************************** spmpar ***********************************/ static char doc_f2py_rout_fitacf_fit_short_spmpar[] = "\ spmpar = spmpar(i)\n\nWrapper for ``spmpar``.\ \n\nParameters\n----------\n" "i : input int\n" "\nReturns\n-------\n" "spmpar : float"; /* extern void F_WRAPPEDFUNC(spmpar,SPMPAR)(float*,int*); */ static PyObject *f2py_rout_fitacf_fit_short_spmpar(const PyObject *capi_self, PyObject *capi_args, PyObject *capi_keywds, void (*f2py_func)(float*,int*)) { PyObject * volatile capi_buildvalue = NULL; volatile int f2py_success = 1; /*decl*/ float spmpar = 0; int i = 0; PyObject *i_capi = Py_None; static char *capi_kwlist[] = {"i",NULL}; /*routdebugenter*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_clock(); #endif if (!PyArg_ParseTupleAndKeywords(capi_args,capi_keywds,\ "O|:fitacf_fit_short.spmpar",\ capi_kwlist,&i_capi)) return NULL; /*frompyobj*/ /* Processing variable i */ f2py_success = int_from_pyobj(&i,i_capi,"fitacf_fit_short.spmpar() 1st argument (i) can't be converted to int"); if (f2py_success) { /* Processing variable spmpar */ /*end of frompyobj*/ #ifdef F2PY_REPORT_ATEXIT f2py_start_call_clock(); #endif /*callfortranroutine*/ (*f2py_func)(&spmpar,&i); 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("f",spmpar); /*closepyobjfrom*/ /*end of closepyobjfrom*/ } /*if (f2py_success) after callfortranroutine*/ /*cleanupfrompyobj*/ /* End of cleaning variable spmpar */ } /*if (f2py_success) of i*/ /* End of cleaning variable i */ /*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 spmpar *******************************/ /*eof body*/ /******************* See f2py2e/f90mod_rules.py: buildhooks *******************/ /*need_f90modhooks*/ /************** See f2py2e/rules.py: module_rules['modulebody'] **************/ /******************* See f2py2e/common_rules.py: buildhooks *******************/ static FortranDataDef f2py_spec_def[] = { {"te",0,{{-1}},NPY_FLOAT}, {"ti",1,{{10}},NPY_FLOAT}, {"fi",1,{{10}},NPY_FLOAT}, {"ven",0,{{-1}},NPY_FLOAT}, {"vin",1,{{10}},NPY_FLOAT}, {"alpha",0,{{-1}},NPY_FLOAT}, {"dens",0,{{-1}},NPY_FLOAT}, {"bfld",0,{{-1}},NPY_FLOAT}, {"nion",0,{{-1}},NPY_INT}, {"wi",1,{{10}},NPY_INT}, {"ak",0,{{-1}},NPY_FLOAT}, {NULL} }; static void f2py_setup_spec(char *te,char *ti,char *fi,char *ven,char *vin,char *alpha,char *dens,char *bfld,char *nion,char *wi,char *ak) { int i_f2py=0; f2py_spec_def[i_f2py++].data = te; f2py_spec_def[i_f2py++].data = ti; f2py_spec_def[i_f2py++].data = fi; f2py_spec_def[i_f2py++].data = ven; f2py_spec_def[i_f2py++].data = vin; f2py_spec_def[i_f2py++].data = alpha; f2py_spec_def[i_f2py++].data = dens; f2py_spec_def[i_f2py++].data = bfld; f2py_spec_def[i_f2py++].data = nion; f2py_spec_def[i_f2py++].data = wi; f2py_spec_def[i_f2py++].data = ak; } extern void F_FUNC(f2pyinitspec,F2PYINITSPEC)(void(*)(char*,char*,char*,char*,char*,char*,char*,char*,char*,char*,char*)); static void f2py_init_spec(void) { F_FUNC(f2pyinitspec,F2PYINITSPEC)(f2py_setup_spec); } static FortranDataDef f2py_mode_def[] = { {"imode",0,{{-1}},NPY_INT}, {NULL} }; static void f2py_setup_mode(char *imode) { int i_f2py=0; f2py_mode_def[i_f2py++].data = imode; } extern void F_FUNC(f2pyinitmode,F2PYINITMODE)(void(*)(char*)); static void f2py_init_mode(void) { F_FUNC(f2pyinitmode,F2PYINITMODE)(f2py_setup_mode); } static FortranDataDef f2py_fitter_def[] = { {"tau",1,{{100}},NPY_FLOAT}, {"rho",1,{{100}},NPY_FLOAT}, {"sigma2",1,{{100}},NPY_FLOAT}, {"params",1,{{10}},NPY_FLOAT}, {"ifit",1,{{10}},NPY_INT}, {NULL} }; static void f2py_setup_fitter(char *tau,char *rho,char *sigma2,char *params,char *ifit) { int i_f2py=0; f2py_fitter_def[i_f2py++].data = tau; f2py_fitter_def[i_f2py++].data = rho; f2py_fitter_def[i_f2py++].data = sigma2; f2py_fitter_def[i_f2py++].data = params; f2py_fitter_def[i_f2py++].data = ifit; } extern void F_FUNC(f2pyinitfitter,F2PYINITFITTER)(void(*)(char*,char*,char*,char*,char*)); static void f2py_init_fitter(void) { F_FUNC(f2pyinitfitter,F2PYINITFITTER)(f2py_setup_fitter); } static FortranDataDef f2py_trans_def[] = { {"ev",1,{{10000}},NPY_FLOAT}, {NULL} }; static void f2py_setup_trans(char *ev) { int i_f2py=0; f2py_trans_def[i_f2py++].data = ev; } extern void F_FUNC(f2pyinittrans,F2PYINITTRANS)(void(*)(char*)); static void f2py_init_trans(void) { F_FUNC(f2pyinittrans,F2PYINITTRANS)(f2py_setup_trans); } /*need_commonhooks*/ /**************************** See f2py2e/rules.py ****************************/ static FortranDataDef f2py_routine_defs[] = { {"fit",-1,{{-1}},0,(char *)F_FUNC(fit,FIT),(f2py_init_func)f2py_rout_fitacf_fit_short_fit,doc_f2py_rout_fitacf_fit_short_fit}, {"spect1",-1,{{-1}},0,(char *)F_WRAPPEDFUNC(spect1,SPECT1),(f2py_init_func)f2py_rout_fitacf_fit_short_spect1,doc_f2py_rout_fitacf_fit_short_spect1}, {"gaussq",-1,{{-1}},0,(char *)F_FUNC(gaussq,GAUSSQ),(f2py_init_func)f2py_rout_fitacf_fit_short_gaussq,doc_f2py_rout_fitacf_fit_short_gaussq}, {"lmdif1",-1,{{-1}},0,(char *)F_FUNC(lmdif1,LMDIF1),(f2py_init_func)f2py_rout_fitacf_fit_short_lmdif1,doc_f2py_rout_fitacf_fit_short_lmdif1}, {"lmdif",-1,{{-1}},0,(char *)F_FUNC(lmdif,LMDIF),(f2py_init_func)f2py_rout_fitacf_fit_short_lmdif,doc_f2py_rout_fitacf_fit_short_lmdif}, {"spmpar",-1,{{-1}},0,(char *)F_WRAPPEDFUNC(spmpar,SPMPAR),(f2py_init_func)f2py_rout_fitacf_fit_short_spmpar,doc_f2py_rout_fitacf_fit_short_spmpar}, /*eof routine_defs*/ {NULL} }; static PyMethodDef f2py_module_methods[] = { {NULL,NULL} }; static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "fitacf_fit_short", NULL, -1, f2py_module_methods, NULL, NULL, NULL, NULL }; PyMODINIT_FUNC PyInit_fitacf_fit_short(void) { int i; PyObject *m,*d, *s, *tmp; m = fitacf_fit_short_module = PyModule_Create(&moduledef); Py_SET_TYPE(&PyFortran_Type, &PyType_Type); import_array(); if (PyErr_Occurred()) {PyErr_SetString(PyExc_ImportError, "can't initialize module fitacf_fit_short (failed to import numpy)"); return m;} d = PyModule_GetDict(m); s = PyString_FromString("$Revision: $"); PyDict_SetItemString(d, "__version__", s); Py_DECREF(s); s = PyUnicode_FromString( "This module 'fitacf_fit_short' is auto-generated with f2py (version:2).\nFunctions:\n" " cinv,sigma2p,paramp,ebp,ist = fit(wl,taup,rhop,covar,cinv,sigma2p,paramp,bfldp,alphap,densp,alt,time,ifitp,ist,nl=len(taup))\n" " spect1 = spect1(omega)\n" " gaussq(tau,acf)\n" " lmdif1(fcn,x,fvec,tol,info,iwa,wa,m=len(fvec),n=len(x),lwa=len(wa),fcn_extra_args=())\n" " lmdif(fcn,x,fvec,ftol,xtol,gtol,maxfev,epsfcn,diag,mode,factor,nprint,info,nfev,fjac,ipvt,qtf,wa1,wa2,wa3,wa4,m=len(fvec),n=len(x),ldfjac=shape(fjac,0),fcn_extra_args=())\n" " spmpar = spmpar(i)\n" "COMMON blocks:\n"" /spec/ te,ti(10),fi(10),ven,vin(10),alpha,dens,bfld,nion,wi(10),ak\n"" /mode/ imode\n"" /fitter/ tau(100),rho(100),sigma2(100),params(10),ifit(10)\n"" /trans/ ev(10000)\n""."); PyDict_SetItemString(d, "__doc__", s); Py_DECREF(s); fitacf_fit_short_error = PyErr_NewException ("fitacf_fit_short.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, "_fitacf_fit_short_error", fitacf_fit_short_error); Py_DECREF(fitacf_fit_short_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); } { extern float F_FUNC(spect1,SPECT1)(void); PyObject* o = PyDict_GetItemString(d,"spect1"); tmp = F2PyCapsule_FromVoidPtr((void*)F_FUNC(spect1,SPECT1),NULL); PyObject_SetAttrString(o,"_cpointer", tmp); Py_DECREF(tmp); s = PyUnicode_FromString("spect1"); PyObject_SetAttrString(o,"__name__", s); Py_DECREF(s); } { extern float F_FUNC(spmpar,SPMPAR)(void); PyObject* o = PyDict_GetItemString(d,"spmpar"); tmp = F2PyCapsule_FromVoidPtr((void*)F_FUNC(spmpar,SPMPAR),NULL); PyObject_SetAttrString(o,"_cpointer", tmp); Py_DECREF(tmp); s = PyUnicode_FromString("spmpar"); PyObject_SetAttrString(o,"__name__", s); Py_DECREF(s); } /*eof initf2pywraphooks*/ /*eof initf90modhooks*/ tmp = PyFortranObject_New(f2py_spec_def,f2py_init_spec); F2PyDict_SetItemString(d, "spec", tmp); Py_DECREF(tmp); tmp = PyFortranObject_New(f2py_mode_def,f2py_init_mode); F2PyDict_SetItemString(d, "mode", tmp); Py_DECREF(tmp); tmp = PyFortranObject_New(f2py_fitter_def,f2py_init_fitter); F2PyDict_SetItemString(d, "fitter", tmp); Py_DECREF(tmp); tmp = PyFortranObject_New(f2py_trans_def,f2py_init_trans); F2PyDict_SetItemString(d, "trans", tmp); Py_DECREF(tmp); /*eof initcommonhooks*/ #ifdef F2PY_REPORT_ATEXIT if (! PyErr_Occurred()) on_exit(f2py_report_on_exit,(void*)"fitacf_fit_short"); #endif return m; } #ifdef __cplusplus } #endif