external/blend2d/src/blend2d/blmath.cpp
// Computes up to L2 fixed shift k-polynomials, testing for convergence in the
// linear or quadratic case. Initiates one of the variable shift iterations and
// returns with the number of zeros found.
Computes up to L2 fixed shift k-polynomials, testing for convergence in the
linear or quadratic case. Initiates one of the variable shift iterations and
returns with the number of zeros found.
Computes up to L2 fixed shift k - polynomials testing for convergence in the linear or quadratic case . Initiates one of the variable shift iterations and returns with the number of zeros found .
void BLJenkinsTraubSolver::fxshfr(int l2, int* nz) {
  double svu, svv, ui, vi, s;
  double betas, betav, oss, ovv, ss, vv, ts, tv;
  double ots, otv, tvv, tss;
  int type, i, j, iflag, vpass, spass, vtry, stry;
  *nz = 0;
  betav = 0.25;
  betas = 0.25;
  oss = sr;
  ovv = v;
  quadsd(n,&u,&v,p,qp,&a,&b);
  calcsc(&type);
  for (j = 0; j < l2; j++) {
    nextk(&type);
    calcsc(&type);
    newest(type,&ui,&vi);
    vv = vi;
    ss = k[n-1] == 0.0 ? 0.0 : -p[n] / k[n - 1];
    tv = 1.0;
    ts = 1.0;
    if (j == 0 || type == 3)
      goto _70;
    if (vv != 0.0) tv = blAbs((vv - ovv) / vv);
    if (ss != 0.0) ts = blAbs((ss - oss) / ss);
    tvv = tv < otv ? tv * otv : 1.0;
    tss = ts < ots ? ts * ots : 1.0;
    vpass = (tvv < betav);
    spass = (tss < betas);
    if (!(spass || vpass))
      goto _70;
    svu = u;
    svv = v;
    for (i = 0; i < n; i++)
      svk[i] = k[i];
    s = ss;
    vtry = 0;
    stry = 0;
    if (spass && (!vpass || tss < tvv))
      goto _40;
_20:
    quadit(&ui, &vi, nz);
    if (*nz > 0)
      return;
    vtry = 1;
    betav *= 0.25;
    if (stry || !spass) goto _50;
    for (i = 0; i < n; i++)
      k[i] = svk[i];
_40:
    realit(s, nz, &iflag);
    if (*nz > 0)
      return;
    stry = 1;
    betas *=0.25;
    if (iflag == 0)
      goto _50;
    ui = -(s+s);
    vi = s*s;
    goto _20;
_50:
    u = svu;
    v = svv;
    for (i = 0; i < n; i++)
      k[i] = svk[i];
    if (vpass && !vtry)
      goto _20;
    quadsd(n, &u, &v, p, qp, &a, &b);
    calcsc(&type);
_70:
    ovv = vv;
    oss = ss;
    otv = tv;
    ots = ts;
  }
}
void BLJenkinsTraubSolver :: fxshfr ( int l2 , int * nz ) { double svu , svv , ui , vi , s ; double betas , betav , oss , ovv , ss , vv , ts , tv ; double ots , otv , tvv , tss ; int type , i , j , iflag , vpass , spass , vtry , stry ; * nz = 0 ; betav = 0.25 ; betas = 0.25 ; oss = sr ; ovv = v ; quadsd ( n , & u , & v , p , qp , & a , & b ) ; calcsc ( & type ) ; for ( j = 0 ; j < l2 ; j ++ ) { nextk ( & type ) ; calcsc ( & type ) ; newest ( type , & ui , & vi ) ; vv = vi ; ss = k [ n - 1 ] == 0.0 ? 0.0 : - p [ n ] / k [ n - 1 ] ; tv = 1.0 ; ts = 1.0 ; if ( j == 0 || type == 3 ) goto _70 ; if ( vv != 0.0 ) tv = blAbs ( ( vv - ovv ) / vv ) ; if ( ss != 0.0 ) ts = blAbs ( ( ss - oss ) / ss ) ; tvv = tv < otv ? tv * otv : 1.0 ; tss = ts < ots ? ts * ots : 1.0 ; vpass = ( tvv < betav ) ; spass = ( tss < betas ) ; if ( ! ( spass || vpass ) ) goto _70 ; svu = u ; svv = v ; for ( i = 0 ; i < n ; i ++ ) svk [ i ] = k [ i ] ; s = ss ; vtry = 0 ; stry = 0 ; if ( spass && ( ! vpass || tss < tvv ) ) goto _40 ; _20 : quadit ( & ui , & vi , nz ) ; if ( * nz > 0 ) return ; vtry = 1 ; betav *= 0.25 ; if ( stry || ! spass ) goto _50 ; for ( i = 0 ; i < n ; i ++ ) k [ i ] = svk [ i ] ; _40 : realit ( s , nz , & iflag ) ; if ( * nz > 0 ) return ; stry = 1 ; betas *= 0.25 ; if ( iflag == 0 ) goto _50 ; ui = - ( s + s ) ; vi = s * s ; goto _20 ; _50 : u = svu ; v = svv ; for ( i = 0 ; i < n ; i ++ ) k [ i ] = svk [ i ] ; if ( vpass && ! vtry ) goto _20 ; quadsd ( n , & u , & v , p , qp , & a , & b ) ; calcsc ( & type ) ; _70 : ovv = vv ; oss = ss ; otv = tv ; ots = ts ; } }
Computes up to L2 fixed shift k-polynomials, testing for convergence in the
linear or quadratic case.
Computes up to L2 fixed shift k - polynomials testing for convergence in the linear or quadratic case .
// Evaluate polynomial by synthetic division. // Calculate next k polynomial and estimate v. // Estimate s. // Compute relative measures of convergence of s and v sequences. // If decreasing, multiply two most recent convergence measures. // Compare with convergence criteria. // At least one sequence has passed the convergence test. Store variables // before iterating. // Choose iteration according to the fastest converging sequence. // Quadratic iteration has failed. Flag that it has been tried and decrease // the convergence criterion. // Try linear iteration if it has not been tried and the S sequence is converging. // Linear iteration has failed. Flag that it has been tried and decrease // the convergence criterion. // If linear iteration signals an almost double real zero attempt quadratic // iteration. // Restore variables. // Try quadratic iteration if it has not been tried and the V sequence is // converging. // Recompute QP and scalar values to continue the second stage.