def _ica_par(X, tol, g, gprime, fun_args, maxit, w_init):
 (n, p) = X.shape
 W = _sym_decorrelation(w_init)
 lim = (tol + 1)
 it = 0
 while ((lim > tol) and (it < (maxit - 1))):
  wtx = np.dot(W, X).A
  gwtx = g(wtx, fun_args)
  g_wtx = gprime(wtx, fun_args)
  W1 = ((np.dot(gwtx, X.T) / float(p)) - np.dot(np.diag(g_wtx.mean(axis=1)), W))
  W1 = _sym_decorrelation(W1)
  lim = max(abs((abs(np.diag(np.dot(W1, W.T))) - 1)))
  W = W1
  it = (it + 1)
 return W

def _ica_par ( X , tol , g , gprime , fun_args , maxit , w_init ) : ( n , p ) = X . shape W = _sym_decorrelation ( w_init ) lim = ( tol + 1 ) it = 0 while ( ( lim > tol ) and ( it < ( maxit - 1 ) ) ) : wtx = np . dot ( W , X ) . A gwtx = g ( wtx , fun_args ) g_wtx = gprime ( wtx , fun_args ) W1 = ( ( np . dot ( gwtx , X . T ) / float ( p ) ) - np . dot ( np . diag ( g_wtx . mean ( axis = 1 ) ) , W ) ) W1 = _sym_decorrelation ( W1 ) lim = max ( abs ( ( abs ( np . diag ( np . dot ( W1 , W . T ) ) ) - 1 ) ) ) W = W1 it = ( it + 1 ) return W
parallel fastica .