Program: 175207
Project: 175207
Buggy source:
/** 
 * @param subTimesDiffRef : valori delle differenze tra i tempi e il timeref per i punti che mi interessano . Li uso per calcolare l'incremento medio (periodo di campionamento)
 * @throws MathException 
 */
public static void interpolation(double[] subTimesDiffRef,List<S1Metadata.OrbitStatePosVelox> vpList,Double timeStampInitSecondsRefPointsInterp[],int idxInitTime,int idxEndTime,double deltaT,List<double[]> interpPpointsOutput,List<double[]> interpVpointsOutput,List<Double> timeStampInterpSecondsRefOutput) throws MathException {
  int nPoints=subTimesDiffRef.length;
  double[][] hermiteMatrix=hermiteMatrix(nPoints);
  hermiteMatrix=invertMatrix(hermiteMatrix);
  double meanTimeRef=1;
  int m=vpList.size();
  int n=3;
  double[][] state=new double[2 * m][n];
  for (int i=0; i < 2 * m; i+=2) {
    OrbitStatePosVelox obj=vpList.get(i / 2);
    state[i][0]=obj.px;
    state[i][1]=obj.py;
    state[i][2]=obj.pz;
    state[i + 1][0]=obj.vx * meanTimeRef;
    state[i + 1][1]=obj.vy * meanTimeRef;
    state[i + 1][2]=obj.vz * meanTimeRef;
  }
  double[] interTime=new double[timeStampInitSecondsRefPointsInterp.length];
  int index=0;
  for (  double v : timeStampInitSecondsRefPointsInterp) {
    interTime[index]=v / meanTimeRef;
    index++;
  }
  int powerMax=2 * m - 1;
  double[][] vTmpPos=MathUtil.multiplyMatrix(hermiteMatrix,state);
  double[][] vTmpVel=new double[2 * m][n];
  for (int i=0; i < 2 * m; i++) {
    for (int j=0; j < n; j++) {
      vTmpVel[i][j]=vTmpPos[i][j] / meanTimeRef;
    }
  }
  for (int idx=idxInitTime; idx <= idxEndTime; idx++) {
    double[][] ptvec=new double[1][powerMax + 1];
    double[][] vtvec=new double[1][powerMax + 1];
    for (int i=0; i <= powerMax; i++) {
      ptvec[0][i]=FastMath.pow(interTime[idx],powerMax - i);
      vtvec[0][i]=FastMath.pow((interTime[idx]),FastMath.abs(i - 1));
    }
    for (int i=0; i <= powerMax; i++) {
      vtvec[0][powerMax - i]=i * vtvec[0][i];
    }
    interpPpointsOutput.add(idx - idxInitTime,MathUtil.multiplyMatrix(ptvec,vTmpPos)[0]);
    interpVpointsOutput.add(idx - idxInitTime,MathUtil.multiplyMatrix(vtvec,vTmpVel)[0]);
    timeStampInterpSecondsRefOutput.add(idx - idxInitTime,timeStampInitSecondsRefPointsInterp[idx]);
  }
}

Fixed version (ground truth):
/** 
 * @param subTimesDiffRef : valori delle differenze tra i tempi e il timeref per i punti che mi interessano . Li uso per calcolare l'incremento medio (periodo di campionamento)
 * @throws MathException 
 */
public static void interpolation(double[] subTimesDiffRef,List<S1Metadata.OrbitStatePosVelox> vpList,Double timeStampInitSecondsRefPointsInterp[],int idxInitTime,int idxEndTime,double deltaT,List<double[]> interpPpointsOutput,List<double[]> interpVpointsOutput,List<Double> timeStampInterpSecondsRefOutput) throws MathException {
  int nPoints=subTimesDiffRef.length;
  double[][] hermiteMatrix=hermiteMatrix(nPoints);
  hermiteMatrix=invertMatrix(hermiteMatrix);
  double meanTimeRef=1;
  int m=vpList.size();
  int n=3;
  double[][] state=new double[2 * m][n];
  for (int i=0; i < 2 * m; i+=2) {
    OrbitStatePosVelox obj=vpList.get(i / 2);
    state[i][0]=obj.px;
    state[i][1]=obj.py;
    state[i][2]=obj.pz;
    state[i + 1][0]=obj.vx * meanTimeRef;
    state[i + 1][1]=obj.vy * meanTimeRef;
    state[i + 1][2]=obj.vz * meanTimeRef;
  }
  double[] interTime=new double[timeStampInitSecondsRefPointsInterp.length];
  int index=0;
  for (  double v : timeStampInitSecondsRefPointsInterp) {
    interTime[index]=v / meanTimeRef;
    index++;
  }
  int powerMax=2 * m - 1;
  double[][] vTmpPos=MathUtil.multiplyMatrix(hermiteMatrix,state);
  double[][] vTmpVel=new double[2 * m][n];
  for (int i=0; i < 2 * m; i++) {
    for (int j=0; j < n; j++) {
      vTmpVel[i][j]=vTmpPos[i][j] / meanTimeRef;
    }
  }
  for (int idx=idxInitTime; idx <= idxEndTime; idx++) {
    double[][] ptvec=new double[1][powerMax + 1];
    double[][] vtvec=new double[1][powerMax + 1];
    for (int i=0; i <= powerMax; i++) {
      ptvec[0][i]=FastMath.pow(interTime[idx],powerMax - i);
      vtvec[0][i]=FastMath.pow((interTime[idx]),FastMath.abs(powerMax - i - 1));
    }
    for (int i=0; i <= powerMax; i++) {
      vtvec[0][powerMax - i]=i * vtvec[0][i];
    }
    interpPpointsOutput.add(idx - idxInitTime,MathUtil.multiplyMatrix(ptvec,vTmpPos)[0]);
    interpVpointsOutput.add(idx - idxInitTime,MathUtil.multiplyMatrix(vtvec,vTmpVel)[0]);
    timeStampInterpSecondsRefOutput.add(idx - idxInitTime,timeStampInitSecondsRefPointsInterp[idx]);
  }
}