How to use the perfplot.plot function in perfplot

To help you get started, we’ve selected a few perfplot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / accupy / test / test_sums.py View on Github external
def test_speed_comparison1(n_range=None):
    if n_range is None:
        n_range = [2 ** k for k in range(2)]

    numpy.random.seed(0)
    perfplot.plot(
        setup=lambda n: numpy.random.rand(n, 100),
        kernels=[
            sum,
            lambda p: numpy.sum(p, axis=0),
            accupy.kahan_sum,
            lambda p: accupy.ksum(p, K=2),
            lambda p: accupy.ksum(p, K=3),
            accupy.fsum,
        ],
        labels=[
            "sum",
            "numpy.sum",
            "accupy.kahan_sum",
            "accupy.ksum[2]",
            "accupy.ksum[3]",
            "accupy.fsum",
github nschloe / accupy / test / test_dot.py View on Github external
def test_speed_comparison1(n_range=None):
    if n_range is None:
        n_range = [2 ** k for k in range(2)]

    numpy.random.seed(0)
    perfplot.plot(
        setup=lambda n: (numpy.random.rand(n, 100), numpy.random.rand(100, n)),
        kernels=[
            lambda xy: numpy.dot(*xy),
            lambda xy: accupy.kdot(*xy, K=2),
            lambda xy: accupy.kdot(*xy, K=3),
            lambda xy: accupy.fdot(*xy),
        ],
        labels=["numpy.dot", "accupy.kdot[2]", "accupy.kdot[3]", "accupy.fdot"],
        colors=plt.rcParams["axes.prop_cycle"].by_key()["color"][:4],
        n_range=n_range,
        title="dot(random(n, 100), random(100, n))",
        xlabel="n",
        logx=True,
        logy=True,
    )
    plt.gca().set_aspect(0.2)
github nschloe / colorio / test / test_comparisons.py View on Github external
Y_b = 20
    L_A = 64 / numpy.pi / 5

    c = 0.69  # average
    cam16 = colorio.CAM16(c, Y_b, L_A)

    def cio(x):
        return cam16.to_xyz100(x, "JCh")

    cam16_legacy = CAM16Legacy(c, Y_b, L_A)

    def cio_legacy(x):
        return cam16_legacy.to_xyz100(x, "JCh")

    perfplot.plot(
        setup=lambda n: numpy.random.rand(3, n),
        kernels=[cio, cio_legacy],
        n_range=100000 * numpy.arange(11),
        xlabel="Number of input samples",
    )

    # import matplotlib2tikz
    # matplotlib2tikz.save('fig.tikz')
    return
github nschloe / accupy / test / test_dot.py View on Github external
def test_speed_comparison2(n_range=None):
    if n_range is None:
        n_range = [2 ** k for k in range(2)]

    numpy.random.seed(0)
    perfplot.plot(
        setup=lambda n: (numpy.random.rand(100, n), numpy.random.rand(n, 100)),
        kernels=[
            lambda xy: numpy.dot(*xy),
            lambda xy: accupy.kdot(*xy, K=2),
            lambda xy: accupy.kdot(*xy, K=3),
            lambda xy: accupy.fdot(*xy),
        ],
        labels=["numpy.dot", "accupy.kdot[2]", "accupy.kdot[3]", "accupy.fdot"],
        colors=plt.rcParams["axes.prop_cycle"].by_key()["color"][:4],
        n_range=n_range,
        title="dot(random(100, n), random(n, 100))",
        xlabel="n",
        logx=True,
        logy=True,
    )
    plt.gca().set_aspect(0.2)
github nschloe / accupy / test / test_sums.py View on Github external
def test_speed_comparison2(n_range=None):
    if n_range is None:
        n_range = [2 ** k for k in range(2)]

    numpy.random.seed(0)
    perfplot.plot(
        setup=lambda n: numpy.random.rand(100, n),
        kernels=[
            sum,
            lambda p: numpy.sum(p, axis=0),
            accupy.kahan_sum,
            lambda p: accupy.ksum(p, K=2),
            lambda p: accupy.ksum(p, K=3),
            accupy.fsum,
        ],
        labels=[
            "sum",
            "numpy.sum",
            "accupy.kahan_sum",
            "accupy.ksum[2]",
            "accupy.ksum[3]",
            "accupy.fsum",

perfplot

Performance plots for Python code snippets

GPL-3.0
Latest version published 3 years ago

Package Health Score

49 / 100
Full package analysis