| Karim Belabas on Wed, 08 May 2013 22:16:02 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: Extracting numbers from strings |
* Richard in Reading [2013-05-08 18:40]:
> I'm using forell to search through elliptic curves and I want to extract the numeric value of the conductor preferably without using ellinit and ellglobalred which make it too slow.
> As an example, I'd like to be able to replicate the following
>
> forell(E,1,100,print(E[1]"\t"ellglobalred(ellinit(E[2]))[1]))
>
> 11a1 11
> 11a2 11
> 11a3 11
> 14a1 14
> 14a2 14
>
> just by manipulating E[1] instead of dealing with E[2]. Hopefully this would be faster.
For this particular problem, you can use
N = ellconvertname(E[1])[1]
( or even [N,isogeny_class,index] = E[1] in 2.6.* )
In general, you would have to use Vecsmall(str) then test ASCII values
(not pretty), or use Unix-specific hacks of the form
str_to_cond(str) = extern(Str("echo ", str, "| sed 's/[^0-9].*//'"))
Cheers,
K.B.
--
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/~kbelabas/
F-33405 Talence (France) http://pari.math.u-bordeaux1.fr/ [PARI/GP]
`