Index: sageRunSLZ.sage
===================================================================
--- sageRunSLZ.sage	(revision 196)
+++ sageRunSLZ.sage	(revision 197)
@@ -663,23 +663,23 @@
         nbw = 0
         icAsInt = int(ic * toIntegerFactor)
         #### The following ratio is always >= 1. In case we may want to
-        #  enlarge the interval
+        #    enlarge the interval
         curTaylErrRat = polyApproxAccur / terr
-        ## Make the  integral transformations.
-        ### First for interval center and bounds.
+        ### Make the  integral transformations.
+        #### Bounds and interval center.
         intIc = int(ic * toIntegerFactor)
         intLb = int(lb * toIntegerFactor) - intIc
         intUb = int(ub * toIntegerFactor) - intIc
         #
-        #### For polynomials
+        #### Polynomials
         basisConstructionTime         = cputime()
         ##### To a polynomial with rational coefficients with rational arguments
         ratRatP = slz_float_poly_of_float_to_rat_poly_of_rat_pow_two(floatP)
         ##### To a polynomial with rational coefficients with integer arguments
         ratIntP = \
             slz_rat_poly_of_rat_to_rat_poly_of_int(ratRatP, precision)
-        #####  Ultimately a polynomial with integer coefficients with integer 
-        #      arguments.
+        #####  Ultimately a multivariate polynomial with integer coefficients  
+        #      with integer arguments.
         coppersmithTuple = \
             slz_rat_poly_of_int_to_poly_for_coppersmith(ratIntP, 
                                                         precision, 
@@ -695,7 +695,7 @@
         basisConstructionsFullTime        += cputime(basisConstructionTime)
         basisConstructionsCount           += 1
         reductionTime                     = cputime()
-        # Compute the reduced polynomials.
+        #### Compute the reduced polynomials.
         ccReducedPolynomialsList =  \
             slz_compute_coppersmith_reduced_polynomials(intIntP, 
                                                         alpha, 
@@ -727,9 +727,6 @@
         #### We have at least two polynomials.
         #    Let us try to compute resultants.
         #    For each resultant computed, go for the solutions.
-        resultantsComputationTime      = cputime()
-        resultantsInTTuplesList = []
-        hasNonNullResultant     = False
         ##### Build the pairs list.
         polyPairsList           = []
         for polyOuterIndex in xrange(0, len(ccReducedPolynomialsList) - 1):
@@ -737,72 +734,66 @@
                                          len(ccReducedPolynomialsList)):
                 polyPairsList.append((ccReducedPolynomialsList[polyOuterIndex],
                                       ccReducedPolynomialsList[polyInnerIndex]))
+        #### Actual root search.
+        rootsSet            = set()
+        hasNonNullResultant = False
         for polyPair in polyPairsList:
-            resultantTuple = \
-            slz_resultant_tuple(polyPair[0],
-                                polyPair[1],
-                                t)
+            if hasNonNullResultant:
+                break
+            resultantsComputationTime   = cputime()
+            currentResultant = \
+                slz_resultant(polyPair[0],
+                              polyPair[1],
+                              t)
             resultantsComputationsFullTime += cputime(resultantsComputationTime)
             resultantsComputationsCount    += 1
-            if len(resultantTuple) > 2:                    
+            if currentResultant is None:                    
+                print "Nul resultant"
+                continue # Next polyPair.
+            else:
                 hasNonNullResultant = True
-                resultantsInTTuplesList.append(resultantTuple)
-            else:
-                print "Nul resultant"
-        print len(resultantsInTTuplesList), "resultant(s) in t tuple(s) created."
-        if len(resultantsInTTuplesList) == 0:
-            print "Only null resultants, shrinking interval."
-            resultCondFailed      =  True
-            resultCondFailedCount += 1
-            ### Shrink interval for next iteration.
-            ub = lb + bw * onlyNullResultantsShrink
-            if ub > sdub:
-                ub = sdub
-            nbw = 0
-            continue
-        #### Compute roots.
-        rootsComputationTime       = cputime()
-        reducedPolynomialsRootsSet = set()
-        ##### Solve in the second variable since resultants are in the first
-        #     variable.
-        for resultantInTTuple in resultantsInTTuplesList:
-            currentResultant = resultantInTTuple[2]
-            ##### If the resultant degree is not at least 1, there are no roots.
+            #### We have a non null resultant. From now on, whatever the
+            #    root search yields, no extra root search is necessary.
+            #### A constant resultant leads to no root. Root search is done.
             if currentResultant.degree() < 1:
                 print "Resultant is constant:", currentResultant
-                continue # Next resultantInTTuple
+                continue # Next polyPair and should break.
+            #### Actual roots computation.
+            rootsComputationTime       = cputime()
             ##### Compute i roots
             iRootsList = Zi(currentResultant).roots()
-            ##### For each iRoot, compute the corresponding tRoots and check 
-            #     them in the input polynomial.
+            ##### For each iRoot, compute the corresponding tRoots and 
+            #     and build populate the .rootsSet.
             for iRoot in iRootsList:
                 ####### Roots returned by roots() are (value, multiplicity) 
                 #       tuples.
                 #print "iRoot:", iRoot
                 ###### Use the tRoot against each polynomial, alternatively.
-                for indexInTuple in range(0,2):
-                    currentPolynomial = resultantInTTuple[indexInTuple]
+                for indexInPair in range(0,2):
+                    currentPolynomial = polyPair[indexInPair]
                     ####### If the polynomial is univariate, just drop it.
                     if len(currentPolynomial.variables()) < 2:
                         print "    Current polynomial is not in two variables."
-                        continue # Next indexInTuple
+                        continue # Next indexInPair
                     tRootsList = \
                         Zt(currentPolynomial.subs({currentPolynomial.variables()[0]:iRoot[0]})).roots()
                     ####### The tRootsList can be empty, hence the test.
                     if len(tRootsList) == 0:
                         print "    No t root."
-                        continue # Next indexInTuple
+                        continue # Next indexInPair
                     for tRoot in tRootsList:
-                        reducedPolynomialsRootsSet.add((iRoot[0], tRoot[0]))
-        # End of roots computation
-        rootsComputationsFullTime   =   cputime(rootsComputationTime)
-        rootsComputationsCount      +=  1
-        ##### Prepare for results.
+                        rootsSet.add((iRoot[0], tRoot[0]))
+            # End of roots computation.
+            rootsComputationsFullTime   =   cputime(rootsComputationTime)
+            rootsComputationsCount      +=  1
+        # End loop for polyPair in polyParsList.  Will break at next iteration.
+        # since a non null resultant was found.
+        #### Prepare for results for the current interval..
         intervalResultsList = []
         intervalResultsList.append((lb, ub))
         #### Check roots.
         rootsResultsList = []
-        for root in reducedPolynomialsRootsSet:
+        for root in rootsSet:
             specificRootResultsList = []
             failingBounds = []
             intIntPdivN = intIntP(root[0], root[1]) / N
@@ -828,7 +819,7 @@
                 specificRootResultsList.append(hardToRoundCaseAsFloat.n().str(base=2))
                 # Check the root is in the bounds
                 if abs(root[0]) > iBound or abs(root[1]) > tBound:
-                    print "Root", root, "is out of bounds."
+                    print "Root", root, "is out of bounds for modular equation."
                     if abs(root[0]) > iBound:
                         print "root[0]:", root[0]
                         print "i bound:", iBound
@@ -849,6 +840,17 @@
                 rootsResultsList.append(specificRootResultsList)
         if len(rootsResultsList) > 0:
             intervalResultsList.append(rootsResultsList)
+        ### Check if a non null resultant was found. If not shrink the interval.
+        if not hasNonNullResultant:
+            print "Only null resultants for this reduction, shrinking interval."
+            resultCondFailed      =  True
+            resultCondFailedCount += 1
+            ### Shrink interval for next iteration.
+            ub = lb + bw * onlyNullResultantsShrink
+            if ub > sdub:
+                ub = sdub
+            nbw = 0
+            continue
         #### An intervalResultsList has at least the bounds.
         globalResultsList.append(intervalResultsList)   
         #### Compute an incremented width for next upper bound, only
