Program: 30099
Project: 30099
Buggy source:
/** 
 * Get the eigenvectors of a 3x3 matrix sorted by decreasing eigenvalue. If the matrix is singular ... TODO: test this.
 * @return an array containing eigenvectors.
 * @hops 84
 */
public Vector[] getEigenvectors(){
  if (coords.length != 3 || coords[0].length != 3)   throw new Error("String_Node_Str" + coords.length + "String_Node_Str"+ coords[0].length);
  boolean issymmetric=true;
  for (int j=0; (j < 3) & issymmetric; j++) {
    for (int i=0; (i < 3) & issymmetric; i++) {
      issymmetric=(coords[i][j] == coords[j][i]);
    }
  }
  if (issymmetric) {
    double c=coords[0][0] * coords[1][1];
    double d=coords[1][2] * coords[2][1];
    double e=coords[0][1] * coords[1][0];
    double f=coords[0][2] * coords[2][0];
    double p=-coords[0][0] - coords[1][1] - coords[2][2];
    double q=c + (coords[0][0] + coords[1][1]) * coords[2][2] - d - e - f;
    double r=(e - c) * coords[2][2] + d * coords[0][0] - 2 * (coords[0][1] * coords[1][2] * coords[2][0]) + f * coords[1][1];
    double pThirds=p / 3;
    double a=q - p * pThirds;
    double b=(2 * pThirds * pThirds - q) * pThirds + r;
    double aThirds=a / 3;
    double m=2 * Math.sqrt(-aThirds);
    double t=Math.acos(b / (aThirds * m)) / 3;
    double cosT=Math.cos(t);
    double sinT=Math.sin(t);
    double l1=m * cosT - pThirds;
    double l2=-m * ((cosT + Math.sqrt(3) * sinT) / 2) - pThirds;
    double l3=-m * ((cosT - Math.sqrt(3) * sinT) / 2) - pThirds;
    Matrix3x3 m1=clone();
    m1.set(0,0,-l1 + m1.get(0,0));
    m1.set(1,1,-l1 + m1.get(1,1));
    m1.set(2,2,-l1 + m1.get(2,2));
    m1.reduceThis();
    m1.toConsole();
    Vector v1=new Vector(-m1.coords[0][2],-m1.coords[1][2],1);
    Vector v2=null, v3=null;
    if (l2 > WB_Epsilon.EPSILON) {
      Matrix3x3 m2=clone();
      m2.set(0,0,-l2 + m2.get(0,0));
      m2.set(1,1,-l2 + m2.get(1,1));
      m2.set(2,2,-l2 + m2.get(2,2));
      m2.reduceThis();
      v2=new Vector(-m2.coords[0][2],-m2.coords[1][2],1);
    }
    if (l3 > WB_Epsilon.EPSILON) {
      Matrix3x3 m3=clone();
      m3.set(0,0,-l3 + m3.get(0,0));
      m3.set(1,1,-l3 + m3.get(1,1));
      m3.set(2,2,-l3 + m3.get(2,2));
      m3.reduceThis();
      v3=new Vector(-m3.coords[0][2],-m3.coords[1][2],1);
    }
    return new Vector[]{v1,v2,v3};
  }
  EigenvalueDecomposition ed=new EigenvalueDecomposition();
  Vector[] ret=new Vector[3];
  double[][] V=ed.getV().coords;
  ret[0]=new Vector(V[0][0],V[1][0],V[2][0]).multiplyThis(ed.getRealEigenvalues()[0]);
  ret[1]=new Vector(V[0][1],V[1][1],V[2][1]).multiplyThis(ed.getRealEigenvalues()[1]);
  ret[2]=new Vector(V[0][2],V[1][2],V[2][2]).multiplyThis(ed.getRealEigenvalues()[2]);
  return ret;
}

Fixed version (ground truth):
/** 
 * Get the eigenvectors of a 3x3 matrix sorted by decreasing eigenvalue. If the matrix is singular ... TODO: test this.
 * @return an array containing eigenvectors.
 */
public Vector[] getEigenvectors(){
  if (coords.length != 3 || coords[0].length != 3)   throw new Error("String_Node_Str" + coords.length + "String_Node_Str"+ coords[0].length);
  boolean issymmetric=true;
  for (int j=0; (j < 3) & issymmetric; j++) {
    for (int i=0; (i < 3) & issymmetric; i++) {
      issymmetric=(coords[i][j] == coords[j][i]);
    }
  }
  if (issymmetric) {
    double c=coords[0][0] * coords[1][1];
    double d=coords[1][2] * coords[2][1];
    double e=coords[0][1] * coords[1][0];
    double f=coords[0][2] * coords[2][0];
    double p=-coords[0][0] - coords[1][1] - coords[2][2];
    double q=c + (coords[0][0] + coords[1][1]) * coords[2][2] - d - e - f;
    double r=(e - c) * coords[2][2] + d * coords[0][0] - 2 * (coords[0][1] * coords[1][2] * coords[2][0]) + f * coords[1][1];
    double pThirds=p / 3;
    double a=q - p * pThirds;
    double b=(2 * pThirds * pThirds - q) * pThirds + r;
    double aThirds=a / 3;
    double m=2 * Math.sqrt(-aThirds);
    double t=Math.acos(b / (aThirds * m)) / 3;
    double cosT=Math.cos(t);
    double sinT=Math.sin(t);
    double l1=m * cosT - pThirds;
    double l2=-m * ((cosT + Math.sqrt(3) * sinT) / 2) - pThirds;
    double l3=-m * ((cosT - Math.sqrt(3) * sinT) / 2) - pThirds;
    Matrix3x3 m1=clone();
    m1.set(0,0,-l1 + m1.get(0,0));
    m1.set(1,1,-l1 + m1.get(1,1));
    m1.set(2,2,-l1 + m1.get(2,2));
    m1.reduceThis();
    m1.toConsole();
    Vector v1=new Vector(-m1.coords[0][2],-m1.coords[1][2],1);
    Vector v2=null, v3=null;
    if (l2 > WB_Epsilon.EPSILON) {
      Matrix3x3 m2=clone();
      m2.set(0,0,-l2 + m2.get(0,0));
      m2.set(1,1,-l2 + m2.get(1,1));
      m2.set(2,2,-l2 + m2.get(2,2));
      m2.reduceThis();
      v2=new Vector(-m2.coords[0][2],-m2.coords[1][2],1);
    }
    if (l3 > WB_Epsilon.EPSILON) {
      Matrix3x3 m3=clone();
      m3.set(0,0,-l3 + m3.get(0,0));
      m3.set(1,1,-l3 + m3.get(1,1));
      m3.set(2,2,-l3 + m3.get(2,2));
      m3.reduceThis();
      v3=new Vector(-m3.coords[0][2],-m3.coords[1][2],1);
    }
    return new Vector[]{v1,v2,v3};
  }
  EigenvalueDecomposition ed=new EigenvalueDecomposition();
  Vector[] ret=new Vector[3];
  double[][] V=ed.getV().coords;
  ret[0]=new Vector(V[0][0],V[1][0],V[2][0]).multiplyThis(ed.getRealEigenvalues()[0]);
  ret[1]=new Vector(V[0][1],V[1][1],V[2][1]).multiplyThis(ed.getRealEigenvalues()[1]);
  ret[2]=new Vector(V[0][2],V[1][2],V[2][2]).multiplyThis(ed.getRealEigenvalues()[2]);
  return ret;
}