public
anonymous / gist:578226
Created

  • Download Gist
gistfile1.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
import scipy.sparse
import scipy.io.mmio
import os
import gc
import time
import numpy
 
 
matrix = scipy.io.mmio.mmread(os.popen("cat sparse_matrix.head try3"))
mat2 = matrix.tocsc()
numpy.savez('foo.npz', mat=mat2)
 
norms = numpy.zeros((1,mat2.shape[1]))
 
import math
 
for j in range(0, mat2.shape[1] - 1):
if (j % 10000 == 0):
print('j is', j)
c = mat2.getcol(j)
norms[0, j] = scipy.linalg.norm(c.A)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.