code: def compute_jac_indices(n, m, k):
      """Compute indices for the collocation system Jacobian construction.
  
      See `construct_global_jac` for the explanation.
      """
      i_col = np.repeat(np.arange((m - 1) * n), n)
      j_col = np.tile(np.arange(n), n * (m - 1)) + np.repeat(
          np.arange(m - 1) * n, n**2
      )
  
      i_bc = np.repeat(np.arange((m - 1) * n, m * n + k), n)
      j_bc = np.tile(np.arange(n), n + k)
  
      i_p_col = np.repeat(np.arange((m - 1) * n), k)
      j_p_col = np.tile(np.arange(m * n, m * n + k), (m - 1) * n)
  
      i_p_bc = np.repeat(np.arange((m - 1) * n, m * n + k), k)
      j_p_bc = np.tile(np.arange(m * n, m * n + k), n + k)
  
      i = np.hstack((i_col, i_col, i_bc, i_bc, i_p_col, i_p_bc))
      j = np.hstack(
          (j_col, j_col + n, j_bc, j_bc + (m - 1) * n, j_p_col, j_p_bc)
      )
  
      return i, j
  
imports: from warnings import warn
  import numpy
  from numpy.linalg import pinv
  from scipy.sparse import coo_matrix, csc_matrix
  from scipy.sparse.linalg import splu
  from scipy.optimize import OptimizeResult
label_desc: Use image node_id 3 for calling a global function with example usage: compute_jac_indices(n, m, k) and returns: i,  j