docs: def repair(self, x, copy_if_changed=True, copy_always=False):
          """sets out-of-bounds components of ``x`` on the bounds.
  
          """
          # TODO (old data): CPU(N,lam,iter=20,200,100): 3.3s of 8s for two bounds, 1.8s of 6.5s for one bound
          # remark: np.max([bounds[0], x]) is about 40 times slower than max((bounds[0], x))
          copy = copy_if_changed
          if copy_always:
              x = array(x, copy=True)
          bounds = self.bounds
          if bounds not in (None, [None, None], (None, None)):  # solely for effiency
              x = array(x, copy=True) if copy and not copy_always else x
              if bounds[0] is not None:
                  if isscalar(bounds[0]):
                      for i in rglen(x):
                          x[i] = max((bounds[0], x[i]))
                  else:
                      for i in rglen(x):
                          j = min([i, len(bounds[0]) - 1])
                          if bounds[0][j] is not None:
                              x[i] = max((bounds[0][j], x[i]))
              if bounds[1] is not None:
                  if isscalar(bounds[1]):
                      for i in rglen(x):
                          x[i] = min((bounds[1], x[i]))
                  else:
                      for i in rglen(x):
                          j = min((i, len(bounds[1]) - 1))
                          if bounds[1][j] is not None:
                              x[i] = min((bounds[1][j], x[i]))
          return x