Program: 16318
Project: 16318
Buggy source:
private int calcRotationMatrix(){
  double a11=SxxpSyy + Szz - mxEigenV;
  double a12=SyzmSzy;
  double a13=-SxzmSzx;
  double a14=SxymSyx;
  double a21=SyzmSzy;
  double a22=SxxmSyy - Szz - mxEigenV;
  double a23=SxypSyx;
  double a24=SxzpSzx;
  double a31=a13;
  double a32=a23;
  double a33=Syy - Sxx - Szz- mxEigenV;
  double a34=SyzpSzy;
  double a41=a14;
  double a42=a24;
  double a43=a34;
  double a44=Szz - SxxpSyy - mxEigenV;
  double a3344_4334=a33 * a44 - a43 * a34;
  double a3244_4234=a32 * a44 - a42 * a34;
  double a3243_4233=a32 * a43 - a42 * a33;
  double a3143_4133=a31 * a43 - a41 * a33;
  double a3144_4134=a31 * a44 - a41 * a34;
  double a3142_4132=a31 * a42 - a41 * a32;
  double q1=a22 * a3344_4334 - a23 * a3244_4234 + a24 * a3243_4233;
  double q2=-a21 * a3344_4334 + a23 * a3144_4134 - a24 * a3143_4133;
  double q3=a21 * a3244_4234 - a22 * a3144_4134 + a24 * a3142_4132;
  double q4=-a21 * a3243_4233 + a22 * a3143_4133 - a23 * a3142_4132;
  double qsqr=q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4;
  if (qsqr < evecprec) {
    q1=a12 * a3344_4334 - a13 * a3244_4234 + a14 * a3243_4233;
    q2=-a11 * a3344_4334 + a13 * a3144_4134 - a14 * a3143_4133;
    q3=a11 * a3244_4234 - a12 * a3144_4134 + a14 * a3142_4132;
    q4=-a11 * a3243_4233 + a12 * a3143_4133 - a13 * a3142_4132;
    qsqr=q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4;
    if (qsqr < evecprec) {
      double a1324_1423=a13 * a24 - a14 * a23, a1224_1422=a12 * a24 - a14 * a22;
      double a1223_1322=a12 * a23 - a13 * a22, a1124_1421=a11 * a24 - a14 * a21;
      double a1123_1321=a11 * a23 - a13 * a21, a1122_1221=a11 * a22 - a12 * a21;
      q1=a42 * a1324_1423 - a43 * a1224_1422 + a44 * a1223_1322;
      q2=-a41 * a1324_1423 + a43 * a1124_1421 - a44 * a1123_1321;
      q3=a41 * a1224_1422 - a42 * a1124_1421 + a44 * a1122_1221;
      q4=-a41 * a1223_1322 + a42 * a1123_1321 - a43 * a1122_1221;
      qsqr=q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4;
      if (qsqr < evecprec) {
        q1=a32 * a1324_1423 - a33 * a1224_1422 + a34 * a1223_1322;
        q2=-a31 * a1324_1423 + a33 * a1124_1421 - a34 * a1123_1321;
        q3=a31 * a1224_1422 - a32 * a1124_1421 + a34 * a1122_1221;
        q4=-a31 * a1223_1322 + a32 * a1123_1321 - a33 * a1122_1221;
        qsqr=q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4;
        if (qsqr < evecprec) {
          rotmat.setIdentity();
          return 0;
        }
      }
    }
  }
  double normq=Math.sqrt(qsqr);
  q1/=normq;
  q2/=normq;
  q3/=normq;
  q4/=normq;
  double a2=q1 * q1;
  double x2=q2 * q2;
  double y2=q3 * q3;
  double z2=q4 * q4;
  double xy=q2 * q3;
  double az=q1 * q4;
  double zx=q4 * q2;
  double ay=q1 * q3;
  double yz=q3 * q4;
  double ax=q1 * q2;
  rotmat.m00=a2 + x2 - y2 - z2;
  rotmat.m01=2 * (xy + az);
  rotmat.m02=2 * (zx - ay);
  rotmat.m10=2 * (xy - az);
  rotmat.m11=a2 - x2 + y2 - z2;
  rotmat.m12=2 * (yz + ax);
  rotmat.m20=2 * (zx + ay);
  rotmat.m21=2 * (yz - ax);
  rotmat.m22=a2 - x2 - y2 + z2;
  return 1;
}

Fixed version (ground truth):
private int calcRotationMatrix(){
  double a11=SxxpSyy + Szz - mxEigenV;
  double a12=SyzmSzy;
  double a13=-SxzmSzx;
  double a14=SxymSyx;
  double a21=SyzmSzy;
  double a22=SxxmSyy - Szz - mxEigenV;
  double a23=SxypSyx;
  double a24=SxzpSzx;
  double a31=a13;
  double a32=a23;
  double a33=Syy - Sxx - Szz- mxEigenV;
  double a34=SyzpSzy;
  double a41=a14;
  double a42=a24;
  double a43=a34;
  double a44=Szz - SxxpSyy - mxEigenV;
  double a3344_4334=a33 * a44 - a43 * a34;
  double a3244_4234=a32 * a44 - a42 * a34;
  double a3243_4233=a32 * a43 - a42 * a33;
  double a3143_4133=a31 * a43 - a41 * a33;
  double a3144_4134=a31 * a44 - a41 * a34;
  double a3142_4132=a31 * a42 - a41 * a32;
  double q1=a22 * a3344_4334 - a23 * a3244_4234 + a24 * a3243_4233;
  double q2=-a21 * a3344_4334 + a23 * a3144_4134 - a24 * a3143_4133;
  double q3=a21 * a3244_4234 - a22 * a3144_4134 + a24 * a3142_4132;
  double q4=-a21 * a3243_4233 + a22 * a3143_4133 - a23 * a3142_4132;
  double qsqr=q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4;
  if (qsqr < evecprec) {
    q1=a12 * a3344_4334 - a13 * a3244_4234 + a14 * a3243_4233;
    q2=-a11 * a3344_4334 + a13 * a3144_4134 - a14 * a3143_4133;
    q3=a11 * a3244_4234 - a12 * a3144_4134 + a14 * a3142_4132;
    q4=-a11 * a3243_4233 + a12 * a3143_4133 - a13 * a3142_4132;
    qsqr=q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4;
    if (qsqr < evecprec) {
      double a1324_1423=a13 * a24 - a14 * a23, a1224_1422=a12 * a24 - a14 * a22;
      double a1223_1322=a12 * a23 - a13 * a22, a1124_1421=a11 * a24 - a14 * a21;
      double a1123_1321=a11 * a23 - a13 * a21, a1122_1221=a11 * a22 - a12 * a21;
      q1=a42 * a1324_1423 - a43 * a1224_1422 + a44 * a1223_1322;
      q2=-a41 * a1324_1423 + a43 * a1124_1421 - a44 * a1123_1321;
      q3=a41 * a1224_1422 - a42 * a1124_1421 + a44 * a1122_1221;
      q4=-a41 * a1223_1322 + a42 * a1123_1321 - a43 * a1122_1221;
      qsqr=q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4;
      if (qsqr < evecprec) {
        q1=a32 * a1324_1423 - a33 * a1224_1422 + a34 * a1223_1322;
        q2=-a31 * a1324_1423 + a33 * a1124_1421 - a34 * a1123_1321;
        q3=a31 * a1224_1422 - a32 * a1124_1421 + a34 * a1122_1221;
        q4=-a31 * a1223_1322 + a32 * a1123_1321 - a33 * a1122_1221;
        qsqr=q1 * q1 + q2 * q2 + q3 * q3 + q4 * q4;
        if (qsqr < evecprec) {
          rotmat.setIdentity();
          return 0;
        }
      }
    }
  }
  double normq=Math.sqrt(qsqr);
  q1/=normq;
  q2/=normq;
  q3/=normq;
  q4/=normq;
  logger.debug("String_Node_Str" + q1 + "String_Node_Str"+ q2+ "String_Node_Str"+ q3+ "String_Node_Str"+ q4);
  double a2=q1 * q1;
  double x2=q2 * q2;
  double y2=q3 * q3;
  double z2=q4 * q4;
  double xy=q2 * q3;
  double az=q1 * q4;
  double zx=q4 * q2;
  double ay=q1 * q3;
  double yz=q3 * q4;
  double ax=q1 * q2;
  rotmat.m00=a2 + x2 - y2 - z2;
  rotmat.m01=2 * (xy + az);
  rotmat.m02=2 * (zx - ay);
  rotmat.m10=2 * (xy - az);
  rotmat.m11=a2 - x2 + y2 - z2;
  rotmat.m12=2 * (yz + ax);
  rotmat.m20=2 * (zx + ay);
  rotmat.m21=2 * (yz - ax);
  rotmat.m22=a2 - x2 - y2 + z2;
  return 1;
}