Neill Clift on Sat, 31 Dec 2016 04:38:07 +0100

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Getting a very large polynomial into pari/gp

Thanks guys! I used the vector read and that worked. Of course it's 
taking a lot longer to do the gcd than my experiments with sparse 
polynomials :-(.

On 12/30/2016 9:24 AM, Bill Allombert wrote:
> On Fri, Dec 30, 2016 at 11:31:55AM +0100, Karim Belabas wrote:
>> * Neill Clift [2016-12-30 06:17]:
>>> Hi,
>>> I want to do a gcd with two polynomials with 16 million coefficients mod
>>> a large 64 bit prime.
>>> Playing with gp with some sparse polynomials it looks like it can do the
>>> calculation.
>>> If I try to read in a dense polynomial of large size though gp overflows
>>> its stack (runs out of thread stack space, not a buffer overflow or gp
>>> stack).
>>> I assume your parser is putting a lot of data on the thread stack.
>>> I am using a command like this:
>>> gp > a = read("")
>>> I am doing this on windows.
>>> Is there some kind of raw read or similar that will let me get a large
>>> polynomial into gp? I can put the data into different formats rather
>>> than the symbolic format I am trying currently.
>> 1) The most natural way would be to just (re)create the polynomials
>> inside gp.
>> 2) If this is not possible, you can try a vector of coefficients. Then
>>    a = read("");
>>    A = Pol(a); \\ leading coeff in a[1], etc.
> Or maybe better: write a file with one coefficient by line, and then do
> a = readvec("");
> A = Pol(a);
> Cheers,
> Bill.