Index: sagePolynomialOperations.sage
===================================================================
--- sagePolynomialOperations.sage	(revision 82)
+++ sagePolynomialOperations.sage	(revision 83)
@@ -1,17 +1,17 @@
 load "/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageMatrixOperations.sage"
 
-def spo_add_polynomial_coeffs_to_matrix(pMonomials, 
-                                        pCoefficients, 
-                                        knownMonomials, 
-                                        protoMatrixRows, 
-                                        columnsWidth=0):
+def spo_add_polynomial_coeffs_to_matrix_row(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.
+    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;
@@ -82,7 +82,7 @@
     protoMatrixRows.append(protoMatrixRowCoefficients)
     if columnsWidth != 0:
         print    
-# End spo_add_polynomial_coeffs_to_matrix
+# End spo_add_polynomial_coeffs_to_matrix_row
 
 def spo_expression_as_string(powI, powT, powP, alpha):
     """
@@ -123,16 +123,21 @@
     return pow(norm, 1/degree)
 # end spo_norm
 
-def spo_polynomial_to_matrix(p, pRing, alpha, N, columnsWidth=0):
+def spo_polynomial_to_proto_matrix(p, pRing, alpha, N, columnsWidth=0):
     """
-    From a (bivariate) polynomial and some other parameters build a matrix
-    to be reduced by fpLLL.
+    From a (bivariate) polynomial and some other parameters build a proto 
+    matrix (an array of rows) to be converted into a "true" matrix and 
+    eventually by reduced by fpLLL.
     The matrix is such as those found in Boneh-Durphee and Stehlé.
     
+    Parameters
+    ----------
     p: the (bivariate) polynomial
+    pRing:
     alpha:
     N:
-    
+    columsWidth: if == 0, no information is displayed, otherwise data is 
+                 printed in colums of columnsWitdth width.
     """
     knownMonomials = []
     protoMatrixRows = []
@@ -172,11 +177,11 @@
                                         polynomialAtPower 
                     pMonomials = currentPolynomial.monomials()
                     pCoefficients = currentPolynomial.coefficients()
-                    spo_add_polynomial_coeffs_to_matrix(pMonomials, 
-                                                        pCoefficients, 
-                                                        knownMonomials, 
-                                                        protoMatrixRows, 
-                                                        columnsWidth)
+                    spo_add_polynomial_coeffs_to_matrix_row(pMonomials, 
+                                                            pCoefficients, 
+                                                            knownMonomials, 
+                                                            protoMatrixRows, 
+                                                            columnsWidth)
                 # End tPower.
             # End for iPower.
         else: # pPower > 0: (p^1..p^alpha)
@@ -190,11 +195,11 @@
             currentPolynomial = polynomialAtPower * nAtPower
             pMonomials = currentPolynomial.monomials()
             pCoefficients = currentPolynomial.coefficients()
-            spo_add_polynomial_coeffs_to_matrix(pMonomials, 
-                                                pCoefficients, 
-                                                knownMonomials, 
-                                                protoMatrixRows, 
-                                                columnsWidth)
+            spo_add_polynomial_coeffs_to_matrix_row(pMonomials, 
+                                                    pCoefficients, 
+                                                    knownMonomials, 
+                                                    protoMatrixRows, 
+                                                    columnsWidth)
             
             # The i^iPower * p^pPower polynomials: they add i^k monomials to  
             # p^pPower up to k < pIdegree * pPower. This only introduces i^k 
@@ -209,11 +214,11 @@
                 currentPolynomial = P(currentExpression) * polynomialAtPower
                 pMonomials = currentPolynomial.monomials()
                 pCoefficients = currentPolynomial.coefficients()
-                spo_add_polynomial_coeffs_to_matrix(pMonomials, 
-                                                    pCoefficients, 
-                                                    knownMonomials, 
-                                                    protoMatrixRows, 
-                                                    columnsWidth)
+                spo_add_polynomial_coeffs_to_matrix_row(pMonomials, 
+                                                        pCoefficients, 
+                                                        knownMonomials, 
+                                                        protoMatrixRows, 
+                                                        columnsWidth)
             # End for iPower
             # We want now to introduce a t * p^pPower polynomial. But before
             # that we must introduce some mixed monomials.
@@ -230,11 +235,11 @@
                 currentPolynomial = P(currentExpression)
                 pMonomials = currentPolynomial.monomials()
                 pCoefficients = currentPolynomial.coefficients()
-                spo_add_polynomial_coeffs_to_matrix(pMonomials, 
-                                                    pCoefficients, 
-                                                    knownMonomials, 
-                                                    protoMatrixRows, 
-                                                    columnsWidth)
+                spo_add_polynomial_coeffs_to_matrix_row(pMonomials, 
+                                                        pCoefficients, 
+                                                        knownMonomials, 
+                                                        protoMatrixRows, 
+                                                        columnsWidth)
             # End for iPower
             #
             # This is the mixed monomials main loop. It introduces:
@@ -262,11 +267,11 @@
                     currentPolynomial = P(currentExpression)
                     pMonomials = currentPolynomial.monomials()
                     pCoefficients = currentPolynomial.coefficients()
-                    spo_add_polynomial_coeffs_to_matrix(pMonomials, 
-                                                        pCoefficients, 
-                                                        knownMonomials, 
-                                                        protoMatrixRows, 
-                                                        columnsWidth)
+                    spo_add_polynomial_coeffs_to_matrix_row(pMonomials, 
+                                                            pCoefficients, 
+                                                            knownMonomials, 
+                                                            protoMatrixRows, 
+                                                            columnsWidth)
                     #print "+++++"
                     # At iShift == 0, the following innerTpower loop adds  
                     # duplicate monomials, since no extra i^l * t^k is needed 
@@ -293,7 +298,7 @@
                             currentPolynomial = P(currentExpression)
                             pMonomials = currentPolynomial.monomials()
                             pCoefficients = currentPolynomial.coefficients()
-                            spo_add_polynomial_coeffs_to_matrix(pMonomials, 
+                            spo_add_polynomial_coeffs_to_matrix_row(pMonomials, 
                                                                 pCoefficients, 
                                                                 knownMonomials, 
                                                                 protoMatrixRows, 
@@ -319,11 +324,11 @@
                     currentPolynomial = P(currentExpression) * polynomialAtPower
                     pMonomials = currentPolynomial.monomials()
                     pCoefficients = currentPolynomial.coefficients()
-                    spo_add_polynomial_coeffs_to_matrix(pMonomials, 
-                                                        pCoefficients, 
-                                                        knownMonomials, 
-                                                        protoMatrixRows, 
-                                                        columnsWidth)
+                    spo_add_polynomial_coeffs_to_matrix_row(pMonomials, 
+                                                            pCoefficients, 
+                                                            knownMonomials, 
+                                                            protoMatrixRows, 
+                                                            columnsWidth)
                 # End for outerTpower 
                 #print "++++++++++"
             # End for iShift
@@ -331,6 +336,54 @@
         nAtPower /= N
     # End for pPower loop
     return protoMatrixRows
-# End spo_polynomial_to_matrix
+# End spo_polynomial_to_proto_matrix
 
+def spo_proto_to_column_matrix(protoMatrixRows):
+    """
+    Create a row (each column holds the coefficients of one polynomial) matrix.
+    protoMatrixRows.
+    
+    Parameters
+    ----------
+    protoMatrixRows: a list of coefficient lists.
+    """
+    numRows = len(protoMatrixRows)
+    if numRows == 0:
+        return None
+    numColumns = len(protoMatrixRows[numRows-1])
+    if numColumns == 0:
+        return None
+    baseMatrix = matrix(ZZ, numRows, numColumns)
+    for rowIndex in xrange(0, numRows):
+        if monomialLengthChars != 0:
+            print protoMatrixRows[rowIndex]
+        for colIndex in xrange(0, len(protoMatrixRows[rowIndex])):
+            baseMatrix[colIndex, rowIndex] = protoMatrixRows[rowIndex][colIndex]
+    return baseMatrix
+# End spo_proto_to_column_matrix.
+#
+def spo_proto_to_row_matrix(protoMatrixRows):
+    """
+    Create a row (each row holds the coefficients of one polynomial) matrix.
+    protoMatrixRows.
+    
+    Parameters
+    ----------
+    protoMatrixRows: a list of coefficient lists.
+    """
+    numRows = len(protoMatrixRows)
+    if numRows == 0:
+        return None
+    numColumns = len(protoMatrixRows[numRows-1])
+    if numColumns == 0:
+        return None
+    baseMatrix = matrix(ZZ, numRows, numColumns)
+    for rowIndex in xrange(0, numRows):
+        if monomialLengthChars != 0:
+            print protoMatrixRows[rowIndex]
+        for colIndex in xrange(0, len(protoMatrixRows[rowIndex])):
+            baseMatrix[rowIndex, colIndex] = protoMatrixRows[rowIndex][colIndex]
+    return baseMatrix
+# End spo_proto_to_row_matrix.
+#
 print "sagePolynomialOperations loaded..."
\ No newline at end of file
