Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

from cysignals.signals cimport sig_on 

from cypari2.paridecl cimport * 

from cypari2.stack cimport new_gen 

  

  

cdef Gen new_t_POL_from_int_star(int* vals, unsigned long length, long varnum): 

""" 

Convert an array of ints to a PARI polynomial. 

  

Note that ``length = degree + 1``, so that recognizing 0 is easier. 

""" 

cdef GEN z 

cdef unsigned long i 

  

sig_on() 

z = cgetg(length + 2, t_POL) 

if length == 0: 

# Polynomial is zero 

z[1] = evalvarn(varnum) + evalsigne(0) 

else: 

z[1] = evalvarn(varnum) + evalsigne(1) 

for i in range(length): 

set_gel(z, i+2, stoi(vals[i])) 

  

return new_gen(z)