def _special_sparse_dot(W, H, X):
 if sp.issparse(X):
  (ii, jj) = X.nonzero()
  dot_vals = np.multiply(W[ii, :], H.T[jj, :]).sum(axis=1)
  WH = sp.coo_matrix((dot_vals, (ii, jj)), shape=X.shape)
  return WH.tocsr()
 else:
  return fast_dot(W, H)

def _special_sparse_dot ( W , H , X ) : if sp . issparse ( X ) : ( ii , jj ) = X . nonzero ( ) dot_vals = np . multiply ( W [ ii , : ] , H . T [ jj , : ] ) . sum ( axis = 1 ) WH = sp . coo_matrix ( ( dot_vals , ( ii , jj ) ) , shape = X . shape ) return WH . tocsr ( ) else : return fast_dot ( W , H )
computes np .