int error_bound(boolean[] enough,double endl,double endr,double[] ritz,double[] bnd,int step,double tol){
  int mid, neig;
  int i;
  double gapl, gap;
  mid=svd_idamax(step + 1,bnd,0,1);
  for (i=((step + 1) + (step - 1)) / 2; i >= mid + 1; i-=1)   if (fabs(ritz[i - 1] - ritz[i]) < eps34 * fabs(ritz[i]))   if (bnd[i] > tol && bnd[i - 1] > tol) {
    bnd[i - 1]=Math.sqrt(bnd[i] * bnd[i] + bnd[i - 1] * bnd[i - 1]);
    bnd[i]=0.0;
  }
  for (i=((step + 1) - (step - 1)) / 2; i <= mid - 1; i+=1)   if (fabs(ritz[i + 1] - ritz[i]) < eps34 * fabs(ritz[i]))   if (bnd[i] > tol && bnd[i + 1] > tol) {
    bnd[i + 1]=Math.sqrt(bnd[i] * bnd[i] + bnd[i + 1] * bnd[i + 1]);
    bnd[i]=0.0;
  }
  neig=0;
  gapl=ritz[step] - ritz[0];
  for (i=0; i <= step; i++) {
    gap=gapl;
    if (i < step)     gapl=ritz[i + 1] - ritz[i];
    gap=svd_dmin(gap,gapl);
    if (gap > bnd[i])     bnd[i]=bnd[i] * (bnd[i] / gap);
    if (bnd[i] <= 16.0 * eps * fabs(ritz[i])) {
      neig++;
      if (!enough[0])       enough[0]=endl < ritz[i] && ritz[i] < endr;
    }
  }
  return neig;
}

int error_bound ( boolean [ ] enough , double endl , double endr , double [ ] ritz , double [ ] bnd , int step , double tol ) { int mid , neig ; int i ; double gapl , gap ; mid = svd_idamax ( step + 1 , bnd , 0 , 1 ) ; for ( i = ( ( step + 1 ) + ( step - 1 ) ) / 2 ; i >= mid + 1 ; i -= 1 ) if ( fabs ( ritz [ i - 1 ] - ritz [ i ] ) < eps34 * fabs ( ritz [ i ] ) ) if ( bnd [ i ] > tol && bnd [ i - 1 ] > tol ) { bnd [ i - 1 ] = Math . sqrt ( bnd [ i ] * bnd [ i ] + bnd [ i - 1 ] * bnd [ i - 1 ] ) ; bnd [ i ] = 0.0 ; } for ( i = ( ( step + 1 ) - ( step - 1 ) ) / 2 ; i <= mid - 1 ; i += 1 ) if ( fabs ( ritz [ i + 1 ] - ritz [ i ] ) < eps34 * fabs ( ritz [ i ] ) ) if ( bnd [ i ] > tol && bnd [ i + 1 ] > tol ) { bnd [ i + 1 ] = Math . sqrt ( bnd [ i ] * bnd [ i ] + bnd [ i + 1 ] * bnd [ i + 1 ] ) ; bnd [ i ] = 0.0 ; } neig = 0 ; gapl = ritz [ step ] - ritz [ 0 ] ; for ( i = 0 ; i <= step ; i ++ ) { gap = gapl ; if ( i < step ) gapl = ritz [ i + 1 ] - ritz [ i ] ; gap = svd_dmin ( gap , gapl ) ; if ( gap > bnd [ i ] ) bnd [ i ] = bnd [ i ] * ( bnd [ i ] / gap ) ; if ( bnd [ i ] <= 16.0 * eps * fabs ( ritz [ i ] ) ) { neig ++ ; if ( ! enough [ 0 ] ) enough [ 0 ] = endl < ritz [ i ] && ritz [ i ] < endr ; } } return neig ; }
description - - - - - - - - - - - function massages error bounds for very close ritz values by placing a gap between them . the error bounds are then refined to reflect this . arguments - - - - - - - - - ( input ) endl left end of interval containing unwanted eigenvalues endr right end of interval containing unwanted eigenvalues ritz array to store the ritz values bnd array to store the error bounds enough stop flag functions used - - - - - - - - - - - - - - blas svd_idamax utility svd_dmin
