Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #%%
- import numpy as np
- from time import process_time_ns
- rows = 10
- cols = 100
- mat = np.empty((rows, cols))
- #%%
- mat[0] = np.arange(0, cols)
- #%%
- t1 = process_time_ns()
- for i in range(1, rows):
- for j in range(cols):
- vals = np.union1d(mat[i,:], mat[:,j])
- k = 0
- while k in vals:
- k += 1
- mat[i,j] = k
- t2 = process_time_ns()
- t = t2 - t1
- #%%
- mat[rows-1,cols-1]
- #%%
- t
- #%%
- #%%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement