Guest User

Untitled

a guest
Jan 16th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. l=list(range(0,1000000000))
  2.  
  3. import numpy as np
  4. MAXSIZE = 1000000
  5. l = np.empty(MAXSIZE, dtype=np.int16)
  6.  
  7. L = [None] * 10**9
  8.  
  9. L = []
  10.  
  11. import array
  12.  
  13. a = array.array('i', [0]) * 10**9
  14.  
  15. R = range(10**9)
  16.  
  17. import array
  18.  
  19.  
  20. # i - integer https://docs.python.org/3/library/array.html
  21. # array<any> создать нельзя.
  22. arr = array.array('i', range(1000000))
  23.  
  24. import numpy as np
  25. from scipy.sparse import coo_matrix
  26.  
  27. row = np.random.randint(10**10, size=10**3, dtype=np.int64)
  28. col = np.array([0] * 10**3)
  29. data = np.random.randint(255, size=10**3)
  30.  
  31. coo = coo_matrix((data, (row, col)), shape=(10**20, 1))
  32.  
  33. In [29]: coo
  34. Out[29]:
  35. <100000000000000000000x1 sparse matrix of type '<class 'numpy.int32'>'
  36. with 1000 stored elements in COOrdinate format>
  37.  
  38. In [30]: coo.shape
  39. Out[30]: (100000000000000000000, 1)
Add Comment
Please, Sign In to add comment