bool testDet(Mat_DP* A, Vec_CPLX_DP* eigens, double tol) { std::complex<double> prodOfEigens = 0; for (int i = 0; i < A->nrows(); i++) { prodOfEigens *= (*eigens)[i]; } double det = detmat((*A)); return (abs(det - prodOfEigens) > tol); }
void invmat(double *mat, double *imat) /* ======== Inverse of a 3x3 matrix ========= */ /* DO NOT MAKE THE OUTPUT THE SAME AS ONE OF THE INPUTS!! */ { double det; int count; det = detmat(mat); /* Determinant */ adjmat(mat, imat); /* Adjoint */ for (count=0; count<9; count++) *imat++ /= det; }