Program: 57159
Project: 57159
Buggy source:
/** 
 * Add a sample point. <p> This method must be called once for each sample point. It is allowed to mix some calls with values only with calls with values and first derivatives. </p> <p> The point abscissae for all calls <em>must</em> be different. </p>
 * @param x abscissa of the sample point
 * @param value value and derivatives of the sample point(if only one row is passed, it is the value, if two rows are passed the first one is the value and the second the derivative and so on)
 * @exception ZeroException if the abscissa difference between added pointand a previous point is zero (i.e. the two points are at same abscissa)
 * @exception MathArithmeticException if the number of derivatives is largerthan 20, which prevents computation of a factorial
 * @throws DimensionMismatchException if derivative structures are inconsistent
 * @throws NullArgumentException if x is null
 */
public void addSamplePoint(final T x,final T[]... value) throws ZeroException, MathArithmeticException, DimensionMismatchException, NullArgumentException {
  MathUtils.checkNotNull(x);
  T factorial=x.getField().getOne();
  for (int i=0; i < value.length; ++i) {
    final T[] y=value[i].clone();
    if (i > 1) {
      factorial=factorial.multiply(i);
      final T inv=factorial.reciprocal();
      for (int j=0; j < y.length; ++j) {
        y[j]=y[j].multiply(inv);
      }
    }
    final int n=abscissae.size();
    bottomDiagonal.add(n - i,y);
    T[] bottom0=y;
    for (int j=i; j < n; ++j) {
      final T[] bottom1=bottomDiagonal.get(n - (j + 1));
      if (x.equals(abscissae.get(n - (j + 1)))) {
        throw new ZeroException(LocalizedFormats.DUPLICATED_ABSCISSA_DIVISION_BY_ZERO,x);
      }
      final T inv=x.subtract(abscissae.get(n - (j + 1))).reciprocal();
      for (int k=0; k < y.length; ++k) {
        bottom1[k]=inv.multiply(bottom0[k].subtract(bottom1[k]));
      }
      bottom0=bottom1;
    }
    topDiagonal.add(bottom0.clone());
    abscissae.add(x);
  }
}

Fixed version (ground truth):
/** 
 * Add a sample point. <p> This method must be called once for each sample point. It is allowed to mix some calls with values only with calls with values and first derivatives. </p> <p> The point abscissae for all calls <em>must</em> be different. </p>
 * @param x abscissa of the sample point
 * @param value value and derivatives of the sample point(if only one row is passed, it is the value, if two rows are passed the first one is the value and the second the derivative and so on)
 * @exception ZeroException if the abscissa difference between added pointand a previous point is zero (i.e. the two points are at same abscissa)
 * @exception MathArithmeticException if the number of derivatives is largerthan 20, which prevents computation of a factorial
 * @throws DimensionMismatchException if derivative structures are inconsistent
 * @throws NullArgumentException if x is null
 */
@SafeVarargs public final void addSamplePoint(final T x,final T[]... value) throws ZeroException, MathArithmeticException, DimensionMismatchException, NullArgumentException {
  MathUtils.checkNotNull(x);
  T factorial=x.getField().getOne();
  for (int i=0; i < value.length; ++i) {
    final T[] y=value[i].clone();
    if (i > 1) {
      factorial=factorial.multiply(i);
      final T inv=factorial.reciprocal();
      for (int j=0; j < y.length; ++j) {
        y[j]=y[j].multiply(inv);
      }
    }
    final int n=abscissae.size();
    bottomDiagonal.add(n - i,y);
    T[] bottom0=y;
    for (int j=i; j < n; ++j) {
      final T[] bottom1=bottomDiagonal.get(n - (j + 1));
      if (x.equals(abscissae.get(n - (j + 1)))) {
        throw new ZeroException(LocalizedFormats.DUPLICATED_ABSCISSA_DIVISION_BY_ZERO,x);
      }
      final T inv=x.subtract(abscissae.get(n - (j + 1))).reciprocal();
      for (int k=0; k < y.length; ++k) {
        bottom1[k]=inv.multiply(bottom0[k].subtract(bottom1[k]));
      }
      bottom0=bottom1;
    }
    topDiagonal.add(bottom0.clone());
    abscissae.add(x);
  }
}