Program: 76439
Project: 76439
Buggy source:
/** 
 * Return a new array of doubles that is the inverse DCT of the  input array of doubles. See the DCT_TYPE_XXX constants for documentation of the exact formula, which depends on the type.
 * @param x An array of doubles.
 * @param order The base-2 logarithm of the size of the transform.
 * @param type An integer specifying which type of IDCT.
 * @retval A new array of doubles.
 */
public static double[] IDCT(double[] x,int order,int type){
  if (type >= DCT_TYPES) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  int size=1 << order;
  int twoSize=2 << order;
  if (_IDCTfactors[type][order] == null) {
    _IDCTfactors[type][order]=new Complex[twoSize];
    double oneOverTwoSize=1.0 / (double)twoSize;
    double factor=1.0;
    double oneOverE0=2.0;
switch (type) {
case DCT_TYPE_NORMALIZED:
      factor=2.0;
    oneOverE0=_ROOT2;
  break;
case DCT_TYPE_ORTHONORMAL:
factor=Math.sqrt(16.0 * oneOverTwoSize);
oneOverE0=_ROOT2;
break;
case DCT_TYPE_UNNORMALIZED:
factor=2.0;
oneOverE0=1.0;
break;
}
_IDCTfactors[type][order][0]=new Complex(oneOverE0 * factor,0.0);
for (int k=1; k < twoSize; k++) {
Complex c=new Complex(0,k * Math.PI * oneOverTwoSize);
_IDCTfactors[type][order][k]=c.exp().scale(factor);
}
}
Complex[] evenX=new Complex[twoSize];
Complex[] myFactors=_IDCTfactors[type][order];
evenX[0]=myFactors[0].scale(x[0]);
for (int k=1; k < size; k++) {
evenX[k]=myFactors[k].scale(x[k]);
evenX[twoSize - k]=myFactors[twoSize - k].scale(-x[k]);
}
evenX[size]=new Complex(0.0,0.0);
double[] longOutput=IFFTRealOut(evenX,order + 1);
return DoubleArrayMath.resize(longOutput,size);
}

Fixed version (ground truth):
/** 
 * Return a new array of doubles that is the inverse DCT of the  input array of doubles. See the DCT_TYPE_XXX constants for documentation of the exact formula, which depends on the type.
 * @param x An array of doubles.
 * @param order The base-2 logarithm of the size of the transform.
 * @param type An integer specifying which type of IDCT.
 * @retval A new array of doubles.
 */
public static double[] IDCT(double[] x,int order,int type){
  if (type >= DCT_TYPES) {
    throw new IllegalArgumentException("String_Node_Str" + "String_Node_Str");
  }
  int size=1 << order;
  int twoSize=2 << order;
  if (_IDCTfactors[type][order] == null) {
    _IDCTfactors[type][order]=new Complex[twoSize];
    double oneOverTwoSize=1.0 / (double)twoSize;
    double factor=1.0;
    double oneOverE0=2.0;
switch (type) {
case DCT_TYPE_NORMALIZED:
      factor=2.0;
    oneOverE0=_ROOT2;
  break;
case DCT_TYPE_ORTHONORMAL:
factor=Math.sqrt((double)twoSize);
oneOverE0=_ROOT2;
break;
case DCT_TYPE_UNNORMALIZED:
factor=2.0;
oneOverE0=1.0;
break;
}
_IDCTfactors[type][order][0]=new Complex(oneOverE0 * factor,0.0);
for (int k=1; k < twoSize; k++) {
Complex c=new Complex(0,k * Math.PI * oneOverTwoSize);
_IDCTfactors[type][order][k]=c.exp().scale(factor);
}
}
Complex[] evenX=new Complex[twoSize];
Complex[] myFactors=_IDCTfactors[type][order];
evenX[0]=myFactors[0].scale(x[0]);
for (int k=1; k < size; k++) {
evenX[k]=myFactors[k].scale(x[k]);
evenX[twoSize - k]=myFactors[twoSize - k].scale(-x[k]);
}
evenX[size]=new Complex(0.0,0.0);
double[] longOutput=IFFTRealOut(evenX,order + 1);
return DoubleArrayMath.resize(longOutput,size);
}