alpar@1: /* ========================================================================= */ alpar@1: /* === AMD_info ============================================================ */ alpar@1: /* ========================================================================= */ alpar@1: alpar@1: /* ------------------------------------------------------------------------- */ alpar@1: /* AMD, Copyright (c) Timothy A. Davis, */ alpar@1: /* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ alpar@1: /* email: davis at cise.ufl.edu CISE Department, Univ. of Florida. */ alpar@1: /* web: http://www.cise.ufl.edu/research/sparse/amd */ alpar@1: /* ------------------------------------------------------------------------- */ alpar@1: alpar@1: /* User-callable. Prints the output statistics for AMD. See amd.h alpar@1: * for details. If the Info array is not present, nothing is printed. alpar@1: */ alpar@1: alpar@1: #include "amd_internal.h" alpar@1: alpar@1: #define PRI(format,x) { if (x >= 0) { PRINTF ((format, x)) ; }} alpar@1: alpar@1: GLOBAL void AMD_info alpar@1: ( alpar@1: double Info [ ] alpar@1: ) alpar@1: { alpar@1: double n, ndiv, nmultsubs_ldl, nmultsubs_lu, lnz, lnzd ; alpar@1: alpar@1: PRINTF (("\nAMD version %d.%d.%d, %s, results:\n", alpar@1: AMD_MAIN_VERSION, AMD_SUB_VERSION, AMD_SUBSUB_VERSION, AMD_DATE)) ; alpar@1: alpar@1: if (!Info) alpar@1: { alpar@1: return ; alpar@1: } alpar@1: alpar@1: n = Info [AMD_N] ; alpar@1: ndiv = Info [AMD_NDIV] ; alpar@1: nmultsubs_ldl = Info [AMD_NMULTSUBS_LDL] ; alpar@1: nmultsubs_lu = Info [AMD_NMULTSUBS_LU] ; alpar@1: lnz = Info [AMD_LNZ] ; alpar@1: lnzd = (n >= 0 && lnz >= 0) ? (n + lnz) : (-1) ; alpar@1: alpar@1: /* AMD return status */ alpar@1: PRINTF ((" status: ")) ; alpar@1: if (Info [AMD_STATUS] == AMD_OK) alpar@1: { alpar@1: PRINTF (("OK\n")) ; alpar@1: } alpar@1: else if (Info [AMD_STATUS] == AMD_OUT_OF_MEMORY) alpar@1: { alpar@1: PRINTF (("out of memory\n")) ; alpar@1: } alpar@1: else if (Info [AMD_STATUS] == AMD_INVALID) alpar@1: { alpar@1: PRINTF (("invalid matrix\n")) ; alpar@1: } alpar@1: else if (Info [AMD_STATUS] == AMD_OK_BUT_JUMBLED) alpar@1: { alpar@1: PRINTF (("OK, but jumbled\n")) ; alpar@1: } alpar@1: else alpar@1: { alpar@1: PRINTF (("unknown\n")) ; alpar@1: } alpar@1: alpar@1: /* statistics about the input matrix */ alpar@1: PRI (" n, dimension of A: %.20g\n", n); alpar@1: PRI (" nz, number of nonzeros in A: %.20g\n", alpar@1: Info [AMD_NZ]) ; alpar@1: PRI (" symmetry of A: %.4f\n", alpar@1: Info [AMD_SYMMETRY]) ; alpar@1: PRI (" number of nonzeros on diagonal: %.20g\n", alpar@1: Info [AMD_NZDIAG]) ; alpar@1: PRI (" nonzeros in pattern of A+A' (excl. diagonal): %.20g\n", alpar@1: Info [AMD_NZ_A_PLUS_AT]) ; alpar@1: PRI (" # dense rows/columns of A+A': %.20g\n", alpar@1: Info [AMD_NDENSE]) ; alpar@1: alpar@1: /* statistics about AMD's behavior */ alpar@1: PRI (" memory used, in bytes: %.20g\n", alpar@1: Info [AMD_MEMORY]) ; alpar@1: PRI (" # of memory compactions: %.20g\n", alpar@1: Info [AMD_NCMPA]) ; alpar@1: alpar@1: /* statistics about the ordering quality */ alpar@1: PRINTF (("\n" alpar@1: " The following approximate statistics are for a subsequent\n" alpar@1: " factorization of A(P,P) + A(P,P)'. They are slight upper\n" alpar@1: " bounds if there are no dense rows/columns in A+A', and become\n" alpar@1: " looser if dense rows/columns exist.\n\n")) ; alpar@1: alpar@1: PRI (" nonzeros in L (excluding diagonal): %.20g\n", alpar@1: lnz) ; alpar@1: PRI (" nonzeros in L (including diagonal): %.20g\n", alpar@1: lnzd) ; alpar@1: PRI (" # divide operations for LDL' or LU: %.20g\n", alpar@1: ndiv) ; alpar@1: PRI (" # multiply-subtract operations for LDL': %.20g\n", alpar@1: nmultsubs_ldl) ; alpar@1: PRI (" # multiply-subtract operations for LU: %.20g\n", alpar@1: nmultsubs_lu) ; alpar@1: PRI (" max nz. in any column of L (incl. diagonal): %.20g\n", alpar@1: Info [AMD_DMAX]) ; alpar@1: alpar@1: /* total flop counts for various factorizations */ alpar@1: alpar@1: if (n >= 0 && ndiv >= 0 && nmultsubs_ldl >= 0 && nmultsubs_lu >= 0) alpar@1: { alpar@1: PRINTF (("\n" alpar@1: " chol flop count for real A, sqrt counted as 1 flop: %.20g\n" alpar@1: " LDL' flop count for real A: %.20g\n" alpar@1: " LDL' flop count for complex A: %.20g\n" alpar@1: " LU flop count for real A (with no pivoting): %.20g\n" alpar@1: " LU flop count for complex A (with no pivoting): %.20g\n\n", alpar@1: n + ndiv + 2*nmultsubs_ldl, alpar@1: ndiv + 2*nmultsubs_ldl, alpar@1: 9*ndiv + 8*nmultsubs_ldl, alpar@1: ndiv + 2*nmultsubs_lu, alpar@1: 9*ndiv + 8*nmultsubs_lu)) ; alpar@1: } alpar@1: }