Program: 150572
Project: 150572
Buggy source:
@Override public void process(double[] input,DMatrixSparseCSC left,DMatrixSparseCSC right){
  int numRows=getNumOfOutputsM();
  int numViewParam=numViewsUnknown * 6;
  int numPointParam=numParameters - numViewParam;
  tripletView.reshape(numRows,numViewParam);
  tripletPoint.reshape(numRows,numPointParam);
  int observationCount=0;
  for (int viewIndex=0; viewIndex < structure.views.length; viewIndex++) {
    BundleAdjustmentSceneStructure.View view=structure.views[viewIndex];
    BundleAdjustmentSceneStructure.Camera camera=structure.cameras[view.camera];
    if (!view.known) {
      int paramIndex=viewIndex * 6;
      double rodX=input[paramIndex];
      double rodY=input[paramIndex + 1];
      double rodZ=input[paramIndex + 2];
      worldToView.T.x=input[paramIndex + 3];
      worldToView.T.y=input[paramIndex + 4];
      worldToView.T.z=input[paramIndex + 5];
      rodrigues.setParamVector(rodX,rodY,rodZ);
      rodJacobian.process(rodX,rodY,rodZ);
      ConvertRotation3D_F64.rodriguesToMatrix(rodrigues,worldToView.R);
    }
 else {
      worldToView.set(view.worldToView);
    }
    int cameraParamStartIndex=cameraParameterIndexes[view.camera];
    if (!camera.known) {
      camera.model.setParameters(input,cameraParamStartIndex);
    }
    BundleAdjustmentObservations.View obsView=observations.views[viewIndex];
    for (int i=0; i < obsView.size(); i++) {
      int featureIndex=indexFirstPoint + obsView.feature.get(i) * 3;
      worldPt.x=input[featureIndex];
      worldPt.y=input[featureIndex + 1];
      worldPt.z=input[featureIndex + 2];
      SePointOps_F64.transform(worldToView,worldPt,cameraPt);
      jacRowX=observationCount * 2;
      jacRowY=jacRowX + 1;
      if (!camera.known) {
        int N=camera.model.getParameterCount();
        camera.model.jacobian(cameraPt.x,cameraPt.y,cameraPt.z,pointGradX,pointGradY,calibGradX,calibGradY);
        for (int j=0; j < N; j++) {
          tripletPoint.addItem(jacRowX,cameraParamStartIndex + j,calibGradX[j]);
          tripletPoint.addItem(jacRowY,cameraParamStartIndex + j,calibGradY[j]);
        }
      }
 else {
        camera.model.jacobian(cameraPt.x,cameraPt.y,cameraPt.z,pointGradX,pointGradY);
      }
      addToJacobian(tripletPoint,featureIndex,pointGradX,pointGradY,worldToView.R);
      if (!view.known) {
        int col=view.camera * 6;
        addToJacobian(tripletView,col,pointGradX,pointGradY,rodJacobian.Rx);
        addToJacobian(tripletView,col,pointGradX,pointGradY,rodJacobian.Ry);
        addToJacobian(tripletView,col,pointGradX,pointGradY,rodJacobian.Rz);
        tripletView.addItem(jacRowX,col + 3,pointGradX[0]);
        tripletView.addItem(jacRowX,col + 4,pointGradX[1]);
        tripletView.addItem(jacRowX,col + 5,pointGradX[2]);
        tripletView.addItem(jacRowY,col + 3,pointGradY[0]);
        tripletView.addItem(jacRowY,col + 4,pointGradY[1]);
        tripletView.addItem(jacRowY,col + 5,pointGradY[2]);
      }
      observationCount++;
    }
  }
  ConvertDMatrixStruct.convert(tripletView,left);
  ConvertDMatrixStruct.convert(tripletPoint,right);
}

Fixed version (ground truth):
@Override public void process(double[] input,DMatrixSparseCSC left,DMatrixSparseCSC right){
  int numRows=getNumOfOutputsM();
  int numViewParam=numViewsUnknown * 6;
  int numPointParam=numParameters - numViewParam;
  tripletView.reshape(numRows,numViewParam);
  tripletPoint.reshape(numRows,numPointParam);
  int observationCount=0;
  int columnLastPointJac=structure.points.length * 3;
  for (int viewIndex=0; viewIndex < structure.views.length; viewIndex++) {
    BundleAdjustmentSceneStructure.View view=structure.views[viewIndex];
    BundleAdjustmentSceneStructure.Camera camera=structure.cameras[view.camera];
    if (!view.known) {
      int paramIndex=viewParameterIndexes[viewIndex];
      double rodX=input[paramIndex];
      double rodY=input[paramIndex + 1];
      double rodZ=input[paramIndex + 2];
      worldToView.T.x=input[paramIndex + 3];
      worldToView.T.y=input[paramIndex + 4];
      worldToView.T.z=input[paramIndex + 5];
      rodrigues.setParamVector(rodX,rodY,rodZ);
      rodJacobian.process(rodX,rodY,rodZ);
      ConvertRotation3D_F64.rodriguesToMatrix(rodrigues,worldToView.R);
    }
 else {
      worldToView.set(view.worldToView);
    }
    int cameraParamStartIndex=cameraParameterIndexes[view.camera];
    if (!camera.known) {
      camera.model.setParameters(input,indexLastPoint + cameraParamStartIndex);
    }
    BundleAdjustmentObservations.View obsView=observations.views[viewIndex];
    for (int i=0; i < obsView.size(); i++) {
      int columnOfPointInJac=obsView.feature.get(i) * 3;
      int indexOfPointInInput=indexFirstPoint + columnOfPointInJac;
      worldPt.x=input[indexOfPointInInput];
      worldPt.y=input[indexOfPointInInput + 1];
      worldPt.z=input[indexOfPointInInput + 2];
      SePointOps_F64.transform(worldToView,worldPt,cameraPt);
      jacRowX=observationCount * 2;
      jacRowY=jacRowX + 1;
      if (!camera.known) {
        int N=camera.model.getParameterCount();
        camera.model.jacobian(cameraPt.x,cameraPt.y,cameraPt.z,pointGradX,pointGradY,calibGradX,calibGradY);
        for (int j=0; j < N; j++) {
          tripletPoint.addItem(jacRowX,columnLastPointJac + cameraParamStartIndex + j,calibGradX[j]);
          tripletPoint.addItem(jacRowY,columnLastPointJac + cameraParamStartIndex + j,calibGradY[j]);
        }
      }
 else {
        camera.model.jacobian(cameraPt.x,cameraPt.y,cameraPt.z,pointGradX,pointGradY);
      }
      addToJacobian(tripletPoint,columnOfPointInJac,pointGradX,pointGradY,worldToView.R);
      if (!view.known) {
        int col=viewParameterIndexes[viewIndex];
        addToJacobian(tripletView,col + 0,pointGradX,pointGradY,rodJacobian.Rx,worldPt);
        addToJacobian(tripletView,col + 1,pointGradX,pointGradY,rodJacobian.Ry,worldPt);
        addToJacobian(tripletView,col + 2,pointGradX,pointGradY,rodJacobian.Rz,worldPt);
        tripletView.addItem(jacRowX,col + 3,pointGradX[0]);
        tripletView.addItem(jacRowY,col + 3,pointGradY[0]);
        tripletView.addItem(jacRowX,col + 4,pointGradX[1]);
        tripletView.addItem(jacRowY,col + 4,pointGradY[1]);
        tripletView.addItem(jacRowX,col + 5,pointGradX[2]);
        tripletView.addItem(jacRowY,col + 5,pointGradY[2]);
      }
      observationCount++;
    }
  }
  ConvertDMatrixStruct.convert(tripletView,left);
  ConvertDMatrixStruct.convert(tripletPoint,right);
}