# Ticket #7587: trac_7587-multi_polynomial_libsingular_exponents.patch

File trac_7587-multi_polynomial_libsingular_exponents.patch, 1.9 KB (added by ylchapuy, 13 years ago)

based on 4.3.alpha0

• ## sage/rings/polynomial/multi_polynomial_libsingular.pyx

```# HG changeset patch
# User Yann Laigle-Chapuy <yannlaiglechapuy@gmail.com>
# Date 1259792211 -3600
# Node ID 067c5fd7936bd663f6d1aacbaf5741874fa893e4
# Parent  44f70d431d43e3dfaa1487641ee6864d5025fb06
improve multi_polynomial_libsingular exponents

diff -r 44f70d431d43 -r 067c5fd7936b sage/rings/polynomial/multi_polynomial_libsingular.pyx```
 a p_Delete(&m,r) return (self._parent)._base._zero_element def exponents(self): def exponents(self, as_ETuples=True): """ Return the exponents of the monomials appearing in this polynomial. INPUT: - ``as_ETuples`` - (default: ``True``) if true returns the result as an list of ETuples otherwise returns a list of tuples EXAMPLES:: sage: R. = QQ[] sage: f = a^3 + b + 2*b^2 sage: f.exponents() [(3, 0, 0), (0, 2, 0), (0, 1, 0)] sage: f.exponents(as_ETuples=False) [(3, 0, 0), (0, 2, 0), (0, 1, 0)] """ cdef poly *p cdef ring *r cdef int v r = (self._parent)._ring cdef list pl, ml r = (self._parent)._ring p = self._poly pl = list() while p: ml = list() ml = range(r.N) while p: for v from 1 <= v <= r.N: ml.append(p_GetExp(p,v,r)) pl.append(ETuple(ml)) ml[v-1] = p_GetExp(p,v,r) if as_ETuples: pl.append(ETuple(ml)) else: pl.append(tuple(ml)) p = pNext(p) return pl