Aleksandr Lenin on Sun, 11 Mar 2018 11:10:24 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Casting t_POL to t_FFELT? |
Hello I noticed that the string repreentation of the t_FFELT (finite field) elements is exactly identical to the polynomial. Consider a field F_{137^2} defined by polynomial x^2 + x + 1 that is irreducible over F_137. Consider an element of F_{137^2} 136x + 136, which is a 3-rd order root of unity in this field. When I obtain 136x + 136 as the result of FF_sqrtn() call, its type is t_FFELT. Then I write it to a string representation as 136x + 136. At this point, the information about the finite field is lost. When I try to read this value back read it back as gp_read_str("136x + 136"), the program does not recognize that this value was once an element of a finite field, and gives me a polynomial instead (t_POL). I closely inspected the PARI library manual, but could not find any meaningful method to convert a t_POL back into t_FFELT. Is there any? I ended up with a weird code reconstructing a t_FFELT coefficientwise from the coefficients of the corresponding t_POL, but this code looks ugly and I think there must be a better way of doing it. -- With kind regards, Aleksandr Lenin