Skip to content

Commit

Permalink
updated output during estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
fbaumdicker committed Feb 22, 2018
1 parent 88110f5 commit 5317439
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 7 additions & 1 deletion panicmage.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,19 +542,25 @@ if (skipall_flag == 0) {
else{
//compute the symbolic formula in advance
// do this only once and give the functions to my_f_symbolic
cout << "Initializing the tree structure...\n";
rootTree(intree,NULL);
unprob_symb(intree);
initialize_tree(intree,leaves);
cout << "done.\nComputing probabilities along the tree...\n";
// cout << "We did get past the initialize tree\n";
// check_probs(tree,anzahl,para->rhoS);
comp_pkfhs(intree,leaves,x);
cout << "done.\nEstimation of theta and rho...\n";
// cout << "We computed the probabillties within the tree\n";
// check_probs(tree,anzahl,para->rhoS)
treegfs_symbolic_fast(intree,leaves,theogfs_symb_fast,x);
for(i=0; i<leaves; i++){
paraS->symbolicgfs[i] = theogfs_symb_fast[i];
// printf("\n\n\n\n");
// cout << theogfs_symb_fast[i];
}
// cout << "We successfully called treegfs_symbolic_fast\n";

// cout << "We successfully called treegfs_symbolic_fast\n";
estimate_symbolic(&theta_hat,&rho_hat,paraS);
}
}
Expand Down
16 changes: 9 additions & 7 deletions source/treesymbolic.h
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ void addtogfs(Node *node, int leaves, ex *zeiger, const ex & rhoS, int k){
void treegfs_symbolic_fast(Node *tree, int leaves, ex *gfs_k_symb, const ex & rhoS){
int k;
ex *zeiger;
// printf("called treegfs_symbolic_fast\n");
for(k = 1; k <= leaves; k++){
// printf("%d aus %d\n", k, leaves);
zeiger = &gfs_k_symb[k-1];
Expand Down Expand Up @@ -507,6 +508,7 @@ double my_f_symbolic (const gsl_vector *v, void *params)
float *theogfs_float;
theogfs_float = new float[anzahl];
for (inc = 0; inc < anzahl; inc++){
// printf("%d\n",inc);
theogfs_float[inc] = to_double(ex_to<numeric>(mysymbolicgfs[inc].subs(para->rhoS == rho).evalf()));
}

Expand Down Expand Up @@ -593,7 +595,7 @@ void estimate_symbolic(float *theta_hat, float *rho_hat, Params_symbolic *paraS)
int status;
double size;

// cout << "soweit alles ok\n";
// cout << "so far fine\n";

/*optional set the starting points to a first simple estimate*/

Expand Down Expand Up @@ -651,14 +653,14 @@ void estimate_symbolic(float *theta_hat, float *rho_hat, Params_symbolic *paraS)

if (status == GSL_SUCCESS)
{
// printf ("converged to minimum at\n");
printf("converged to minimum at\n");
}

// printf ("%5d %10.3e %10.3e f() = %7.3f size = %.3f\n",
// iter,
// gsl_vector_get (s->x, 0),
// gsl_vector_get (s->x, 1),
// s->fval, size);
printf ("%5zu %10.3e %10.3e f() = %7.3f size = %.3f\n",
iter,
gsl_vector_get (s->x, 0),
gsl_vector_get (s->x, 1),
s->fval, size);
}
while(status == GSL_CONTINUE && iter < 100);

Expand Down

0 comments on commit 5317439

Please sign in to comment.