Ticket #7578: 7578_basic_arithmetic.patch

File 7578_basic_arithmetic.patch, 1.3 KB (added by SimonKing, 12 years ago)

Improving basic arithmetic of infinite polynomial rings

  • sage/rings/polynomial/infinite_polynomial_element.py

    # HG changeset patch
    # User Simon King <simon.king@nuigalway.ie>
    # Date 1259709535 0
    # Node ID 3c7f788ea9cf10aa7723a650cbd2162cc34c6367
    # Parent  5db805d3bdafb3f79835cff2af6a333f749b500c
    Improving performance of basic arithmetic in infinite polynomial rings
    
    diff -r 5db805d3bdaf -r 3c7f788ea9cf sage/rings/polynomial/infinite_polynomial_element.py
    a b  
    11571157            x2 + x1
    11581158
    11591159        """
     1160        P = self.parent()
     1161        self._p = P._P(self._p)
     1162        x._p = P._P(x._p)
    11601163        return InfinitePolynomial_dense(self.parent(),self._p + x._p, is_good_poly=True)
    11611164
    11621165    def _mul_(self, x):
     
    11681171            x2*x1
    11691172
    11701173        """
     1174        P = self.parent()
     1175        self._p = P._P(self._p)
     1176        x._p = P._P(x._p)
    11711177        return InfinitePolynomial_dense(self.parent(),self._p * x._p, is_good_poly=True)
    11721178
    11731179
     
    12031209            x2 - x1
    12041210
    12051211        """
     1212        P = self.parent()
     1213        self._p = P._P(self._p)
     1214        x._p = P._P(x._p)
    12061215        return InfinitePolynomial_dense(self.parent(), self._p - x._p, is_good_poly=True)
    12071216
    12081217    def __pow__(self, n):