docs: private void getHdotVFiniteDifference(double[] x, double[] v, double[] curDerivative){
  
  
      double h = finiteDifferenceStepSize;
      double hInv = 1/h;    // this avoids dividing too much since it's a bit more expensive than multiplying
  
      if (gradPerturbed == null) {
        gradPerturbed = new double[x.length];
        System.out.println("Setting approximate gradient.");
      }
  
      if (xPerturbed == null){
        xPerturbed = new double[x.length];
        System.out.println("Setting perturbed.");
      }
  
      if (HdotV == null) {
        HdotV = new double[x.length];
        System.out.println("Setting H dot V.");
      }
  
      //  This adds h*v to x  --->  x = x + h*v
      for( int i = 0;i<x.length;i++){
        xPerturbed[i] = x[i] + h*v[i];
      }
  
  
      double prevValue = value;
  
      recalculatePrevBatch = true;
  
      calculateStochastic(xPerturbed,null,thisBatch);  // Call the calculate function without updating the batch
  
      // System.arraycopy(derivative, 0, gradPerturbed, 0, gradPerturbed.length);
  
      //  This comes up with the approximate difference, and renormalizes it on h.
      for( int i = 0;i<x.length;i++){
        double tmp = (derivative[i]-curDerivative[i]);
        HdotV[i] = hInv*(tmp);
      }
  
      //Make sure the original derivative is in place
      System.arraycopy(curDerivative,0,derivative,0,derivative.length);
      value = prevValue;
      hasNewVals = false;
      recalculatePrevBatch = false;
      returnPreviousValues = false;
  
    }