Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void skew_snfs_params(fact_obj_t *fobj, nfs_job_t *job)
- {
- // examine the difference between scaled difficulty and difficulty for snfs jobs
- // and skew the r/a parameters accordingly.
- // the input job struct should have already been filled in by get_ggnfs_params()
- double oom_skew;
- double percent_skew;
- if (job->snfs == NULL)
- return;
- // sdiff gets incremented by 1 for every 6 orders of magnitude difference
- // between the r/a norms.
- oom_skew = job->snfs->sdifficulty - job->snfs->difficulty;
- if (job->snfs->poly->side == RATIONAL_SPQ)
- {
- // sieving on rational side means that side's norm is the bigger one
- if (oom_skew >= 4)
- {
- // for really big skew, increment the large prime bound as well
- job->lpbr++;
- job->mfbr += 2;
- // 5% for every 6 orders of magnitude difference between the norms
- percent_skew = oom_skew * 0.05;
- job->alim -= percent_skew*job->alim/5;
- job->rlim += percent_skew*job->rlim;
- }
- if (oom_skew >= 5)
- {
- // for really big skew, increment the large prime bound as well
- job->lpbr++;
- job->mfbr += 2;
- }
- if (oom_skew >= 6)
- {
- // for really really big skew, use 3 large primes
- job->mfbr = job->lpbr*2.9;
- job->rlambda = 3.6;
- }
- // this *should* just change min_rels based on the new lpbr/a value
- if (oom_skew >= 4)
- get_ggnfs_params(fobj, job);
- }
- else
- {
- // sieving on algebraic side means that side's norm is the bigger one
- if (oom_skew >= 4)
- {
- // for really big skew, increment the large prime bound as well
- job->lpba++;
- job->mfba += 2;
- // 5% for every 6 orders of magnitude difference between the norms
- percent_skew = oom_skew * 0.05;
- job->alim += percent_skew*job->alim;
- job->rlim -= percent_skew*job->rlim/5;
- }
- if (oom_skew >= 5)
- {
- // for really big skew, increment the large prime bound as well
- job->lpba++;
- job->mfba += 2;
- }
- if (oom_skew >= 6)
- {
- // for really really big skew, use 3 large primes
- job->mfba = job->lpba*2.9;
- job->alambda = 3.6;
- }
- // this *should* just change min_rels based on the new lpbr/a value
- if (oom_skew >= 4)
- get_ggnfs_params(fobj, job);
- }
- return;
- }
- // ...
- // ...
- // ...
- // following begins at line 2640...
- void snfs_scale_difficulty(snfs_t *polys, int npoly)
- {
- // poly degrees yielding very unbalanced norms are less desireable for sieving.
- // reflect this by scaling the difficulty of these polys. Since special-q can
- // bring the norm down on one side or another (at the expense of the other side),
- // we add one to the difficulty for every order of magnitude imbalance beyond 6
- // between the two sides (until we figure out something more accurate)
- int i;
- for (i=0; i<npoly; i++)
- {
- double ratio, absa = fabs(polys[i].anorm), absr = fabs(polys[i].rnorm);
- // slight preference to sieve on the algebraic side...
- if ((log10(absr) - 6) > log10(absa))
- {
- ratio = absr / absa;
- polys[i].poly->side = RATIONAL_SPQ;
- }
- else
- {
- ratio = absa / absr;
- polys[i].poly->side = ALGEBRAIC_SPQ;
- }
- if (VFLAG > 1)
- printf("gen: anorm: %1.2e, rnorm: %1.2e, ratio: %1.2e, log10(ratio) = %1.2f\n",
- polys[i].anorm, polys[i].rnorm, ratio, log10(ratio));
- ratio = log10(ratio) / 6.;
- if (ratio < 0.)
- ratio = 0.;
- polys[i].sdifficulty = polys[i].difficulty + ratio;
- }
- return;
- }
RAW Paste Data