Commit c425bb7d authored by Gaetan D's avatar Gaetan D

hop

parent f9a5b148
......@@ -3,25 +3,28 @@ import numpy as np
import random
import time
def testinv():
sumnp = 0
sumlin = 0
sumnp = 0
sumlin = 0
for i in range(100):
n = 100
M = np.random.rand(n,n)
print("Iteration",i)
if(np.linalg.det(M) != 0):
a =time.clock()
np.linalg.inv(M)
b = time.clock()
sumnp += b-a
print("numpy done")
a =time.clock()
invert(M)
b = time.clock()
sumlin += b-a
print(sumnp,sumlin)
for i in range(100):
n = 100
M = np.random.rand(n,n)
print("Iteration",i)
if(np.linalg.det(M) != 0):
a =time.clock()
np.linalg.inv(M)
b = time.clock()
sumnp += b-a
print("numpy done")
a =time.clock()
invert(M)
b = time.clock()
sumlin += b-a
print("=============")
print("Numpy :"sumnp)
print("Gauss :",sumlin)
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