def col_scale(x, s):
 if (x.format == 'csc'):
  return ColScaleCSC()(x, s)
 elif (x.format == 'csr'):
  return RowScaleCSC()(x.T, s).T
 else:
  raise NotImplementedError()

def col_scale ( x , s ) : if ( x . format == 'csc' ) : return ColScaleCSC ( ) ( x , s ) elif ( x . format == 'csr' ) : return RowScaleCSC ( ) ( x . T , s ) . T else : raise NotImplementedError ( )
scale each columns of a sparse matrix by the corresponding element of a dense vector .