Commit c425bb7d authored by Gaetan D's avatar Gaetan D

hop

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