Bill Allombert on Wed, 18 Jan 2006 21:36:08 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Two suggestions: |
On Wed, Jan 18, 2006 at 03:36:14PM +0000, Prof. J. E. Cremona wrote: > (1) As Bill has reported, although ellsearch() allows one to take from > the database all elliptic curves with a given conductor, it is > inefficient to do this in a loop, say from N=N1 to N=N2, since each call > to ellsearch() causes the entire relevant database file to be read in. > > I suggest adding a function of the form > > forell(E,N1,N2, seq ) which would execute seq for all elliptic curves E > in the database with N1 <= cond(E) <= N2; which would only read each > file once. > > That's my first wish-list suggestion (of 2006). Here a patch that do that. The issue I see is that there is no easy way to get the conductor from the curve... which lead us to your second wishlist. In particular there are no easy ways to rewrite src/test/in/ellglobalred in term of forell. Should ellsearch (et al.) returns curves names as string or as triple [cond,"class",index] ? Maybe what we need is a set of members functions to handle such data. Cheers, Bill.
Index: src/headers/paridecl.h =================================================================== RCS file: /home/cvs/pari/src/headers/paridecl.h,v retrieving revision 1.561 diff -u -r1.561 paridecl.h --- src/headers/paridecl.h 9 Jan 2006 12:05:10 -0000 1.561 +++ src/headers/paridecl.h 18 Jan 2006 19:36:18 -0000 @@ -877,6 +877,7 @@ long ellnamecond(const char *s); GEN ellsearch(GEN A); GEN ellsearchcurve(GEN name); +void forell(entree *ep, long a, long b, char *ch); /* elliptic.c */ Index: src/modules/elldata.c =================================================================== RCS file: /home/cvs/pari/src/modules/elldata.c,v retrieving revision 1.9 diff -u -r1.9 elldata.c --- src/modules/elldata.c 9 Dec 2005 18:14:24 -0000 1.9 +++ src/modules/elldata.c 18 Jan 2006 20:16:08 -0000 @@ -20,6 +20,7 @@ /********************************************************************/ #include "pari.h" #include "paripriv.h" +#include "../language/anal.h" static long strtoclass(const char *s) @@ -196,4 +197,37 @@ GEN gens=gmael(V,1,3); GEN W=pointchinv(gens,gel(V,2)); return gerepileupto(ltop,W); +} + +void +forell(entree *ep, long a, long b, char *ch) +{ + long ca=a/1000, cb=b/1000; + long i, j, k; + for(i=ca; i<=cb; i++) + { + pari_sp ltop=avma; + GEN V=ellcondfile(i*1000); + for (j=1; j<lg(V); j++) + { + GEN ells=gel(V,j); + long cond=itos(gel(ells,1)); + + if (i==ca && cond<a) + continue; + if (i==cb && cond>b) + break; + for(k=2; k<lg(ells); k++) + { + pari_sp btop=avma; + push_val(ep, gel(ells, k)); + readseq_void(ch); + avma=btop; + if (loop_break()) goto forell_end; + } + } + avma=ltop; + } + forell_end: + pop_val(ep); } --- /dev/null Wed Jul 2 16:24:28 2003 +++ src/functions/programming/forell Wed Jan 18 20:33:58 2006 @@ -0,0 +1,7 @@ +Function: forell +Section: programming +C-Name: forell +Prototype: vVLLI +Help: forell(E,a,b,seq): execute seq for each elliptic curves E of conductor + between a and b in the elldata database. +