def inplace_csr_row_scale(X, scale):
 assert (scale.shape[0] == X.shape[0])
 X.data *= np.repeat(scale, np.diff(X.indptr))

def inplace_csr_row_scale ( X , scale ) : assert ( scale . shape [ 0 ] == X . shape [ 0 ] ) X . data *= np . repeat ( scale , np . diff ( X . indptr ) )
inplace row scaling of a csr matrix .