Program: 70861
Project: 70861
Buggy source:
protected void computeVelCorrections(VectorNd vel,double t0,double t1){
  double h=t1 - t0;
  int velSize=myActiveVelSize;
  if (velSize == 0) {
    return;
  }
  if (myConSolver == null) {
    myConSolver=new KKTSolver();
  }
  updateBilateralConstraints();
  updateUnilateralConstraints();
  if (myGsize == 0 && myNsize == 0) {
    return;
  }
  if (myGsize > 0 && myParametricVelSize > 0) {
    myGT.mulTranspose(myBg,myUpar,0,myGsize,velSize,myParametricVelSize);
    myBg.negate();
  }
 else {
    myBg.setZero();
  }
  setBilateralOffsets(h,0);
  if (myNsize > 0 && myParametricVelSize > 0) {
    myNT.mulTranspose(myBn,myUpar,0,myNsize,velSize,myParametricVelSize);
    myBn.negate();
  }
 else {
    myBn.setZero();
  }
  setUnilateralOffsets(h,0);
  myBf.setSize(velSize);
  myMass.mul(myBf,vel,velSize,velSize);
  if (myConMassVersion != myMassVersion || myConGTVersion != myGTVersion) {
    myConSolver.analyze(myMass,velSize,myGT,Matrix.SPD);
    myConMassVersion=myMassVersion;
    myConGTVersion=myGTVersion;
  }
  mySys.getBilateralImpulses(myLam);
  mySys.getUnilateralImpulses(myThe);
  myConSolver.factor(myMass,velSize,myGT,myRg,myNT,myRn);
  myConSolver.solve(vel,myLam,myThe,myBf,myBg,myBn);
  if (computeKKTResidual) {
    double res=myConSolver.residual(myMass,velSize,myGT,myRg,myNT,myRn,vel,myLam,myThe,myBf,myBg,myBn);
    System.out.println("String_Node_Str" + velSize + "String_Node_Str"+ myGT.colSize()+ "String_Node_Str"+ myNT.colSize()+ "String_Node_Str"+ res);
  }
  mySys.setBilateralImpulses(myLam,h);
  mySys.setUnilateralImpulses(myThe,h);
  if (myUpdateForcesAtStepEnd) {
    if (myGsize > 0) {
      myGT.mulAdd(myFcon,myLam,velSize,myGsize);
    }
    if (myNsize > 0) {
      myNT.mulAdd(myFcon,myThe,velSize,myNsize);
    }
  }
}

Fixed version (ground truth):
protected void computeVelCorrections(VectorNd vel,double t0,double t1){
  double h=t1 - t0;
  int velSize=myActiveVelSize;
  if (velSize == 0) {
    return;
  }
  if (myConSolver == null) {
    myConSolver=new KKTSolver();
  }
  updateBilateralConstraints();
  updateUnilateralConstraints();
  if (myGsize == 0 && myNsize == 0) {
    return;
  }
  if (myGsize > 0 && myParametricVelSize > 0) {
    myGT.mulTranspose(myBg,myUpar,0,myGsize,velSize,myParametricVelSize);
    myBg.negate();
  }
 else {
    myBg.setZero();
  }
  setBilateralOffsets(h,0);
  if (myNsize > 0 && myParametricVelSize > 0) {
    myNT.mulTranspose(myBn,myUpar,0,myNsize,velSize,myParametricVelSize);
    myBn.negate();
  }
 else {
    myBn.setZero();
  }
  setUnilateralOffsets(h,0);
  myBf.setSize(velSize);
  myMass.mul(myBf,vel,velSize,velSize);
  if (myConMassVersion != myMassVersion || myConGTVersion != myGTVersion) {
    myConSolver.analyze(myMass,velSize,myGT,myRg,Matrix.SPD);
    myConMassVersion=myMassVersion;
    myConGTVersion=myGTVersion;
  }
  mySys.getBilateralImpulses(myLam);
  mySys.getUnilateralImpulses(myThe);
  myConSolver.factor(myMass,velSize,myGT,myRg,myNT,myRn);
  myConSolver.solve(vel,myLam,myThe,myBf,myBg,myBn);
  if (computeKKTResidual) {
    double res=myConSolver.residual(myMass,velSize,myGT,myRg,myNT,myRn,vel,myLam,myThe,myBf,myBg,myBn);
    System.out.println("String_Node_Str" + velSize + "String_Node_Str"+ myGT.colSize()+ "String_Node_Str"+ myNT.colSize()+ "String_Node_Str"+ res);
  }
  mySys.setBilateralImpulses(myLam,h);
  mySys.setUnilateralImpulses(myThe,h);
  if (myUpdateForcesAtStepEnd) {
    if (myGsize > 0) {
      myGT.mulAdd(myFcon,myLam,velSize,myGsize);
    }
    if (myNsize > 0) {
      myNT.mulAdd(myFcon,myThe,velSize,myNsize);
    }
  }
}