Vectorize calculations in kuiper_false_positive_probability.
Vectorize calculations in kuiper_false_positive_probability.

In the 1/2 < D regime (where the number of summands is ~(1-D)*N), at
N~1000 this gets up to a ten-fold speedup.

In the 3/N < D < 1/2 regime, this gets a 20-30% speedup.  There,
instead of checking whether each summand is >1e-100 or whether
it changes the sum by more than 1e-12 (relative), we can just
sum until `exp(-2m**2z**2)` underflows, which happens at mz~18.8
(sqrt(-log(eps)/2) where eps is the smallest float).  Note that
z=D*sqrt(N) and D>3/N so the number of terms in that sum grows no faster
than 18.8*sqrt(N).

Test script:

    from astropy.stats import kuiper_false_positive_probability as kfpp
    from matplotlib import pyplot as plt
    import numpy as np
    from time import perf_counter

    Ns = [10, 100, 1000]
    repeats = 100
    fig, ax = plt.subplots()

    # 0.5 < D regime.
    for i, N in enumerate(Ns):
        Ds = np.linspace(1/2, 2, 101)[1:]
        start = perf_counter()
        for _ in range(repeats):
            kfpps = [kfpp(D, N) for D in Ds]
        elapsed = perf_counter() - start
        print(f"N={N}")
        print(f"elapsed {elapsed}")
        print(f"checksum {sum(kfpps)}")
        ax.plot(Ds, kfpps, f"C{i}.-")

    # 3 / N < D <= 0.5 regime.
    for i, N in enumerate(Ns):
        Ds = np.linspace(3/N, 1/2, 101)
        start = perf_counter()
        for _ in range(repeats):
            kfpps = [kfpp(D, N) for D in Ds]
        elapsed = perf_counter() - start
        print(f"N={N}")
        print(f"elapsed {elapsed}")
        print(f"checksum {sum(kfpps)}")
        ax.plot(Ds, kfpps, f"C{i}.-", label=f"N={N}")

    ax.set(xlabel="D", ylabel="fpp")
    ax.legend()

    plt.show()

larrybradley/astropy,larrybradley/astropy,mhvk/astropy,bsipocz/astropy,StuartLittlefair/astropy,larrybradley/astropy,pllim/astropy,StuartLittlefair/astropy,lpsinger/astropy,lpsinger/astropy,StuartLittlefair/astropy,astropy/astropy,mhvk/astropy,stargaser/astropy,dhomeier/astropy,mhvk/astropy,dhomeier/astropy,saimn/astropy,lpsinger/astropy,pllim/astropy,mhvk/astropy,astropy/astropy,mhvk/astropy,bsipocz/astropy,pllim/astropy,astropy/astropy,MSeifert04/astropy,stargaser/astropy,saimn/astropy,astropy/astropy,dhomeier/astropy,aleksandr-bakanov/astropy,aleksandr-bakanov/astropy,StuartLittlefair/astropy,saimn/astropy,pllim/astropy,bsipocz/astropy,MSeifert04/astropy,lpsinger/astropy,saimn/astropy,stargaser/astropy,stargaser/astropy,lpsinger/astropy,aleksandr-bakanov/astropy,larrybradley/astropy,StuartLittlefair/astropy,pllim/astropy,larrybradley/astropy,aleksandr-bakanov/astropy,astropy/astropy,MSeifert04/astropy,dhomeier/astropy,saimn/astropy,dhomeier/astropy,MSeifert04/astropy,bsipocz/astropy