void mpl_terminate(MPL *mpl) { if (setjmp(mpl->jump)) xassert(mpl != mpl); switch (mpl->phase) { case 0: case 1: case 2: case 3: /* there were no errors; clean the model content */ clean_model(mpl); xassert(mpl->a_list == NULL); #if 1 /* 11/II-2008 */ xassert(mpl->dca == NULL); #endif break; case 4: /* model processing has been finished due to error; delete search trees, which may be created for some arrays */ { ARRAY *a; for (a = mpl->a_list; a != NULL; a = a->next) if (a->tree != NULL) avl_delete_tree(a->tree); } #if 1 /* 11/II-2008 */ free_dca(mpl); #endif break; default: xassert(mpl != mpl); } /* delete the translator database */ xfree(mpl->image); xfree(mpl->b_image); xfree(mpl->f_image); xfree(mpl->context); dmp_delete_pool(mpl->pool); avl_delete_tree(mpl->tree); dmp_delete_pool(mpl->strings); dmp_delete_pool(mpl->symbols); dmp_delete_pool(mpl->tuples); dmp_delete_pool(mpl->arrays); dmp_delete_pool(mpl->members); dmp_delete_pool(mpl->elemvars); dmp_delete_pool(mpl->formulae); dmp_delete_pool(mpl->elemcons); xfree(mpl->sym_buf); xfree(mpl->tup_buf); rng_delete_rand(mpl->rand); if (mpl->row != NULL) xfree(mpl->row); if (mpl->col != NULL) xfree(mpl->col); if (mpl->in_fp != NULL) xfclose(mpl->in_fp); if (mpl->out_fp != NULL && mpl->out_fp != (void *)stdout) xfclose(mpl->out_fp); if (mpl->out_file != NULL) xfree(mpl->out_file); if (mpl->prt_fp != NULL) xfclose(mpl->prt_fp); if (mpl->prt_file != NULL) xfree(mpl->prt_file); if (mpl->mod_file != NULL) xfree(mpl->mod_file); xfree(mpl->mpl_buf); xfree(mpl); return; }
void LargeVis::run(long long out_d, long long n_thre, long long n_samp, long long n_prop, real alph, long long n_tree, long long n_nega, long long n_neig, real gamm, real perp) { gsl_rng_env_setup(); gsl_T = gsl_rng_rand48; gsl_r = gsl_rng_alloc(gsl_T); gsl_rng_set(gsl_r, 314159265); clean_model(); if (!vec && !head) { printf("Missing training data!\n"); return; } out_dim = out_d < 0 ? 2 : out_d; initial_alpha = alph < 0 ? 1.0 : alph; n_threads = n_thre < 0 ? 8 : n_thre; n_samples = n_samp; n_negatives = n_nega < 0 ? 5 : n_nega; n_neighbors = n_neig < 0 ? 150 : n_neig; n_trees = n_tree; n_propagations = n_prop < 0 ? 3 : n_prop; gamma = gamm < 0 ? 7.0 : gamm; perplexity = perp < 0 ? 50.0 : perp; if (n_samples < 0) { if (n_vertices < 10000) n_samples = 1000; else if (n_vertices < 1000000) n_samples = (n_vertices - 10000) * 9000 / (1000000 - 10000) + 1000; else n_samples = n_vertices / 100; } n_samples *= 1000000; if (n_trees < 0) { if (n_vertices < 100000) n_trees = 10; else if (n_vertices < 1000000) n_trees = 20; else if (n_vertices < 5000000) n_trees = 50; else n_trees = 100; } if (vec) { clean_graph(); construt_knn(); } visualize(); }