Statistiques
| Révision :

root / pobysoPythonSage / src / sageSLZ / sagePolynomialOperations.sage @ 92

Historique | Voir | Annoter | Télécharger (21,73 ko)

1 74 storres
load "/home/storres/recherche/arithmetique/pobysoPythonSage/src/sageSLZ/sageMatrixOperations.sage"
2 87 storres
print "sagePolynomialOperations loading..."
3 83 storres
def spo_add_polynomial_coeffs_to_matrix_row(pMonomials,
4 83 storres
                                            pCoefficients,
5 83 storres
                                            knownMonomials,
6 83 storres
                                            protoMatrixRows,
7 83 storres
                                            columnsWidth=0):
8 80 storres
    """
9 80 storres
    For a given polynomial (under the form of monomials and coefficents lists),
10 80 storres
    add the coefficients of the protoMatrix (a list of proto matrix rows).
11 80 storres
    Coefficients are added to the protoMatrix row in the order imposed by the
12 80 storres
    monomials discovery list (the knownMonomials list) built as construction
13 80 storres
    goes on.
14 83 storres
    As a bonus, data can be printed out for a visual check.
15 80 storres
    pMonomials     : the list of the monomials coming form some polynomial;
16 80 storres
    pCoefficients  : the list of the corresponding coefficients to add to
17 80 storres
                     the protoMatrix in the exact same order as the monomials;
18 80 storres
    knownMonomials : the list of the already knonw monomials;
19 80 storres
    protoMatrixRows: a list of lists, each one holding the coefficients of the
20 80 storres
                     monomials
21 80 storres
    columnWith     : the width, in characters, of the displayed column ; if 0,
22 80 storres
                     do not display anything.
23 80 storres
    """
24 80 storres
    # We have started with the smaller degrees in the first variable.
25 80 storres
    pMonomials.reverse()
26 80 storres
    pCoefficients.reverse()
27 80 storres
    # New empty proto matrix row.
28 80 storres
    protoMatrixRowCoefficients = []
29 80 storres
    # We work according to the order of the already known monomials
30 80 storres
    # No known monomials yet: add the pMonomials to knownMonomials
31 80 storres
    # and add the coefficients to the proto matrix row.
32 80 storres
    if len(knownMonomials) == 0:
33 80 storres
        for pmIdx in xrange(0, len(pMonomials)):
34 80 storres
            knownMonomials.append(pMonomials[pmIdx])
35 80 storres
            protoMatrixRowCoefficients.append(pCoefficients[pmIdx])
36 80 storres
            if columnsWidth != 0:
37 80 storres
                monomialAsString = str(pCoefficients[pmIdx]) + " " + \
38 80 storres
                                   str(pMonomials[pmIdx])
39 80 storres
                print monomialAsString, " " * \
40 80 storres
                      (columnsWidth - len(monomialAsString)),
41 80 storres
    # There are some known monomials. We search for them in pMonomials and
42 80 storres
    # add their coefficients to the proto matrix row.
43 80 storres
    else:
44 80 storres
        for knownMonomialIndex in xrange(0,len(knownMonomials)):
45 80 storres
            # We lazily use an exception here since pMonomials.index() function
46 80 storres
            # may fail throwing the ValueError exception.
47 80 storres
            try:
48 80 storres
                indexInPmonomials = \
49 80 storres
                    pMonomials.index(knownMonomials[knownMonomialIndex])
50 80 storres
                if columnsWidth != 0:
51 80 storres
                    monomialAsString = str(pCoefficients[indexInPmonomials]) + \
52 80 storres
                        " " + str(knownMonomials[knownMonomialIndex])
53 80 storres
                    print monomialAsString, " " * \
54 80 storres
                        (columnsWidth - len(monomialAsString)),
55 80 storres
                # Add the coefficient to the proto matrix row and delete the \
56 80 storres
                # known monomial from the current pMonomial list
57 80 storres
                #(and the corresponding coefficient as well).
58 80 storres
                protoMatrixRowCoefficients.append(pCoefficients[indexInPmonomials])
59 80 storres
                del pMonomials[indexInPmonomials]
60 80 storres
                del pCoefficients[indexInPmonomials]
61 80 storres
            # The knownMonomials element is not in pMonomials
62 80 storres
            except ValueError:
63 80 storres
                protoMatrixRowCoefficients.append(0)
64 80 storres
                if columnsWidth != 0:
65 80 storres
                    monomialAsString = "0" + " "+ \
66 80 storres
                        str(knownMonomials[knownMonomialIndex])
67 80 storres
                    print monomialAsString, " " * \
68 80 storres
                        (columnsWidth - len(monomialAsString)),
69 80 storres
        # End for knownMonomialKey loop.
70 80 storres
        # We now append the remaining monomials of pMonomials to knownMonomials
71 80 storres
        # and the corresponding coefficients to proto matrix row.
72 80 storres
        for pmIdx in xrange(0, len(pMonomials)):
73 80 storres
            knownMonomials.append(pMonomials[pmIdx])
74 80 storres
            protoMatrixRowCoefficients.append(pCoefficients[pmIdx])
75 80 storres
            if columnsWidth != 0:
76 80 storres
                monomialAsString = str(pCoefficients[pmIdx]) + " " \
77 80 storres
                    + str(pMonomials[pmIdx])
78 80 storres
                print monomialAsString, " " * \
79 80 storres
                    (columnsWidth - len(monomialAsString)),
80 80 storres
        # End for pmIdx loop.
81 80 storres
    # Add the new list row elements to the proto matrix.
82 80 storres
    protoMatrixRows.append(protoMatrixRowCoefficients)
83 80 storres
    if columnsWidth != 0:
84 80 storres
        print
85 83 storres
# End spo_add_polynomial_coeffs_to_matrix_row
86 80 storres
87 80 storres
def spo_expression_as_string(powI, powT, powP, alpha):
88 80 storres
    """
89 80 storres
    Computes a string version of the i^k + t^l + p^m + N^n expression for
90 80 storres
    output.
91 80 storres
    """
92 80 storres
    expressionAsString =""
93 80 storres
    if powI != 0:
94 80 storres
        expressionAsString += "i^" + str(powI)
95 80 storres
    if powT != 0:
96 80 storres
        if len(expressionAsString) != 0:
97 80 storres
            expressionAsString += " * "
98 80 storres
        expressionAsString += "t^" + str(powT)
99 80 storres
    if powP != 0:
100 80 storres
        if len(expressionAsString) != 0:
101 80 storres
            expressionAsString += " * "
102 80 storres
        expressionAsString += "p^" + str(powP)
103 80 storres
    if (alpha - powP) != 0 :
104 80 storres
        if len(expressionAsString) != 0:
105 80 storres
            expressionAsString += " * "
106 80 storres
        expressionAsString += "N^" + str(alpha - powP)
107 80 storres
    return(expressionAsString)
108 80 storres
# End spo_expression_as_string.
109 80 storres
110 87 storres
def spo_norm(poly, p=2):
111 81 storres
    """
112 81 storres
    Behaves more or less (no infinity defined) as the norm for the
113 81 storres
    univariate polynomials.
114 81 storres
    Quoting the Sage documentation:
115 81 storres
    Definition: For integer p, the p-norm of a polynomial is the pth root of
116 81 storres
    the sum of the pth powers of the absolute values of the coefficients of
117 81 storres
    the polynomial.
118 87 storres
119 81 storres
    """
120 87 storres
    # TODO: check the arguments (for p see below)..
121 81 storres
    norm = 0
122 87 storres
    # For infinity norm.
123 87 storres
    if p == Infinity:
124 87 storres
        for coefficient in poly.coefficients():
125 87 storres
            coefficientAbs = coefficient.abs()
126 87 storres
            if coefficientAbs > norm:
127 87 storres
                norm = coefficientAbs
128 87 storres
        return norm
129 87 storres
    # TODO: check here the value of p
130 87 storres
    # For 1 norm.
131 87 storres
    if p == 1:
132 87 storres
        for coefficient in poly.coefficients():
133 87 storres
            norm +=  coefficient.abs()
134 87 storres
        return norm
135 87 storres
    # For other norms
136 81 storres
    for coefficient in poly.coefficients():
137 87 storres
        norm +=  (coefficient^p).abs()
138 87 storres
    return pow(norm, 1/p)
139 81 storres
# end spo_norm
140 81 storres
141 83 storres
def spo_polynomial_to_proto_matrix(p, pRing, alpha, N, columnsWidth=0):
142 74 storres
    """
143 83 storres
    From a (bivariate) polynomial and some other parameters build a proto
144 87 storres
    matrix (an array of "rows") to be converted into a "true" matrix and
145 83 storres
    eventually by reduced by fpLLL.
146 80 storres
    The matrix is such as those found in Boneh-Durphee and Stehl?.
147 74 storres
148 83 storres
    Parameters
149 83 storres
    ----------
150 87 storres
    p: the (bivariate) polynomial;
151 87 storres
    pRing: the ring over which p is defined;
152 74 storres
    alpha:
153 74 storres
    N:
154 83 storres
    columsWidth: if == 0, no information is displayed, otherwise data is
155 83 storres
                 printed in colums of columnsWitdth width.
156 74 storres
    """
157 77 storres
    knownMonomials = []
158 77 storres
    protoMatrixRows = []
159 92 storres
    polynomialsList = []
160 74 storres
    pVariables = p.variables()
161 74 storres
    iVariable = pVariables[0]
162 76 storres
    tVariable = pVariables[1]
163 87 storres
    polynomialAtPower = pRing(1)
164 87 storres
    currentPolynomial = pRing(1)
165 74 storres
    pIdegree = p.degree(pVariables[0])
166 74 storres
    pTdegree = p.degree(pVariables[1])
167 87 storres
    currentIdegree = currentPolynomial.degree(iVariable)
168 74 storres
    nAtPower = N^alpha
169 91 storres
    nAtAlpha = nAtPower
170 92 storres
    polExpStr = ""
171 74 storres
    # We work from p^0 * N^alpha to p^alpha * N^0
172 74 storres
    for pPower in xrange(0, alpha + 1):
173 76 storres
        # pPower == 0 is a special case. We introduce all the monomials but one
174 78 storres
        # in i and those in t necessary to be able to introduce
175 76 storres
        # p. We arbitrary choose to introduce the highest degree monomial in i
176 76 storres
        # with p. We also introduce all the mixed i^k * t^l monomials with
177 77 storres
        # k < p.degree(i) and l <= p.degree(t).
178 78 storres
        # Mixed terms introduction is necessary here before we start "i shifts"
179 78 storres
        # in the next iteration.
180 74 storres
        if pPower == 0:
181 78 storres
            # Notice that i^pIdegree is excluded as the bound of the xrange is
182 78 storres
            # pIdegree
183 74 storres
            for iPower in xrange(0, pIdegree):
184 74 storres
                for tPower in xrange(0, pTdegree + 1):
185 77 storres
                    if columnsWidth != 0:
186 92 storres
                        polExpStr = spo_expression_as_string(iPower,
187 76 storres
                                                             tPower,
188 76 storres
                                                             pPower,
189 74 storres
                                                             alpha)
190 92 storres
                        print "->", polExpStr
191 74 storres
                    currentExpression = iVariable^iPower * \
192 91 storres
                                        tVariable^tPower * nAtAlpha
193 78 storres
                    # polynomialAtPower == 1 here. Next line should be commented
194 78 storres
                    # out but it does not work! Some conversion problem?
195 91 storres
                    currentPolynomial = pRing(currentExpression)
196 92 storres
                    polynomialsList.append(polExpStr)
197 74 storres
                    pMonomials = currentPolynomial.monomials()
198 74 storres
                    pCoefficients = currentPolynomial.coefficients()
199 83 storres
                    spo_add_polynomial_coeffs_to_matrix_row(pMonomials,
200 83 storres
                                                            pCoefficients,
201 83 storres
                                                            knownMonomials,
202 83 storres
                                                            protoMatrixRows,
203 83 storres
                                                            columnsWidth)
204 78 storres
                # End tPower.
205 78 storres
            # End for iPower.
206 77 storres
        else: # pPower > 0: (p^1..p^alpha)
207 78 storres
            # This where we introduce the p^pPower * N^(alpha-pPower)
208 77 storres
            # polynomial.
209 77 storres
            # This step could technically be fused as the first iteration
210 77 storres
            # of the next loop (with iPower starting at 0).
211 77 storres
            # We set it apart for clarity.
212 77 storres
            if columnsWidth != 0:
213 92 storres
                polExpStr = spo_expression_as_string(0, 0, pPower, alpha)
214 92 storres
                print "->", polExpStr
215 77 storres
            currentPolynomial = polynomialAtPower * nAtPower
216 92 storres
            polynomialsList.append(polExpStr)
217 77 storres
            pMonomials = currentPolynomial.monomials()
218 77 storres
            pCoefficients = currentPolynomial.coefficients()
219 83 storres
            spo_add_polynomial_coeffs_to_matrix_row(pMonomials,
220 83 storres
                                                    pCoefficients,
221 83 storres
                                                    knownMonomials,
222 83 storres
                                                    protoMatrixRows,
223 83 storres
                                                    columnsWidth)
224 77 storres
225 77 storres
            # The i^iPower * p^pPower polynomials: they add i^k monomials to
226 77 storres
            # p^pPower up to k < pIdegree * pPower. This only introduces i^k
227 77 storres
            # monomials since mixed terms (that were introduced at a previous
228 77 storres
            # stage) are only shifted to already existing
229 77 storres
            # ones. p^pPower is "shifted" to higher degrees in i as far as
230 77 storres
            # possible, one step short of the degree in i of p^(pPower+1) .
231 77 storres
            # These "pure" i^k monomials can only show up with i multiplications.
232 77 storres
            for iPower in xrange(1, pIdegree):
233 87 storres
                if columnsWidth != 0:
234 92 storres
                    polExpStr = spo_expression_as_string(iPower, \
235 87 storres
                                                         0,      \
236 87 storres
                                                         pPower, \
237 87 storres
                                                         alpha)
238 92 storres
                    print "->", polExpStr
239 77 storres
                currentExpression = i^iPower * nAtPower
240 87 storres
                currentPolynomial = pRing(currentExpression) * polynomialAtPower
241 92 storres
                polynomialsList.append(polExpStr)
242 77 storres
                pMonomials = currentPolynomial.monomials()
243 77 storres
                pCoefficients = currentPolynomial.coefficients()
244 87 storres
                spo_add_polynomial_coeffs_to_matrix_row(pMonomials,      \
245 87 storres
                                                        pCoefficients,   \
246 87 storres
                                                        knownMonomials,  \
247 87 storres
                                                        protoMatrixRows, \
248 83 storres
                                                        columnsWidth)
249 77 storres
            # End for iPower
250 77 storres
            # We want now to introduce a t * p^pPower polynomial. But before
251 77 storres
            # that we must introduce some mixed monomials.
252 77 storres
            # This loop is no triggered before pPower == 2.
253 78 storres
            # It introduces a first set of high i degree mixed monomials.
254 77 storres
            for iPower in xrange(1, pPower):
255 77 storres
                tPower = pPower - iPower + 1
256 77 storres
                if columnsWidth != 0:
257 92 storres
                    polExpStr = spo_expression_as_string(iPower * pIdegree,
258 77 storres
                                                         tPower,
259 77 storres
                                                         0,
260 77 storres
                                                         alpha)
261 92 storres
                    print "->", polExpStr
262 91 storres
                currentExpression = i^(iPower * pIdegree) * t^tPower * nAtAlpha
263 87 storres
                currentPolynomial = pRing(currentExpression)
264 92 storres
                polynomialsList.append(polExpStr)
265 77 storres
                pMonomials = currentPolynomial.monomials()
266 77 storres
                pCoefficients = currentPolynomial.coefficients()
267 83 storres
                spo_add_polynomial_coeffs_to_matrix_row(pMonomials,
268 83 storres
                                                        pCoefficients,
269 83 storres
                                                        knownMonomials,
270 83 storres
                                                        protoMatrixRows,
271 83 storres
                                                        columnsWidth)
272 77 storres
            # End for iPower
273 78 storres
            #
274 78 storres
            # This is the mixed monomials main loop. It introduces:
275 77 storres
            # - the missing mixed monomials needed before the
276 78 storres
            #   t^l * p^pPower * N^(alpha-pPower) polynomial;
277 78 storres
            # - the t^l * p^pPower * N^(alpha-pPower) itself;
278 78 storres
            # - for each of i^k * t^l * p^pPower * N^(alpha-pPower) polynomials:
279 78 storres
            #   - the the missing mixed monomials needed  polynomials,
280 78 storres
            #   - the i^k * t^l * p^pPower * N^(alpha-pPower) itself.
281 78 storres
            # The t^l * p^pPower * N^(alpha-pPower) is introduced when
282 78 storres
            #
283 77 storres
            for iShift in xrange(0, pIdegree):
284 77 storres
                # When pTdegree == 1, the following loop only introduces
285 77 storres
                # a single new monomial.
286 77 storres
                #print "++++++++++"
287 77 storres
                for outerTpower in xrange(1, pTdegree + 1):
288 77 storres
                    # First one high i degree mixed monomial.
289 77 storres
                    iPower = iShift + pPower * pIdegree
290 77 storres
                    if columnsWidth != 0:
291 92 storres
                        polExpStr = spo_expression_as_string(iPower,
292 77 storres
                                                             outerTpower,
293 77 storres
                                                             0,
294 77 storres
                                                             alpha)
295 92 storres
                        print "->", polExpStr
296 91 storres
                    currentExpression = i^iPower * t^outerTpower * nAtAlpha
297 87 storres
                    currentPolynomial = pRing(currentExpression)
298 92 storres
                    polynomialsList.append(polExpStr)
299 77 storres
                    pMonomials = currentPolynomial.monomials()
300 77 storres
                    pCoefficients = currentPolynomial.coefficients()
301 83 storres
                    spo_add_polynomial_coeffs_to_matrix_row(pMonomials,
302 83 storres
                                                            pCoefficients,
303 83 storres
                                                            knownMonomials,
304 83 storres
                                                            protoMatrixRows,
305 83 storres
                                                            columnsWidth)
306 77 storres
                    #print "+++++"
307 78 storres
                    # At iShift == 0, the following innerTpower loop adds
308 78 storres
                    # duplicate monomials, since no extra i^l * t^k is needed
309 78 storres
                    # before introducing the
310 77 storres
                    # i^iShift * t^outerPpower * p^pPower * N^(alpha-pPower)
311 77 storres
                    # polynomial.
312 77 storres
                    # It introduces smaller i degree monomials than the
313 77 storres
                    # one(s) added previously (no pPower multiplication).
314 77 storres
                    # Here the exponent of t decreases as that of i increases.
315 78 storres
                    # This conditional is not entered before pPower == 1.
316 78 storres
                    # The innerTpower loop does not produce anything before
317 78 storres
                    # pPower == 2. We keep it anyway for other configuration of
318 78 storres
                    # p.
319 77 storres
                    if iShift > 0:
320 77 storres
                        iPower = pIdegree + iShift
321 77 storres
                        for innerTpower in xrange(pPower, 1, -1):
322 77 storres
                            if columnsWidth != 0:
323 92 storres
                                polExpStr = spo_expression_as_string(iPower,
324 77 storres
                                                                     innerTpower,
325 77 storres
                                                                     0,
326 77 storres
                                                                     alpha)
327 77 storres
                            currentExpression = \
328 91 storres
                                    i^(iPower) * t^(innerTpower) * nAtAlpha
329 87 storres
                            currentPolynomial = pRing(currentExpression)
330 92 storres
                            polynomialsList.append(polExpStr)
331 77 storres
                            pMonomials = currentPolynomial.monomials()
332 77 storres
                            pCoefficients = currentPolynomial.coefficients()
333 83 storres
                            spo_add_polynomial_coeffs_to_matrix_row(pMonomials,
334 77 storres
                                                                pCoefficients,
335 77 storres
                                                                knownMonomials,
336 77 storres
                                                                protoMatrixRows,
337 77 storres
                                                                columnsWidth)
338 77 storres
                            iPower += pIdegree
339 77 storres
                        # End for innerTpower
340 77 storres
                    # End of if iShift > 0
341 78 storres
                    # When iShift == 0, just after each of the
342 78 storres
                    # p^pPower * N^(alpha-pPower) polynomials has
343 78 storres
                    # been introduced (followed by a string of
344 78 storres
                    # i^k * p^pPower * N^(alpha-pPower) polynomials) a
345 78 storres
                    # t^l *  p^pPower * N^(alpha-pPower) is introduced here.
346 78 storres
                    #
347 77 storres
                    # Eventually, the following section introduces the
348 77 storres
                    # i^iShift * t^outerTpower * p^iPower * N^(alpha-iPower)
349 77 storres
                    # polynomials.
350 77 storres
                    if columnsWidth != 0:
351 92 storres
                        polExpStr = spo_expression_as_string(iShift,
352 77 storres
                                                             outerTpower,
353 77 storres
                                                             pPower,
354 77 storres
                                                             alpha)
355 92 storres
                        print "->", polExpStr
356 77 storres
                    currentExpression = i^iShift * t^outerTpower * nAtPower
357 87 storres
                    currentPolynomial = pRing(currentExpression) * polynomialAtPower
358 92 storres
                    polynomialsList.append(polExpStr)
359 77 storres
                    pMonomials = currentPolynomial.monomials()
360 77 storres
                    pCoefficients = currentPolynomial.coefficients()
361 83 storres
                    spo_add_polynomial_coeffs_to_matrix_row(pMonomials,
362 83 storres
                                                            pCoefficients,
363 83 storres
                                                            knownMonomials,
364 83 storres
                                                            protoMatrixRows,
365 83 storres
                                                            columnsWidth)
366 77 storres
                # End for outerTpower
367 77 storres
                #print "++++++++++"
368 77 storres
            # End for iShift
369 77 storres
        polynomialAtPower *= p
370 77 storres
        nAtPower /= N
371 77 storres
    # End for pPower loop
372 92 storres
    return ((protoMatrixRows, knownMonomials, polynomialsList))
373 83 storres
# End spo_polynomial_to_proto_matrix
374 81 storres
375 90 storres
def spo_proto_to_column_matrix(protoMatrixColumns, \
376 90 storres
                               knownMonomialsList, \
377 90 storres
                               boundVar1, \
378 90 storres
                               boundVar2):
379 83 storres
    """
380 87 storres
    Create a column (each row holds the coefficients of one monomial) matrix.
381 83 storres
    protoMatrixRows.
382 83 storres
383 83 storres
    Parameters
384 83 storres
    ----------
385 87 storres
    protoMatrixColumns: a list of coefficient lists.
386 83 storres
    """
387 87 storres
    numColumns = len(protoMatrixColumns)
388 87 storres
    if numColumns == 0:
389 83 storres
        return None
390 87 storres
    # The last column holds has the maximum length.
391 87 storres
    numRows = len(protoMatrixColumns[numColumns-1])
392 83 storres
    if numColumns == 0:
393 83 storres
        return None
394 83 storres
    baseMatrix = matrix(ZZ, numRows, numColumns)
395 87 storres
    for colIndex in xrange(0, numColumns):
396 87 storres
        for rowIndex in xrange(0, len(protoMatrixColumns[colIndex])):
397 90 storres
            if protoMatrixColumns[colIndex][rowIndex] != 0:
398 90 storres
                baseMatrix[rowIndex, colIndex] = \
399 90 storres
                    protoMatrixColumns[colIndex][rowIndex] * \
400 90 storres
                    knownMonomialsList[rowIndex](boundVar1, boundVar2)
401 83 storres
    return baseMatrix
402 83 storres
# End spo_proto_to_column_matrix.
403 83 storres
#
404 88 storres
def spo_proto_to_row_matrix(protoMatrixRows, \
405 88 storres
                            knownMonomialsList, \
406 88 storres
                            boundVar1, \
407 88 storres
                            boundVar2):
408 83 storres
    """
409 90 storres
    Create a row (each column holds the evaluation one monomial at boundVar1 and
410 90 storres
    boundVar2 values) matrix.
411 83 storres
412 83 storres
    Parameters
413 83 storres
    ----------
414 83 storres
    protoMatrixRows: a list of coefficient lists.
415 83 storres
    """
416 83 storres
    numRows = len(protoMatrixRows)
417 83 storres
    if numRows == 0:
418 83 storres
        return None
419 91 storres
    # The last row is the longest one.
420 83 storres
    numColumns = len(protoMatrixRows[numRows-1])
421 83 storres
    if numColumns == 0:
422 83 storres
        return None
423 83 storres
    baseMatrix = matrix(ZZ, numRows, numColumns)
424 83 storres
    for rowIndex in xrange(0, numRows):
425 83 storres
        for colIndex in xrange(0, len(protoMatrixRows[rowIndex])):
426 89 storres
            if protoMatrixRows[rowIndex][colIndex] !=  0:
427 89 storres
                baseMatrix[rowIndex, colIndex] = \
428 89 storres
                    protoMatrixRows[rowIndex][colIndex] * \
429 89 storres
                    knownMonomialsList[colIndex](boundVar1,boundVar2)
430 89 storres
            #print rowIndex, colIndex,
431 89 storres
            #print protoMatrixRows[rowIndex][colIndex],
432 89 storres
            #print knownMonomialsList[colIndex](boundVar1,boundVar2)
433 83 storres
    return baseMatrix
434 83 storres
# End spo_proto_to_row_matrix.
435 83 storres
#
436 87 storres
print "\t...sagePolynomialOperations loaded"