\\% Basic manipulations of vectors. \\ Author: Ralf Stephan, (reformatted by Joerg Arndt) \\ online at http://www.jjj.de/pari/ \\ version: 2010-April-02 (18:00) ggf(v)= { /* Guess generating function for supplied vector of integers */ /* Example: ggf(vector(10,j,fibonacci(j)^2)) ==> (-x + 1)/(x^3 - 2*x^2 - 2*x + 1) */ local(l,m,p,q,B); l = length(v); B = floor(l/2); if ( B<4, return(0) ); m = matrix(B, B, x, y, v[x-y+B+1]); q = qflll(m, 4)[1]; if ( length(q)==0, return(0) ); \\ p = sum(k=1, B, x^(k-1)*q[k,1]); p = sum(k=1, B, 'x^(k-1)*q[k,1]); \\ q = Pol( Pol( vector(l, n, v[l-n+1]) )*p + O(x^(B+1)) ); q = Pol( Pol( vector(l, n, v[l-n+1]) )*p + O('x^(B+1)) ); if ( polcoeff(p,0)<0, q=-q; p=-p); q = q/p; \\ p = Ser(q+O(x^(l+1))); p = Ser(q+O('x^(l+1))); for (m=1, l, if( polcoeff(p,m-1)!=v[m], return(0)) ); return(q); } /* ------- */ \\ qflll(x,{flag=0}): LLL reduction of the vectors forming the matrix x \\ (gives the unimodular transformation matrix). \\ flag is optional, and can be \\ 0: default, \\ 1: lllint algorithm for integer matrices, \\ 2: lllintpartial algorithm for integer matrices, \\ 3: lllrat for rational matrices, \\ 4: lllkerim giving the kernel and the LLL reduced image, \\ 5: lllkerimgen same but if the matrix has polynomial coefficients, \\ 7: lll1, old version of qflll, \\ 8: lllgen, same as qflll when the coefficients are polynomials, \\ 9: lllint algorithm for integer matrices using content. \\ ==== end of file ====