Loïc Grenié on Thu, 24 Oct 2013 09:16:43 +0200

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

Re: parallel pari: parfirst

2013/10/23 Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>:
> Hello PARI developers,
> I am experimenting with a new parallel primitive which is a kind of
> parapply with early return:
> ?? parfirst(f, x, {&b}):
>    Return the smallest index i such that f(x[i]) is non zero, or 0 if none.  If
> present, b is to f(x[i]).
> One example program:
> inline(chkell);
> chkell(p)=a->my(E=ellinit([1,a],p));isprime(ellcard(E));
> ellp(p)=parfirst(chkell(p),[1..10000]);
> ellp(p) returns the smallest a>=1 such that the curve y^2=x^3+x+a has prime
> order over F_p.

    A "parbreak()"-like would be a little bit more general. You add a
  part to pareval


  where i is the input of the function called in parallel and r its output.
  Then test would return 0 (go on) or !0 (stop) (in your example,
  test(i,r)=r). test() is evaluated in the main pari, so it can use/modify
  global variables.