code: protected void configure(ResidualFunction function , int numParam )
      {
          this.function = function;
          int numFunctions = function.numFunctions();
  
          // reshaping a matrix means that new memory is only declared when needed
          candidateParameters.reshape(numParam,1);
          g.reshape(numParam,1);
          H.reshape(numParam,numParam);
          negativeStep.reshape(numParam,1);
  
          // Normally these variables are thought of as row vectors, but it works out easier if they are column
          temp0.reshape(numFunctions,1);
          temp1.reshape(numFunctions,1);
          residuals.reshape(numFunctions,1);
          jacobian.reshape(numFunctions,numParam);
      }
docs: Performs sanity checks on the input data and reshapes internal matrices.  By reshaping
  a matrix it will only declare new memory when needed.