Skip to content

Commit

Permalink
test script for linalg.solve speed
Browse files Browse the repository at this point in the history
  • Loading branch information
bogovicj committed Sep 13, 2018
1 parent 88447ff commit 6a3ecad
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/inv_vs_solve_time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import numpy as np
import numpy.random as rng
import time

medium_mtx = np.array( rng.rand( 2000, 2000 ))
medium_vec = np.array( rng.rand( 2000, 1 ))

t0 = time.time()
y_s = np.matmul( np.linalg.inv( medium_mtx ), medium_vec )
t1 = time.time()
print( 'slow time: {} '.format( t1 - t0 ))



t0_f = time.time()
y_f = np.linalg.solve( medium_mtx, medium_vec )
t1_f = time.time()
print( 'fast time: {} '.format( t1_f - t0_f ))

0 comments on commit 6a3ecad

Please sign in to comment.