code: def par_compute_residuals(i):
      
  
      # Compute the residuals in parallel, need to check if the residuals
      # depend on alpha
      global mp_ry0
      global mp_ry1
      global mp_sy0
      global mp_sy1
      global mp_nrmAx
      global mp_nrmBy
      global mp_nrmu
      mp_ry0[i] = np.sum((mp_DXnr[i] - mp_Y0[i])**2)
      mp_ry1[i] = mp_alpha**2*np.sum((mp_Xnr[mp_grp[i]:mp_grp[i+1]]-
                                      mp_Y1[mp_grp[i]:mp_grp[i+1]])**2)
      mp_sy0[i] = np.sum((mp_Y0old[i] - mp_Y0[i])**2)
      mp_sy1[i] = mp_alpha**2*np.sum((mp_Y1old[mp_grp[i]:mp_grp[i+1]]-
                                      mp_Y1[mp_grp[i]:mp_grp[i+1]])**2)
      mp_nrmAx[i] = np.sum(mp_DXnr[i]**2) + mp_alpha**2 * np.sum(
          mp_Xnr[mp_grp[i]:mp_grp[i+1]]**2)
      mp_nrmBy[i] = np.sum(mp_Y0[i]**2) + mp_alpha**2 * np.sum(
          mp_Y1[mp_grp[i]:mp_grp[i+1]]**2)
      mp_nrmu[i] = np.sum(mp_U0[i]**2) + np.sum(mp_U1[mp_grp[i]:mp_grp[i+1]]**2)
docs: Compute components of the residual and stopping thresholds that
      can be done in parallel.
  
      Parameters
      ----------
      i : int
        Index of group to compute