code: def _update_rho(self, k, r, s):
      
  
      if self.opt['AutoRho', 'Enabled']:
          tau = self.rho_tau
          mu = self.rho_mu
          xi = self.rho_xi
          if k != 0 and cp.mod(k + 1, self.opt['AutoRho', 'Period']) == 0:
              if self.opt['AutoRho', 'AutoScaling']:
                  if s == 0.0 or r == 0.0:
                      rhomlt = tau
                  else:
                      rhomlt = cp.sqrt(r / (s * xi) if r > s * xi
                                       else (s * xi) / r)
                      if rhomlt > tau:
                          rhomlt = tau
              else:
                  rhomlt = tau
              rsf = 1.0
              if r > xi * mu * s:
                  rsf = rhomlt
              elif s > (mu / xi) * r:
                  rsf = 1.0 / rhomlt
              self.rho *= float(rsf)
              self.U /= rsf
              if rsf != 1.0:
                  self.rhochange()
docs: Patched version of :func:`sporco.admm.admm.ADMM.update_rho`.