1 #include <../../nrnconf.h> 43 #if defined(__cplusplus) 47 extern double praxis(
double* t0,
double*
machep,
double* h0,
48 long int nval,
long int* prin,
double* x,
double(*f)(
double*,
long int),
49 double* fmin,
char* after_quad);
53 #if defined(__cplusplus) 58 extern double chkarg(
int,
double,
double);
70 static double efun(
double*,
long int);
111 double minerrsav, *minargsav, maxstepsizesav, tolerancesav;
112 long int printmodesav, nvarsav;
114 Object* efun_py_save, *efun_py_arg_save;
115 void* vec_py_save_save;
119 double minerr_, *minarg_;
122 Object* efun_py_, *efun_py_arg_;
143 px =
vector_vec(static_cast<IvocVect*>(vec_py_save_));
149 && efun_sym_->
type != FUN_BLTIN)) {
163 minarg_ = (
double*)
ecalloc(nvar_,
sizeof(
double));
165 if (maxstepsize == 0.) {
166 hoc_execerror(
"call attr_praxis first to set attributes", 0);
173 after_quad = (
char*)0;
193 hoc_efun_sym = efun_sym_;
195 efun_py_arg = efun_py_arg_;
196 vec_py_save = vec_py_save_;
200 err =
praxis(&tolerance, &machep, &maxstepsize, nvar, &printmode,
201 px,
efun, &fmin, after_quad);
204 for (i=0; i<
nvar; ++
i) { px[
i] = minarg[
i]; }
210 tolerance = tolerancesav;
211 maxstepsize = maxstepsizesav;
212 printmode = printmodesav;
214 hoc_efun_sym = efun_sym_sav;
215 efun_py = efun_py_save;
216 efun_py_arg = efun_py_arg_save;
217 vec_py_save = vec_py_save_save;
221 for (i=0; i < nvar_; ++
i) {
248 nrn_praxis_ran_index = (
int)
chkarg(1, 0., 1e9);
256 i = (
int)
chkarg(1, 0., (
double)(nvar-1));
268 for (j = 0; j <
nvar; ++
j) {
275 static double efun(
double*
v,
long int n)
281 for (i=0; i <
n; ++
i) {
285 for (i=0; i <
n; ++
i) {
294 if (!stoprun && err < minerr) {
296 for (i=0; i <
n; ++
i) {
double * praxis_paxis(int)
static long int printmode
void * ecalloc(size_t n, size_t size)
void vector_delete(IvocVect *vec)
static double maxstepsize
static void * vec_py_save
void hoc_after_prax_quad(char *s)
Symbol * hoc_lookup(const char *)
void vector_resize(IvocVect *, int)
double * hoc_pgetarg(int narg)
double hoc_call_func(Symbol *s, int narg)
int hoc_is_pdouble_arg(int narg)
int const size_t const size_t n
IvocVect * vector_arg(int)
void hoc_obj_unref(Object *obj)
double praxis(double *t0, double *machep, double *h0, long int nval, long int *prin, double *x, double(*f)(double *, long int), double *fmin, char *after_quad)
void hoc_execerror(const char *, const char *)
static double efun(double *, long int)
void hoc_obj_ref(Object *obj)
Object ** vector_pobj(IvocVect *v)
double(* nrnpy_praxis_efun)(Object *pycallable, Object *hvec)
double chkarg(int, double, double)
int hoc_obj_run(const char *, Object *)
double * vector_vec(IvocVect *)
static Object * efun_py_arg
int vector_capacity(IvocVect *)
void hoc_pushpx(double *d)
int hoc_is_object_arg(int narg)
IvocVect * vector_new2(IvocVect *vec)
Object ** hoc_objgetarg(int)
static Symbol * hoc_efun_sym