@@ -12,64 +12,70 @@ cdef class flint_elem:
1212
1313cdef class flint_scalar(flint_elem):
1414 pass
15-
16- cdef class flint_poly(flint_elem):
17- """
18- Base class for polynomials.
19- """
20-
21- def __iter__ (self ):
22- cdef long i, n
23- n = self .length()
24- for i in range (n):
25- yield self [i]
26-
27- def coeffs (self ):
28- return list (self )
29-
30- def str (self , bint ascending = False ):
31- """
32- Convert to a human-readable string (generic implementation for
33- all polynomial types).
34-
35- If *ascending* is *True*, the monomials are output from low degree to
36- high, otherwise from high to low.
37- """
38- coeffs = [str (c) for c in self ]
39- if not coeffs:
40- return " 0"
41- s = []
42- coeffs = enumerate (coeffs)
43- if not ascending:
44- coeffs = reversed (list (coeffs))
45- for i, c in coeffs:
46- if c == " 0" :
47- continue
48- else :
49- if c.startswith(" -" ) or (" " in c):
50- c = " (" + c + " )"
51- if i == 0 :
52- s.append(" %s " % c)
53- elif i == 1 :
54- if c == " 1" :
55- s.append(" x" )
56- else :
57- s.append(" %s *x" % c)
58- else :
59- if c == " 1" :
60- s.append(" x^%s " % i)
61- else :
62- s.append(" %s *x^%s " % (c, i))
63- return " + " .join(s)
64-
65- # TODO: why is this template class defining something for
66- # acb_poly??
67- # def roots(self, **kwargs):
68- # """
69- # Isolates the complex roots of *self*. See :meth:`.acb_poly.roots`
70- # for details.
71- # """
72- # return acb_poly(self).roots(**kwargs)
15+
16+ # TODO:
17+ # We cannot include this class until we can import
18+ # acb_poly, so for now we leave this class as a global
19+ # inside pyflint.pyx
20+ #
21+ # cdef class flint_poly(flint_elem):
22+ # """
23+ # Base class for polynomials.
24+ # """
25+
26+ # def __iter__(self):
27+ # cdef long i, n
28+ # n = self.length()
29+ # for i in range(n):
30+ # yield self[i]
31+
32+ # def coeffs(self):
33+ # return list(self)
34+
35+ # def str(self, bint ascending=False):
36+ # """
37+ # Convert to a human-readable string (generic implementation for
38+ # all polynomial types).
39+
40+ # If *ascending* is *True*, the monomials are output from low degree to
41+ # high, otherwise from high to low.
42+ # """
43+ # coeffs = [str(c) for c in self]
44+ # if not coeffs:
45+ # return "0"
46+ # s = []
47+ # coeffs = enumerate(coeffs)
48+ # if not ascending:
49+ # coeffs = reversed(list(coeffs))
50+ # for i, c in coeffs:
51+ # if c == "0":
52+ # continue
53+ # else:
54+ # if c.startswith("-") or (" " in c):
55+ # c = "(" + c + ")"
56+ # if i == 0:
57+ # s.append("%s" % c)
58+ # elif i == 1:
59+ # if c == "1":
60+ # s.append("x")
61+ # else:
62+ # s.append("%s*x" % c)
63+ # else:
64+ # if c == "1":
65+ # s.append("x^%s" % i)
66+ # else:
67+ # s.append("%s*x^%s" % (c, i))
68+ # return " + ".join(s)
69+
70+ # def roots(self, **kwargs):
71+ # """
72+ # Isolates the complex roots of *self*. See :meth:`.acb_poly.roots`
73+ # for details.
74+ # """
75+ # # TODO:
76+ # # To avoid circular imports, we import within the method
77+ # from XXX.XXX.acb_poly import acb_poly
78+ # return acb_poly(self).roots(**kwargs)
7379
7480cdef class flint_mpoly(flint_elem):
7581 """
0 commit comments