Ejemplo n.º 1
0
def test_repeat():
    x = np.linspace(1, 100, 100)
    t1 = time.time()
    t_repeat = np.zeros(100*1000)
    _repeat_1d(x, 1000, t_repeat)
    t2 = time.time()

    t3 = time.time()
    t_numpy = np.repeat(x, 1000)
    t4 = time.time()

    print("Timings for 'repeat' operation")
    print("Repeat_1d: {}".format(t2-t1))
    print("Numpy:     {}".format(t4-t3))

    assert_(abs(t_numpy-t_repeat).max())
Ejemplo n.º 2
0
def test_repeat():

    from numpy import linspace, repeat, zeros
    x = linspace(1, 100, 100)

    import time
    t1 = time.time()
    t_repeat = zeros(100 * 1000)
    _repeat_1d(x, 1000, t_repeat)
    t2 = time.time()

    t3 = time.time()
    t_numpy = repeat(x, 1000)
    t4 = time.time()

    print("Timings for 'repeat' operation")
    print("Repeat_1d: {}".format(t2 - t1))
    print("Numpy:     {}".format(t4 - t3))

    assert (abs(t_numpy - t_repeat).max())
Ejemplo n.º 3
0
def test_repeat():

    from numpy import linspace, repeat, zeros
    x = linspace(1,100  , 100)

    import time
    t1 = time.time()
    t_repeat = zeros(100*1000)
    _repeat_1d(x,1000,t_repeat)
    t2 = time.time()

    t3 = time.time()
    t_numpy = repeat(x, 1000)
    t4 = time.time()

    print("Timings for 'repeat' operation")
    print("Repeat_1d: {}".format(t2-t1))
    print("Numpy:     {}".format(t4-t3))

    assert( abs(t_numpy-t_repeat).max())