docs: private boolean adjustParam(DenseMatrix64F X, DenseMatrix64F Y,
                                  double prevCost) {
          // lambda adjusts how big of a step it takes
          double lambda = initialLambda;
          // the difference between the current and previous cost
          double difference = 1000;
  
          for( int iter = 0; iter < iter1 && difference > maxDifference ; iter++ ) {
              // compute some variables based on the gradient
              computeDandH(param,X,Y);
  
              // try various step sizes and see if any of them improve the
              // results over what has already been done
              boolean foundBetter = false;
              for( int i = 0; i < iter2; i++ ) {
                  computeA(A,H,lambda);
  
                  if( !solve(A,d,negDelta) ) {
                      return false;
                  }
                  // compute the candidate parameters
                  subtract(param, negDelta, tempParam);
  
                  double cost = cost(tempParam,X,Y);
                  if( cost < prevCost ) {
                      // the candidate parameters produced better results so use it
                      foundBetter = true;
                      param.set(tempParam);
                      difference = prevCost - cost;
                      prevCost = cost;
                      lambda /= 10.0;
                  } else {
                      lambda *= 10.0;
                  }
              }
  
              // it reached a point where it can't improve so exit
              if( !foundBetter )
                  break;
          }
          finalCost = prevCost;
          return true;
      }