Commit af683bab authored by Matthieu Boileau's avatar Matthieu Boileau

Add an element-wise multiplication

parent 3657402a
from __future__ import print_function
import numpy as np
import timeit
import numexpr as ne
N = 16384
a = np.random.rand(N, N)
def np_multiply():
return np.multiply(a, a)
def ne_multiply():
return ne.evaluate("a*a")
def run(funcname):
print("Testing {}()...".format(funcname))
s = "{}()".format(funcname)
setup = "from __main__ import {}".format(funcname)
t = timeit.timeit(s, setup=setup, number=NUMBER)
print("time [s] = {0:.4f}".format(t/NUMBER))
if __name__ == '__main__':
print("Size n = {}".format(N))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment