1 | #cargs -std=c99 -O3 -ggdb |
---|

2 | #cinclude $SAGE_ROOT/devel/sage/sage/libs/flint $SAGE_LOCAL/include/FLINT |
---|

3 | #clib flint |
---|

4 | #cfile /home/malb/Sage/m4rie/devel/sage/sage/libs/flint/fmpq_poly.c |
---|

5 | |
---|

6 | from sage.rings.rational cimport Rational |
---|

7 | from sage.rings.polynomial.polynomial_rational_flint cimport Polynomial_rational_flint |
---|

8 | from sage.libs.flint.fmpq_poly cimport (fmpq_poly_get_coeff_mpq, fmpq_poly_set_coeff_mpq, |
---|

9 | fmpq_poly_length) |
---|

10 | |
---|

11 | def evaluate_at_power_of_gen(Polynomial_rational_flint f, unsigned long n): |
---|

12 | assert n >= 1 |
---|

13 | cdef Polynomial_rational_flint res = f._new() |
---|

14 | cdef unsigned long k |
---|

15 | cdef Rational z = Rational(0) |
---|

16 | for k in range(fmpq_poly_length(f.__poly)): |
---|

17 | fmpq_poly_get_coeff_mpq(z.value, f.__poly, k) |
---|

18 | fmpq_poly_set_coeff_mpq(res.__poly, n*k, z.value) |
---|

19 | return res |
---|