code: def cofactor_n(x, i, j):
      '''Return the cofactor of n matrices x[n,i,j] at position i,j
  
      The cofactor is the determinant of the matrix formed by removing
      row i and column j.
      '''
      m = x.shape[1]
      mr = np.arange(m)
      i_idx = mr[mr != i]
      j_idx = mr[mr != j]
      return det_n(x[:, i_idx[:, np.newaxis],
                        j_idx[np.newaxis, :]]f cofactor_n(x, i, j):
      '''Return the cofactor of n matrices x[n,i,j] at position i,j
  
      The cofactor is the determinant of the matrix formed by removing
      row i and column j.
      '''
      m = x.shape[1]
      mr = np.arange(m)
      i_idx = mr[mr != i]
      j_idx = mr[mr != j]
      return det_n(x[:, i_idx[:, np.newaxis],
                        j_idx[np.newaxis, :]])
docs: Return the cofactor of n matrices x[n,i,j] at position i,j
  
      The cofactor is the determinant of the matrix formed by removing
      row i and column j.