public static Vec3 ComputePrincipleComponent(Sym3x3 matrix) { Vec4 row0 = new Vec4(matrix[0], matrix[1], matrix[2], 0.0f); Vec4 row1 = new Vec4(matrix[1], matrix[3], matrix[4], 0.0f); Vec4 row2 = new Vec4(matrix[2], matrix[4], matrix[5], 0.0f); Vec4 v = new Vec4(1.0f); for (int i = 0; i < 8; ++i) { // matrix multiply Vec4 w = row0 * v.SplatX(); w = row1.MultiplyAdd(v.SplatY(), w); w = row2.MultiplyAdd(v.SplatZ(), w); // get max component from xyz in all channels Vec4 a = Vec4.Max(w.SplatX(), Vec4.Max(w.SplatY(), w.SplatZ())); // divide through and advance v = w * a.Reciprocal(); } return(v.GetVec3()); }