def _parallel_pairwise(X, Y, func, n_jobs, **kwds):
 if (n_jobs < 0):
  n_jobs = max(((cpu_count() + 1) + n_jobs), 1)
 if (Y is None):
  Y = X
 if (n_jobs == 1):
  return func(X, Y, **kwds)
 fd = delayed(func)
 ret = Parallel(n_jobs=n_jobs, verbose=0)((fd(X, Y[s], **kwds) for s in gen_even_slices(Y.shape[0], n_jobs)))
 return np.hstack(ret)

def _parallel_pairwise ( X , Y , func , n_jobs , ** kwds ) : if ( n_jobs < 0 ) : n_jobs = max ( ( ( cpu_count ( ) + 1 ) + n_jobs ) , 1 ) if ( Y is None ) : Y = X if ( n_jobs == 1 ) : return func ( X , Y , ** kwds ) fd = delayed ( func ) ret = Parallel ( n_jobs = n_jobs , verbose = 0 ) ( ( fd ( X , Y [ s ] , ** kwds ) for s in gen_even_slices ( Y . shape [ 0 ] , n_jobs ) ) ) return np . hstack ( ret )
break the pairwise matrix in n_jobs even slices and compute them in parallel .