login bonus sbobet com vn_login bonus football teams to win this weekend_free login william hill promo code canada

Tue, 28 Feb 2017 20:15:40 -0800

On Feb 28, 2017 2:57 PM, "Sebastian K" <sebastiankas...@googlemail.com>
wrote:

Yes it is true the execution time is much faster with the numpy function.

 The Code for numpy version:

def createMatrix(n):
Matrix = np.empty(shape=(n,n), dtype='float64')
for x in range(n):
for y in range(n):
Matrix[x, y] = 0.1 + ((x*y)%1000)/1000.0
return Matrix



if __name__ == '__main__':
n = getDimension()
if n > 0:
A = createMatrix(n)
B = createMatrix(n)
C = np.empty(shape=(n,n), dtype='float64')
C = np.dot(A,B)

#print(C)

In the pure python version I am just implementing the multiplication with
three for-loops.

Measured data with libmemusage:
dimension of matrix: 100x100
heap peak pure python3: 1060565
heap peakt numpy function: 4917180


4 megabytes is less than the memory needed just to load numpy :-). Try a
1000x1000 array (or even bigger), and I think you'll see more reasonable
results.

-n
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to