SIMD Computing 113
{
double xmid = 0 . 5∗ (x0 + x1);
int smid = Sign ( g ’ ( xmid ) ) ;
if (x0 == xmid || x1 == xmid || smid == 0)
{ root1 [ j++] = xmid; break ; }
if (smid == s0) { x0 = xmid ; } else { x1 = xmid ; }
}
}
// Compute g ( x ) at th e l o c a l extre ma . I n t he or y , th e minimax p ol yn om ia l
// causes thes e val ues to have same magnitude but o s c i l l a t e in si gn .
// You can use these to determine when to terminate Remez iterations .
double error [d ];
for (int i = 0; i < d; ++i )
{
error [ i ] = g( root1 [ i ]);
}
// STOP w hen y o u hav e met your c r i t e r i a f o r convergence .
// Solve p( root1 [ i ]) + (−1)ˆ{ i }∗e = f(root1 [ i ]) for e and coefficients
// of p, a total of d+2 unknowns. We know p[0] = 1 , so we need only ...