1

I am working with GP and minimum polynomials as follows running on ASUS x75:

(19:25) gp > elt=Mod(a*x^3+b*x^2+c*x+d,('x^5-1)/('x-1))
%122 = Mod(a*x^3 + b*x^2 + c*x + d, x^4 + x^3 + x^2 + x + 1)
(19:25) gp > (poly=minpoly(elt,x='x))
%123 = x^4 + (a + (b + (c - 4*d)))*x^3 + (a^2 + (-3*b + (2*c - 3*d))*a + (b^2 + (2*c - 3*d)*b + (c^2 - 3*d*c + 6*d^2)))*x^2 + (a^3 + (-2*b + (3*c - 2*d))*a^2 + (-2*b^2 + (c + 6*d)*b + (-2*c^2 - 4*d*c + 3*d^2))*a + (b^3 + (-2*c - 2*d)*b^2 + (3*c^2 - 4*d*c + 3*d^2)*b + (c^3 - 2*d*c^2 + 3*d^2*c - 4*d^3)))*x + (a^4 + (-b + (-c - d))*a^3 + (b^2 + (2*c + 2*d)*b + (c^2 - 3*d*c + d^2))*a^2 + (-b^3 + (-3*c + 2*d)*b^2 + (2*c^2 - d*c - 3*d^2)*b + (-c^3 + 2*d*c^2 + 2*d^2*c - d^3))*a + (b^4 + (-c - d)*b^3 + (c^2 + 2*d*c + d^2)*b^2 + (-c^3 - 3*d*c^2 + 2*d^2*c - d^3)*b + (c^4 - d*c^3 + d^2*c^2 - d^3*c + d^4)))

The first command came out successfully, while the second one below did finish successfully and gave an allocatemem() error. How is it possible to get the second command to work, without overheating the computer or program exhaustion? And the WHOLE output to command below this is needed. Thanks for the help.

(19:23) gp > elt=Mod(a*x^5+b*x^4+c*x^3+d*x^2+e*x+f,('x^7-1)/('x-1))
%120 = Mod(a*x^5 + b*x^4 + c*x^3 + d*x^2 + e*x + f, x^6 + x^5 + x^4 + x^3 + x^2 + x + 1)
(19:23) gp > (poly=minpoly(elt,x='x))
  ***   at top-level: poly=minpoly(elt,x='x)
  ***                      ^-----------------
  *** minpoly: the PARI stack overflows !
  current stack size: 9000000 (8.583 Mbytes)
  [hint] you can increase GP stack with allocatemem()
Piotr Semenov
  • 1,761
  • 16
  • 24
J. Linne
  • 275
  • 4
  • 15

2 Answers2

5

You can increase the PARI/GP's heap up to any limit you want at run-time following the example below (demonstrates how to set heap size to 120000000 bytes):

default(parisize, 120000000)
Piotr Semenov
  • 1,761
  • 16
  • 24
  • The hint suggests `allocatemem(120*10^6)`, but you do `default(parisize, 120*10^6)`. Will the latter actually allocate more memory if the session has already been started and used with a smaller size? Is there any difference between calling `allocatemem` and just setting the _default_ `parisize` to a new value? – Jeppe Stig Nielsen Jun 28 '17 at 11:06
  • 3
    @JeppeStigNielsen Please, review this: https://pari.math.u-bordeaux.fr/dochtml/html/Programming_in_GP__other_specific_functions.html#allocatemem. That section says that `allocatemem(...)` and `default(parisize,...)` are synonyms for the common case. – Piotr Semenov Jun 28 '17 at 14:56
1

default(parisize, 10000000000) is more than 8 GB and in my case was enough to make advanced calculations with matrices.