def get_sparse_matrix(M, N, frac=0.1):
 data = (np.zeros((M, N)) * 0.0)
 for i in range(int(((M * N) * frac))):
  x = np.random.randint(0, (M - 1))
  y = np.random.randint(0, (N - 1))
  data[(x, y)] = np.random.rand()
 return data

def get_sparse_matrix ( M , N , frac = 0.1 ) : data = ( np . zeros ( ( M , N ) ) * 0.0 ) for i in range ( int ( ( ( M * N ) * frac ) ) ) : x = np . random . randint ( 0 , ( M - 1 ) ) y = np . random . randint ( 0 , ( N - 1 ) ) data [ ( x , y ) ] = np . random . rand ( ) return data
return a *m* x *n* sparse matrix with *frac* elements randomly filled .