def _bem_inf_fields(rr, rmag, cosmag):
 diff = (rmag.T[np.newaxis, :, :] - rr[:, :, np.newaxis])
 diff_norm = np.sum((diff * diff), axis=1)
 diff_norm *= np.sqrt(diff_norm)
 diff_norm[(diff_norm == 0)] = 1
 x = np.array([((diff[:, 1] * cosmag[:, 2]) - (diff[:, 2] * cosmag[:, 1])), ((diff[:, 2] * cosmag[:, 0]) - (diff[:, 0] * cosmag[:, 2])), ((diff[:, 0] * cosmag[:, 1]) - (diff[:, 1] * cosmag[:, 0]))])
 return np.rollaxis((x / diff_norm), 1)

def _bem_inf_fields ( rr , rmag , cosmag ) : diff = ( rmag . T [ np . newaxis , : , : ] - rr [ : , : , np . newaxis ] ) diff_norm = np . sum ( ( diff * diff ) , axis = 1 ) diff_norm *= np . sqrt ( diff_norm ) diff_norm [ ( diff_norm == 0 ) ] = 1 x = np . array ( [ ( ( diff [ : , 1 ] * cosmag [ : , 2 ] ) - ( diff [ : , 2 ] * cosmag [ : , 1 ] ) ) , ( ( diff [ : , 2 ] * cosmag [ : , 0 ] ) - ( diff [ : , 0 ] * cosmag [ : , 2 ] ) ) , ( ( diff [ : , 0 ] * cosmag [ : , 1 ] ) - ( diff [ : , 1 ] * cosmag [ : , 0 ] ) ) ] ) return np . rollaxis ( ( x / diff_norm ) , 1 )
compute infinite-medium magnetic field at one meg sensor .