Program: 11500
Project: 11500
Buggy source:
/** 
 * Create a flat earth phase polynomial for a given burst in TOPSAR product.
 */
private DoubleMatrix estimateFlatEarthPolynomial(SLCImage masterMetadata,Orbit masterOrbit,SLCImage slaveMetadata,Orbit slaveOrbit,final int subSwathIndex,final int burstIndex) throws Exception {
  long minLine=burstIndex * subSwath[subSwathIndex - 1].linesPerBurst;
  long maxLine=minLine + subSwath[subSwathIndex - 1].linesPerBurst - 1;
  long minPixel=0;
  long maxPixel=subSwath[subSwathIndex - 1].samplesPerBurst - 1;
  int numberOfCoefficients=PolyUtils.numberOfCoefficients(srpPolynomialDegree);
  int[][] position=MathUtils.distributePoints(srpNumberPoints,new Window(minLine,maxLine,minPixel,maxPixel));
  DoubleMatrix y=new DoubleMatrix(srpNumberPoints);
  DoubleMatrix A=new DoubleMatrix(srpNumberPoints,numberOfCoefficients);
  double masterMinPi4divLam=(-4 * Constants.PI * Constants.lightSpeed) / masterMetadata.getRadarWavelength();
  double slaveMinPi4divLam=(-4 * Constants.PI * Constants.lightSpeed) / slaveMetadata.getRadarWavelength();
  for (int i=0; i < srpNumberPoints; ++i) {
    double line=position[i][0];
    double pixel=position[i][1];
    final double mstRgTime=subSwath[subSwathIndex - 1].slrTimeToFirstPixel + pixel * su.rangeSpacing / Constants.lightSpeed;
    final double mstAzTime=subSwath[subSwathIndex - 1].burstFirstLineTime[burstIndex] + (line - burstIndex * subSwath[subSwathIndex - 1].linesPerBurst) * subSwath[subSwathIndex - 1].azimuthTimeInterval;
    org.jlinda.core.Point xyzMaster=masterOrbit.lph2xyz(mstAzTime,mstRgTime,0.0,mstSceneCentreXYZ);
    org.jlinda.core.Point slaveTimeVector=slaveOrbit.xyz2t(xyzMaster,slvScenseCentreAzimuthTime);
    final double slaveTimeRange=slaveTimeVector.x;
    y.put(i,(masterMinPi4divLam * mstRgTime) - (slaveMinPi4divLam * slaveTimeRange));
    double posL=PolyUtils.normalize2(line,minLine,maxLine);
    double posP=PolyUtils.normalize2(pixel,minPixel,maxPixel);
    int index=0;
    for (int j=0; j <= srpPolynomialDegree; j++) {
      for (int k=0; k <= j; k++) {
        A.put(i,index,(FastMath.pow(posL,(double)(j - k)) * FastMath.pow(posP,(double)k)));
        index++;
      }
    }
  }
  DoubleMatrix Atranspose=A.transpose();
  DoubleMatrix N=Atranspose.mmul(A);
  DoubleMatrix rhs=Atranspose.mmul(y);
  return Solve.solve(N,rhs);
}

Fixed version (ground truth):
/** 
 * Create a flat earth phase polynomial for a given burst in TOPSAR product.
 */
private DoubleMatrix estimateFlatEarthPolynomial(SLCImage masterMetadata,Orbit masterOrbit,SLCImage slaveMetadata,Orbit slaveOrbit,final int subSwathIndex,final int burstIndex) throws Exception {
  long minLine=burstIndex * subSwath[subSwathIndex - 1].linesPerBurst;
  long maxLine=minLine + subSwath[subSwathIndex - 1].linesPerBurst - 1;
  long minPixel=0;
  long maxPixel=subSwath[subSwathIndex - 1].samplesPerBurst - 1;
  int numberOfCoefficients=PolyUtils.numberOfCoefficients(srpPolynomialDegree);
  int[][] position=MathUtils.distributePoints(srpNumberPoints,new Window(minLine,maxLine,minPixel,maxPixel));
  DoubleMatrix y=new DoubleMatrix(srpNumberPoints);
  DoubleMatrix A=new DoubleMatrix(srpNumberPoints,numberOfCoefficients);
  double masterMinPi4divLam=(-4 * Constants.PI * Constants.lightSpeed) / masterMetadata.getRadarWavelength();
  double slaveMinPi4divLam=(-4 * Constants.PI * Constants.lightSpeed) / slaveMetadata.getRadarWavelength();
  for (int i=0; i < srpNumberPoints; ++i) {
    double line=position[i][0];
    double pixel=position[i][1];
    final double mstRgTime=subSwath[subSwathIndex - 1].slrTimeToFirstPixel + pixel * su.rangeSpacing / Constants.lightSpeed;
    final double mstAzTime=line2AzimuthTime(line,subSwathIndex,burstIndex);
    org.jlinda.core.Point xyzMaster=masterOrbit.lph2xyz(mstAzTime,mstRgTime,0.0,mstSceneCentreXYZ);
    org.jlinda.core.Point slaveTimeVector=slaveOrbit.xyz2t(xyzMaster,slvScenseCentreAzimuthTime);
    final double slaveTimeRange=slaveTimeVector.x;
    y.put(i,(masterMinPi4divLam * mstRgTime) - (slaveMinPi4divLam * slaveTimeRange));
    double posL=PolyUtils.normalize2(line,minLine,maxLine);
    double posP=PolyUtils.normalize2(pixel,minPixel,maxPixel);
    int index=0;
    for (int j=0; j <= srpPolynomialDegree; j++) {
      for (int k=0; k <= j; k++) {
        A.put(i,index,(FastMath.pow(posL,(double)(j - k)) * FastMath.pow(posP,(double)k)));
        index++;
      }
    }
  }
  DoubleMatrix Atranspose=A.transpose();
  DoubleMatrix N=Atranspose.mmul(A);
  DoubleMatrix rhs=Atranspose.mmul(y);
  return Solve.solve(N,rhs);
}