throw new RuntimeException("Too many iterations when searching center region"); boundEachRoot(-r,r,0,totalFound); int N = sturm.countRealRoots(upper-width,upper); if( N != 0 ) { boundEachRoot(upper-width,upper,totalFound,N); target -= N; totalFound += N; int N = sturm.countRealRoots(lower,lower+width); if( N != 0 ) { boundEachRoot(lower,lower+width,totalFound,N); target -= N; totalFound += N;
throw new RuntimeException("Too many iterations when searching center region"); boundEachRoot(-r,r,0,totalFound); int N = sturm.countRealRoots(upper-width,upper); if( N != 0 ) { boundEachRoot(upper-width,upper,totalFound,N); target -= N; totalFound += N; int N = sturm.countRealRoots(lower,lower+width); if( N != 0 ) { boundEachRoot(lower,lower+width,totalFound,N); target -= N; totalFound += N;
/** * Find real roots for the specified polynomial. * * @param poly Polynomial which has less than or equal to the number of coefficients specified in this class's * constructor. */ public void process( Polynomial poly ) { sturm.initialize(poly); if( searchRadius <= 0 ) numRoots = sturm.countRealRoots(Double.NEGATIVE_INFINITY,Double.POSITIVE_INFINITY); else numRoots = sturm.countRealRoots(-searchRadius,searchRadius); if( numRoots == 0 ) return; if( searchRadius <= 0 ) handleAllRoots(); else { boundEachRoot(-searchRadius,searchRadius,0,numRoots); } // improve the accuracy for( int i = 0; i < numRoots; i++ ) { roots[i] = PolynomialOps.refineRoot(poly, roots[i], maxRefineIterations); } }
/** * Find real roots for the specified polynomial. * * @param poly Polynomial which has less than or equal to the number of coefficients specified in this class's * constructor. */ public void process( Polynomial poly ) { sturm.initialize(poly); if( searchRadius <= 0 ) numRoots = sturm.countRealRoots(Double.NEGATIVE_INFINITY,Double.POSITIVE_INFINITY); else numRoots = sturm.countRealRoots(-searchRadius,searchRadius); if( numRoots == 0 ) return; if( searchRadius <= 0 ) handleAllRoots(); else { boundEachRoot(-searchRadius,searchRadius,0,numRoots); } // improve the accuracy for( int i = 0; i < numRoots; i++ ) { roots[i] = PolynomialOps.refineRoot(poly, roots[i], maxRefineIterations); } }