Beispiel #1
0
 /**
  * @return The covariance matrix of the fit parameters.
  * @throws LMAMatrix.InvertException if the inversion of alpha fails. Note that even if the fit
  *     does NOT throw the invert exception, this method can still do it, because here alpha is
  *     inverted with lambda = 0.
  */
 public double[][] getCovarianceMatrixOfStandardErrorsInParameters()
     throws LMAMatrix.InvertException {
   double[][] result = new double[parameters.length][parameters.length];
   double oldLambda = lambda;
   lambda = 0;
   updateAlpha();
   try {
     alpha.invert();
   } catch (LMAMatrix.InvertException e) {
     // restore alpha just in case
     lambda = oldLambda;
     updateAlpha();
     throw new LMAMatrix.InvertException(
         "Inverting alpha failed with lambda = 0\n" + e.getMessage());
   }
   for (int i = 0; i < result.length; i++) {
     for (int j = 0; j < result.length; j++) {
       result[i][j] = alpha.getElement(i, j);
     }
   }
   alpha.invert();
   lambda = oldLambda;
   updateAlpha();
   return result;
 }