code: def _roll_vectorized(M, roll_indices, axis):
      """
      Roll an array of matrices along *axis* (0: rows, 1: columns) according to
      an array of indices *roll_indices*.
      """
      assert axis in [0, 1]
      ndim = M.ndim
      assert ndim == 3
      ndim_roll = roll_indices.ndim
      assert ndim_roll == 1
      sh = M.shape
      r, c = sh[-2:]
      assert sh[0] == roll_indices.shape[0]
      vec_indices = np.arange(sh[0], dtype=np.int32)
  
      # Builds the rolled matrix
      M_roll = np.empty_like(M)
      if axis == 0:
          for ir in range(r):
              for ic in range(c):
                  M_roll[:, ir, ic] = M[
                      vec_indices, (-roll_indices + ir) % r, ic
                  ]
      else:  # 1
          for ir in range(r):
              for ic in range(c):
                  M_roll[:, ir, ic] = M[
                      vec_indices, ir, (-roll_indices + ic) % c
                  ]
      return M_roll
  
imports: import numpy
  from matplotlib import _api
  from matplotlib.tri import Triangulation
  from matplotlib.tri._trifinder import TriFinder
  from matplotlib.tri._tritools import TriAnalyzer
label_desc: Use image node_id 6 for calling a global function with example usage: _roll_vectorized(M, roll_indices, axis) and returns: M_roll