code: def _to_matrix_vectorized(M):
      """
      Build an array of matrices from individuals np.arrays of identical shapes.
  
      Parameters
      ----------
      M
          ncols-list of nrows-lists of shape sh.
  
      Returns
      -------
      M_res : np.array of shape (sh, nrow, ncols)
          *M_res* satisfies ``M_res[..., i, j] = M[i][j]``.
      """
      assert isinstance(M, (tuple, list))
      assert all(isinstance(item, (tuple, list)) for item in M)
      c_vec = np.asarray([len(item) for item in M])
      assert np.all(c_vec - c_vec[0] == 0)
      r = len(M)
      c = c_vec[0]
      M00 = np.asarray(M[0][0])
      dt = M00.dtype
      sh = [M00.shape[0], r, c]
      M_ret = np.empty(sh, dtype=dt)
      for irow in range(r):
          for icol in range(c):
              M_ret[:, irow, icol] = np.asarray(M[irow][icol])
      return M_ret
  
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 7 for calling a global function with example usage: _to_matrix_vectorized(M) and returns: M_ret