code: def _compute_mdfv(rrs, rmags, cosmags, ws, bins, too_close):
      """Compute an MEG forward solution for a set of magnetic dipoles."""
      # The code below is a more efficient version (~30x) of this:
      # for ri, rr in enumerate(rrs):
      #     for k in range(len(coils)):
      #         this_coil = coils[k]
      #         # Go through all points
      #         diff = this_coil['rmag'] - rr
      #         dist2 = np.sum(diff * diff, axis=1)[:, np.newaxis]
      #         dist = np.sqrt(dist2)
      #         if (dist < 1e-5).any():
      #             raise RuntimeError('Coil too close')
      #         dist5 = dist2 * dist2 * dist
      #         sum_ = (3 * diff * np.sum(diff * this_coil['cosmag'],
      #                                   axis=1)[:, np.newaxis] -
      #                 dist2 * this_coil['cosmag']) / dist5
      #         fwd[3*ri:3*ri+3, k] = 1e-7 * np.dot(this_coil['w'], sum_)
      fwd = np.zeros((3 * len(rrs), bins[-1] + 1))
      min_dist = np.inf
      ws2 = ws.reshape(-1, 1)
      for ri in range(len(rrs)):
          rr = rrs[ri]
          diff = rmags - rr
          dist2_ = np.sum(diff * diff, axis=1)
          dist2 = dist2_.reshape(-1, 1)
          dist = np.sqrt(dist2)
          min_dist = min(dist.min(), min_dist)
          if min_dist < _MIN_DIST_LIMIT and too_close == "raise":
              break
          t_ = np.sum(diff * cosmags, axis=1)
          t = t_.reshape(-1, 1)
          sum_ = (
              ws2
              * (3 * diff * t - dist2 * cosmags)
              / (dist2 * dist2 * dist)
          )
          for ii in range(3):
              fwd[3 * ri + ii] = bincount(
                  bins, sum_[:, ii], bins[-1] + 1
              )
      fwd *= _MAG_FACTOR
      return fwd, min_dist
  
imports: from copy import deepcopy
  import numpy
  from .._fiff.constants import FIFF
  from ..bem import _import_openmeeg, _make_openmeeg_geometry
  from ..fixes import bincount, jit
  from ..parallel import parallel_func
  from ..surface import _jit_cross, _project_onto_surface
  from ..transforms import apply_trans, invert_transform
  from ..utils import _check_option, _pl, fill_doc, logger, verbose, warn
label_desc: Use image node_id 20 for calling a global function with example usage: _compute_mdfv(rrs, rmags, cosmags, ws, bins, too_close) and returns: fwd,  min_dist