Index: sagePolynomialOperations.sage
===================================================================
--- sagePolynomialOperations.sage	(revision 79)
+++ sagePolynomialOperations.sage	(revision 80)
@@ -1,10 +1,117 @@
 load "/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageMatrixOperations.sage"
 
+def spo_add_polynomial_coeffs_to_matrix(pMonomials, 
+                                        pCoefficients, 
+                                        knownMonomials, 
+                                        protoMatrixRows, 
+                                        columnsWidth=0):
+    """
+    For a given polynomial (under the form of monomials and coefficents lists),
+    add the coefficients of the protoMatrix (a list of proto matrix rows).
+    Coefficients are added to the protoMatrix row in the order imposed by the 
+    monomials discovery list (the knownMonomials list) built as construction
+    goes on. 
+    As a bonus data can be printed out for a visual check.
+    pMonomials     : the list of the monomials coming form some polynomial;
+    pCoefficients  : the list of the corresponding coefficients to add to
+                     the protoMatrix in the exact same order as the monomials;
+    knownMonomials : the list of the already knonw monomials;
+    protoMatrixRows: a list of lists, each one holding the coefficients of the 
+                     monomials
+    columnWith     : the width, in characters, of the displayed column ; if 0, 
+                     do not display anything.
+    """
+    # We have started with the smaller degrees in the first variable.
+    pMonomials.reverse()
+    pCoefficients.reverse()
+    # New empty proto matrix row.
+    protoMatrixRowCoefficients = []
+    # We work according to the order of the already known monomials
+    # No known monomials yet: add the pMonomials to knownMonomials 
+    # and add the coefficients to the proto matrix row.
+    if len(knownMonomials) == 0: 
+        for pmIdx in xrange(0, len(pMonomials)):
+            knownMonomials.append(pMonomials[pmIdx])
+            protoMatrixRowCoefficients.append(pCoefficients[pmIdx])
+            if columnsWidth != 0:
+                monomialAsString = str(pCoefficients[pmIdx]) + " " + \
+                                   str(pMonomials[pmIdx])
+                print monomialAsString, " " * \
+                      (columnsWidth - len(monomialAsString)),
+    # There are some known monomials. We search for them in pMonomials and 
+    # add their coefficients to the proto matrix row.
+    else: 
+        for knownMonomialIndex in xrange(0,len(knownMonomials)):
+            # We lazily use an exception here since pMonomials.index() function
+            # may fail throwing the ValueError exception.
+            try:
+                indexInPmonomials = \
+                    pMonomials.index(knownMonomials[knownMonomialIndex])
+                if columnsWidth != 0:
+                    monomialAsString = str(pCoefficients[indexInPmonomials]) + \
+                        " " + str(knownMonomials[knownMonomialIndex])
+                    print monomialAsString, " " * \
+                        (columnsWidth - len(monomialAsString)),
+                # Add the coefficient to the proto matrix row and delete the \
+                # known monomial from the current pMonomial list 
+                #(and the corresponding coefficient as well).
+                protoMatrixRowCoefficients.append(pCoefficients[indexInPmonomials])
+                del pMonomials[indexInPmonomials]
+                del pCoefficients[indexInPmonomials]
+            # The knownMonomials element is not in pMonomials
+            except ValueError:   
+                protoMatrixRowCoefficients.append(0)
+                if columnsWidth != 0:
+                    monomialAsString = "0" + " "+ \
+                        str(knownMonomials[knownMonomialIndex])
+                    print monomialAsString, " " * \
+                        (columnsWidth - len(monomialAsString)),
+        # End for knownMonomialKey loop. 
+        # We now append the remaining monomials of pMonomials to knownMonomials 
+        # and the corresponding coefficients to proto matrix row.
+        for pmIdx in xrange(0, len(pMonomials)):
+            knownMonomials.append(pMonomials[pmIdx])
+            protoMatrixRowCoefficients.append(pCoefficients[pmIdx])
+            if columnsWidth != 0:
+                monomialAsString = str(pCoefficients[pmIdx]) + " " \
+                    + str(pMonomials[pmIdx])
+                print monomialAsString, " " * \
+                    (columnsWidth - len(monomialAsString)),
+        # End for pmIdx loop.
+    # Add the new list row elements to the proto matrix.
+    protoMatrixRows.append(protoMatrixRowCoefficients)
+    if columnsWidth != 0:
+        print    
+# End spo_add_polynomial_coeffs_to_matrix
+
+def spo_expression_as_string(powI, powT, powP, alpha):
+    """
+    Computes a string version of the i^k + t^l + p^m + N^n expression for
+    output.
+    """
+    expressionAsString =""
+    if powI != 0:
+        expressionAsString += "i^" + str(powI)
+    if powT != 0:
+        if len(expressionAsString) != 0:
+            expressionAsString += " * "
+        expressionAsString += "t^" + str(powT)
+    if powP != 0:
+        if len(expressionAsString) != 0:
+            expressionAsString += " * "
+        expressionAsString += "p^" + str(powP)
+    if (alpha - powP) != 0 :
+        if len(expressionAsString) != 0:
+            expressionAsString += " * "
+        expressionAsString += "N^" + str(alpha - powP)
+    return(expressionAsString)
+# End spo_expression_as_string.
+
 def spo_polynomial_to_matrix(p, pRing, alpha, N, columnsWidth=0):
     """
     From a (bivariate) polynomial and some other parameters build a matrix
     to be reduced by fpLLL.
-    The matrix is such as those found in Boneh-Durphy and Stehlé.
+    The matrix is such as those found in Boneh-Durphee and Stehl�.
     
     p: the (bivariate) polynomial
     alpha:
@@ -209,110 +316,3 @@
     # End for pPower loop
     return protoMatrixRows
 # End spo_polynomial_to_matrix
-
-def spo_add_polynomial_coeffs_to_matrix(pMonomials, 
-                                        pCoefficients, 
-                                        knownMonomials, 
-                                        protoMatrixRows, 
-                                        columnsWidth=0):
-    """
-    For a given polynomial (under the form of monomials and coefficents lists),
-    add the coefficients of the protoMatrix (a list of proto rows).
-    Coefficients are added to the protoMatrix row in the order imposed by the 
-    monomials discovery list (the knownMonomials list) built as construction
-    goes on. 
-    As a bonus data can be printed out for a visual check.
-    pMonomials     : the list of the monomials coming form some polynomial;
-    pCoefficients  : the list of the corresponding coefficients to add to
-                     the protoMatrix in the exact same order as the monomials;
-    knownMonomials : the list of the already knonw monomials;
-    protoMatrixRows: a list of lists, each one holding the coefficients of the 
-                     monomials
-    columnWith     : the width, in characters, of the displayed column ; if 0, 
-                     do not display anything.
-    """
-    # We have started with the smaller degrees in the first variable.
-    pMonomials.reverse()
-    pCoefficients.reverse()
-    # New empty proto matrix row.
-    protoMatrixRowCoefficients = []
-    # We work according to the order of the already known monomials
-    # No known monomials yet: add the pMonomials to knownMonomials 
-    # and add the coefficients to the proto matrix row.
-    if len(knownMonomials) == 0: 
-        for pmIdx in xrange(0, len(pMonomials)):
-            knownMonomials.append(pMonomials[pmIdx])
-            protoMatrixRowCoefficients.append(pCoefficients[pmIdx])
-            if columnsWidth != 0:
-                monomialAsString = str(pCoefficients[pmIdx]) + " " + \
-                                   str(pMonomials[pmIdx])
-                print monomialAsString, " " * \
-                      (columnsWidth - len(monomialAsString)),
-    # There are some known monomials. We search for them in pMonomials and 
-    # add their coefficients to the proto matrix row.
-    else: 
-        for knownMonomialIndex in xrange(0,len(knownMonomials)):
-            # We lazily use an exception here since pMonomials.index() function
-            # may fail throwing the ValueError exception.
-            try:
-                indexInPmonomials = \
-                    pMonomials.index(knownMonomials[knownMonomialIndex])
-                if columnsWidth != 0:
-                    monomialAsString = str(pCoefficients[indexInPmonomials]) + \
-                        " " + str(knownMonomials[knownMonomialIndex])
-                    print monomialAsString, " " * \
-                        (columnsWidth - len(monomialAsString)),
-                # Add the coefficient to the proto matrix row and delete the \
-                # known monomial from the current pMonomial list 
-                #(and the corresponding coefficient as well).
-                protoMatrixRowCoefficients.append(pCoefficients[indexInPmonomials])
-                del pMonomials[indexInPmonomials]
-                del pCoefficients[indexInPmonomials]
-            # The knownMonomials element is not in pMonomials
-            except ValueError:   
-                protoMatrixRowCoefficients.append(0)
-                if columnsWidth != 0:
-                    monomialAsString = "0" + " "+ \
-                        str(knownMonomials[knownMonomialIndex])
-                    print monomialAsString, " " * \
-                        (columnsWidth - len(monomialAsString)),
-        # End for knownMonomialKey loop. 
-        # We now append the remaining monomials of pMonomials to knownMonomials 
-        # and the corresponding coefficients to proto matrix row.
-        for pmIdx in xrange(0, len(pMonomials)):
-            knownMonomials.append(pMonomials[pmIdx])
-            protoMatrixRowCoefficients.append(pCoefficients[pmIdx])
-            if columnsWidth != 0:
-                monomialAsString = str(pCoefficients[pmIdx]) + " " \
-                    + str(pMonomials[pmIdx])
-                print monomialAsString, " " * \
-                    (columnsWidth - len(monomialAsString)),
-        # End for pmIdx loop.
-    # Add the new list row elements to the proto matrix.
-    protoMatrixRows.append(protoMatrixRowCoefficients)
-    if columnsWidth != 0:
-        print    
-# End spo_add_polynomial_coeffs_to_matrix
-
-def spo_expression_as_string(powI, powT, powP, alpha):
-    """
-    Computes a string version of the i^k + t^l + p^m + N^n expression for
-    output.
-    """
-    expressionAsString =""
-    if powI != 0:
-        expressionAsString += "i^" + str(powI)
-    if powT != 0:
-        if len(expressionAsString) != 0:
-            expressionAsString += " * "
-        expressionAsString += "t^" + str(powT)
-    if powP != 0:
-        if len(expressionAsString) != 0:
-            expressionAsString += " * "
-        expressionAsString += "p^" + str(powP)
-    if (alpha - powP) != 0 :
-        if len(expressionAsString) != 0:
-            expressionAsString += " * "
-        expressionAsString += "N^" + str(alpha - powP)
-    return(expressionAsString)
-# End spo_expression_as_string.
\ No newline at end of file
