2

I am trying to use the PARI library for C. I am new to it. Whenever I try to use any function I get a segmentation fault or stack overflow error. Can anyone please provide me a link with detailed functionality of all constructs and functions in PARI? I want to use sets and vectors also. Is there any function like power of x?

Emond
  • 50,210
  • 11
  • 84
  • 115
siri
  • 713
  • 3
  • 11
  • 24

2 Answers2

1

There are several powring functions in PARI. powii takes to GEN pointers representing integers and returns a GEN representing the power. gpow takes any two GENs and returns their power. powuu takes two uints and returns a GEN. And so forth.

See the User's Guide to the PARI Library for more details. There are links to tutorials at

http://rosettacode.org/wiki/Category:PARI/GP#Resources

Charles
  • 11,269
  • 13
  • 67
  • 105
0

The stack overflow depends on how much RAM you have. I have an 8-GB RAM PC and my stack can go up close to 1000 MB:

(12:14) gp > allocatemem
  ***   Warning: new stack size = 8000000 (7.629 Mbytes).
(12:18) gp > allocatemem
  ***   Warning: new stack size = 16000000 (15.259 Mbytes).
(12:18) gp > allocatemem
  ***   Warning: new stack size = 32000000 (30.518 Mbytes).
(12:18) gp > allocatemem
  ***   Warning: new stack size = 64000000 (61.035 Mbytes).
(12:18) gp > allocatemem
  ***   Warning: new stack size = 128000000 (122.070 Mbytes).
(12:18) gp > allocatemem
  ***   Warning: new stack size = 256000000 (244.141 Mbytes).
(12:18) gp > allocatemem
  ***   Warning: new stack size = 512000000 (488.281 Mbytes).
(12:18) gp > allocatemem
  ***   Warning: new stack size = 1024000000 (976.563 Mbytes).
(12:18) gp > allocatemem
  ***   Warning: not enough memory, new stack 1024000000.
  ***   Warning: new stack size = 1024000000 (976.563 Mbytes).

If you go past that and still get stack overflow, it's probably too much for Pari/GP to handle.

Then there is the documentation.

J. Linne
  • 275
  • 4
  • 15