Guest User

Untitled

a guest
Aug 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. import dask.array as da
  2. import numpy as np
  3. import sparse
  4.  
  5. def corr_on_chunked(chunk1, chunk2, corr_thresh=0.9):
  6. return sparse.COO.from_numpy((np.dot(chunk1, chunk2.T) > corr_thresh))
  7.  
  8. x = da.random.random((10000, 1000), chunks=(1000, 1000))
  9.  
  10. z = da.core.atop(corr_on_chunked, 'ik', x, 'ij', x.T, 'jk', dtype=x.dtype,
  11. concatenate=True)
  12. z = da.triu(z, k=1)
  13.  
  14. # z.visualize('dask.png', optimize_graph=True, rankdir='LR')
  15. # z = z.compute()
Add Comment
Please, Sign In to add comment