| Bill Allombert on Fri, 30 Dec 2016 18:24:45 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Getting a very large polynomial into pari/gp |
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("a.gp")
> >
> > 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.gp");
> 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.gp");
A = Pol(a);
Cheers,
Bill.