Sorry, I overlooked the question and only saw it now. > > What are you using to link Python and Pari's C? > In pari there is a special database (in the 'desc' directory of the source distribution) of all functions that are exposed to the interpreter. So I use a perl script that for each function in the list generates a python function using certain conventions for transforming parameters. In pari there are several types of parameters and you need to handle them appropriately. The easiest cases are when parameter is a GEN or a long, so you don't need any special handling.
I explain on the example of intnum. Pari's intnum is called as follows: intnum(t=0,1, t^2). So the actual C function takes 4 parameters. The first one is a 'variable', which has the type "entree". Then come two limits of integration, and finally a string which will be parsed later. So the function intnum sets the value of this entree and evaluates the string to get the value of the integrand at a certain point. In python the function is called like this: intnum(0,1,lambda t: t^2) My realization of intnum creates an empty entree, and as the string to evaluate it sends special string that contains a reference to this entree and a reference to the python function (which was given by lambda t: t^2). Also there is a way in PARI to override the parser which will parse a string. If you send a sequence of strings which starts with a certain character then my parser is called. So my parser simply extracts the references to the entree and to the function, reads the value from the entree and calls the functions with this value as the argument. So as soon you know what to do with each parameter type you simply 'import' all pari's function using a script. Anton --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-forum URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~----------~----~----~----~------~----~------~--~---
