Jack Fearnley on Wed, 06 May 2009 17:41:08 +0200


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

Re: Updating an old C program which uses parilib


Karim Belabas wrote:
* Bill Allombert [2009-05-05 17:30]:
  
On Tue, May 05, 2009 at 10:58:16AM -0400, Jack Fearnley wrote:
    
I am trying to run a program I wrote and ran successfully some years  
back.  It computes Dirichlet twists of elliptic L-functions.  The  
program uses  lisGEN which seems no longer to exist.  The usage is
ee = smallinitell(lisGEN(stdin));
where stdin contains [0,1,0,4,4] for example.

There seems to be no exact replacement for this function so I am using  
scanf to read the five coefficients as longs and then using mkvecn to  
package the coefficients into a vector.
scanf("%ld %ld %ld %ld %ld",&c1,&c2,&c3,&c4,&c5);
       printf("%ld %ld %ld %ld %ld \n",c1,c2,c3,c4,c5);
   eee=mkvecn(5,(GEN)c1,(GEN)c2,(GEN)c3,(GEN)c4,(GEN)c5);
   ee = smallinitell(eee);

Where ee and eee are defined as GEN.

The printed result is


0 1 0 4 4

 ***   segmentation fault: bug in PARI or calling program.
 ***   Error in the PARI system. End of program.

1) Is there an exact replacement for lisGEN?
      
yes, gp_read_stream. thought it seems we forgot to add it to the COMPAT
file.
    
[...]

  
3) Where did gzero go?
      
It has been renamed to gen_0, see the COMPAT file.
    

There is something fishy in Jack's setup: for backward compatibility
both gzero and lisGEN are aliased to the correct names (given above) in
the file pariold.h.

That file should have been installed in /usr/local/include/pari/.

Are your header files up to date ? (and properly included, they may be
overridden by another older install)

What exact version of PARI are you trying to run ?

Cheers,

    K.B.

P.S:  There has been a massive cleanup in libpari names:

- lisGEN has been obsoleted about four years age, and
successively renamed readexpr(), then freadexpr(), before the new name
settled in. Reason: french name.

- gun, gzero & friends have been renamed : 'gun' was way too
  short ( and french ), 'un' was even worse !

--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`

  
My setup  2004 dates from 2004 and ran correctly at that time.  I recently changed my Linux operating to Ubuntu 9.04 and downloaded Sage which includes Pari 2.3.3.
When I tried to run my ancient program it failed from what was probably a PATH problem.  Rather than search through Sage I decided to download the latest stable  copy of Pari which is 2.3.4.  I put it in /opt which is probably a mistake since /usr/local seems to be the default.  (I did this to stay away from the standard Ubuntu application packages.)

I have probably complicated my life unnecessarily but the program now seems to work with Bill Allombert's corrections.


If anyone is interested, the beginning of my program shows

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "jack.h"
#include <pari.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <complex.h>

and is compiled and executed from ~/csearch.

Best regards,
                     Jack Fearnley