/** * <p> * Checks to see if a matrix is orthogonal or isometric. * </p> * * @param Q The matrix being tested. Not modified. * @param tol Tolerance. * @return True if it passes the test. */ public static bool isOrthogonal(DMatrixRMaj Q, double tol) { if (Q.numRows < Q.numCols) { throw new ArgumentException("The number of rows must be more than or equal to the number of columns"); } DMatrixRMaj[] u = CommonOps_DDRM.columnsToVector(Q, null); for (int i = 0; i < u.Count(); i++) { DMatrixRMaj a = u[i]; for (int j = i + 1; j < u.Count(); j++) { double val = VectorVectorMult_DDRM.innerProd(a, u[j]); if (!(Math.Abs(val) <= tol)) { return(false); } } } return(true); }