def _morph_mult(data, e, use_sparse, idx_use_data, idx_use_out=None):
 if (len(idx_use_data) < e.shape[1]):
  if use_sparse:
   data = (e[:, idx_use_data] * data)
  else:
   (col, row) = np.meshgrid(np.arange(data.shape[1]), idx_use_data)
   d_sparse = sparse.csr_matrix((data.ravel(), (row.ravel(), col.ravel())), shape=(e.shape[1], data.shape[1]))
   data = (e * d_sparse)
   data = np.asarray(data.todense())
 else:
  data = (e * data)
 if (idx_use_out is not None):
  data = data[idx_use_out]
 return data

def _morph_mult ( data , e , use_sparse , idx_use_data , idx_use_out = None ) : if ( len ( idx_use_data ) < e . shape [ 1 ] ) : if use_sparse : data = ( e [ : , idx_use_data ] * data ) else : ( col , row ) = np . meshgrid ( np . arange ( data . shape [ 1 ] ) , idx_use_data ) d_sparse = sparse . csr_matrix ( ( data . ravel ( ) , ( row . ravel ( ) , col . ravel ( ) ) ) , shape = ( e . shape [ 1 ] , data . shape [ 1 ] ) ) data = ( e * d_sparse ) data = np . asarray ( data . todense ( ) ) else : data = ( e * data ) if ( idx_use_out is not None ) : data = data [ idx_use_out ] return data
helper for morphing .