def _do_lin_field_coeff(bem_rr, tris, tn, ta, rmags, cosmags, ws, bins):
 coeff = np.zeros(((bins[(-1)] + 1), len(bem_rr)))
 for (tri, tri_nn, tri_area) in zip(tris, tn, ta):
  tri_rr = bem_rr[tri]
  zz = []
  for trr in tri_rr:
   diff = (rmags - trr)
   dl = np.sum((diff * diff), axis=1)
   c = fast_cross_3d(diff, tri_nn[np.newaxis, :])
   x = ((tri_area * np.sum((c * cosmags), axis=1)) / ((3.0 * dl) * np.sqrt(dl)))
   zz += [np.bincount(bins, weights=(x * ws), minlength=(bins[(-1)] + 1))]
  coeff[:, tri] += np.array(zz).T
 return coeff

def _do_lin_field_coeff ( bem_rr , tris , tn , ta , rmags , cosmags , ws , bins ) : coeff = np . zeros ( ( ( bins [ ( - 1 ) ] + 1 ) , len ( bem_rr ) ) ) for ( tri , tri_nn , tri_area ) in zip ( tris , tn , ta ) : tri_rr = bem_rr [ tri ] zz = [ ] for trr in tri_rr : diff = ( rmags - trr ) dl = np . sum ( ( diff * diff ) , axis = 1 ) c = fast_cross_3d ( diff , tri_nn [ np . newaxis , : ] ) x = ( ( tri_area * np . sum ( ( c * cosmags ) , axis = 1 ) ) / ( ( 3.0 * dl ) * np . sqrt ( dl ) ) ) zz += [ np . bincount ( bins , weights = ( x * ws ) , minlength = ( bins [ ( - 1 ) ] + 1 ) ) ] coeff [ : , tri ] += np . array ( zz ) . T return coeff
compute field coefficients .