/*-------------------------------------------------------------------------*/ void poly_sizeopt_init(poly_sizeopt_t *data, sizeopt_callback_t callback, void *callback_data) { memset(data, 0, sizeof(poly_sizeopt_t)); mpz_init(data->gmp_N); data->internal = xmalloc(sizeof(curr_poly_t)); curr_poly_init((curr_poly_t *)data->internal); data->callback = callback; data->callback_data = callback_data; }
/*-------------------------------------------------------------------------*/ s32 poly_stage2_run(poly_stage2_t *data) { stage2_stat_t stats; curr_poly_t curr_poly; root_sieve_t root_sieve; assess_t assess; stage2_stat_init(&stats); curr_poly_init(&curr_poly); root_sieve_init(&root_sieve); assess_init(&assess, data->bound0, data->bound1, data->area, data->p_bound); optimize(&curr_poly, data, &root_sieve, &assess, &stats); #ifdef DO_PROFILE profile_done(&stats.profile); printf("\nTiming:"); printf("\nTotal "); profile_print(&stats.profile, PROF_ALL); printf("\n 1. Optimization "); profile_print(&stats.profile, PROF_INITIAL_OPTIMIZE); printf("\n Sieve all "); profile_print(&stats.profile, PROF_SIEVE_ALL); printf("\n Init sieve "); profile_print(&stats.profile, PROF_INIT_SIEVE); printf("\n Sieve "); profile_print(&stats.profile, PROF_SIEVE); printf("\n eval "); profile_print(&stats.profile, PROF_EVAL); printf("\n gmp/alpha1 "); profile_print(&stats.profile, PROF_ALPHA1); printf("\n polroots "); profile_print(&stats.profile, PROF_MURPHY_ROOTS); printf("\n 2. Optimization "); profile_print(&stats.profile, PROF_OPTIMIZE2); printf("\n 3. Optimization "); profile_print(&stats.profile, PROF_OPTIMIZE3); printf("\n murphy-e sum "); profile_print(&stats.profile, PROF_MURPHY_E); printf("\n"); #endif stage2_stat_free(&stats); curr_poly_free(&curr_poly); root_sieve_free(&root_sieve); assess_free(&assess); return 1; }
/*-------------------------------------------------------------------------*/ void poly_rootopt_init(poly_rootopt_t *data, msieve_obj *obj, rootopt_callback_t callback, void *callback_data) { stage2_curr_data_t *s; memset(data, 0, sizeof(poly_rootopt_t)); mpz_init(data->gmp_N); data->obj = obj; data->murphy_p_bound = PRIME_BOUND; data->callback = callback; data->callback_data = callback_data; s = (stage2_curr_data_t *)xmalloc(sizeof(stage2_curr_data_t)); curr_poly_init(&s->curr_poly); root_sieve_init(&s->root_sieve); assess_init(&s->assess); data->internal = (void *)s; }