Advertisement
ganryu

2018 y 10000

Jun 3rd, 2019
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. #%%
  2. import numpy as np
  3. from time import process_time_ns
  4.  
  5. rows = 10
  6. cols = 100
  7.  
  8. mat = np.empty((rows, cols))
  9.  
  10. #%%
  11. mat[0] = np.arange(0, cols)
  12.  
  13. #%%
  14. t1 = process_time_ns()
  15. for i in range(1, rows):
  16.     for j in range(cols):
  17.         vals = np.union1d(mat[i,:], mat[:,j])
  18.         k = 0
  19.         while k in vals:
  20.             k += 1
  21.         mat[i,j] = k
  22. t2 = process_time_ns()
  23. t = t2 - t1
  24.  
  25. #%%
  26. mat[rows-1,cols-1]
  27.  
  28. #%%
  29. t
  30.  
  31. #%%
  32.  
  33.  
  34. #%%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement