static void * thread_entry_point(void *data) { cl_object form = (cl_object)data; /* * This is the entry point of the threads we have created. * These threads have no valid lisp environment. The following * routine initializes the lisp and makes it ready for working * in this thread. */ ecl_import_current_thread(ECL_NIL, ECL_NIL); /* * Here we execute some lisp code code. */ cl_eval(form); /* * Finally, when we exit the thread we have to release the * resources allocated by the lisp environment. */ ecl_release_current_thread(); return NULL; }
int ECL::init() { cl_eval(c_string_to_object("(defun echo (x) x)")); return 0; }
int Criterion(double *value, int* indices, int dim, int n_classes, fx_select_t *sel, char **file_names, int n_splits, cType classifier, char *cparam) { int i, n_feat=-1, j, n_instances=0,n; int *evaluation=NULL, *_eval=NULL; fx_select_t *sel_subset = fx_select_create(sel->n_features); classifier_t *cl = NULL; double val=0; if (ev_verbose) { fprintf(stderr,"Now evaluating subset "); printFset(indices,dim); } j=0; for (i=0; i<sel_subset->n_features && j<dim;i++) { if (sel->selected[i]==1) { n_feat++; if (indices[j]==n_feat) { sel_subset->selected[i]=1; j++; } } } if (j!=dim) { rs_warning("Problem with feature subset selection!"); return -1; } sel_subset->n_selected=dim; for (i=0;i<n_splits*2;i+=2) { char *tmpparam=NULL; if (cparam) { tmpparam=(char *) rs_malloc((strlen(cparam)+1)*sizeof(char),"classifier param"); strcpy(tmpparam,cparam); } cl=cl_new_classifier(classifier,n_classes,sel_subset->n_selected,tmpparam); cl=cl_fscan(cl,classifier,file_names[i],sel_subset); n=cl_classify_file(cl,classifier,file_names[i+1],sel_subset,&_eval); n_instances+=n; if (n_instances-n==0) evaluation=rs_malloc(n_instances*2*sizeof(int),"evaluation data"); else evaluation=rs_realloc(evaluation,n_instances*2*sizeof(int),"evaluation data"); for (j=0;j<n*2;j++) evaluation[j+(n_instances-n)*2]=_eval[j]; rs_free(_eval); if (tmpparam) rs_free(tmpparam); cl_destroy(cl,classifier); } if (evaluation) val=cl_eval(evaluation,n_classes,n_instances); rs_free(evaluation); fx_select_destroy(sel_subset); if (ev_verbose) fprintf(stderr,"... has evaluation %g\n",val); *value=val; return 0; }