1 /* ========================================================================= */
2 /* === AMD_info ============================================================ */
3 /* ========================================================================= */
5 /* ------------------------------------------------------------------------- */
6 /* AMD, Copyright (c) Timothy A. Davis, */
7 /* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */
8 /* email: davis at cise.ufl.edu CISE Department, Univ. of Florida. */
9 /* web: http://www.cise.ufl.edu/research/sparse/amd */
10 /* ------------------------------------------------------------------------- */
12 /* User-callable. Prints the output statistics for AMD. See amd.h
13 * for details. If the Info array is not present, nothing is printed.
16 #include "amd_internal.h"
18 #define PRI(format,x) { if (x >= 0) { PRINTF ((format, x)) ; }}
25 double n, ndiv, nmultsubs_ldl, nmultsubs_lu, lnz, lnzd ;
27 PRINTF (("\nAMD version %d.%d.%d, %s, results:\n",
28 AMD_MAIN_VERSION, AMD_SUB_VERSION, AMD_SUBSUB_VERSION, AMD_DATE)) ;
36 ndiv = Info [AMD_NDIV] ;
37 nmultsubs_ldl = Info [AMD_NMULTSUBS_LDL] ;
38 nmultsubs_lu = Info [AMD_NMULTSUBS_LU] ;
39 lnz = Info [AMD_LNZ] ;
40 lnzd = (n >= 0 && lnz >= 0) ? (n + lnz) : (-1) ;
42 /* AMD return status */
43 PRINTF ((" status: ")) ;
44 if (Info [AMD_STATUS] == AMD_OK)
48 else if (Info [AMD_STATUS] == AMD_OUT_OF_MEMORY)
50 PRINTF (("out of memory\n")) ;
52 else if (Info [AMD_STATUS] == AMD_INVALID)
54 PRINTF (("invalid matrix\n")) ;
56 else if (Info [AMD_STATUS] == AMD_OK_BUT_JUMBLED)
58 PRINTF (("OK, but jumbled\n")) ;
62 PRINTF (("unknown\n")) ;
65 /* statistics about the input matrix */
66 PRI (" n, dimension of A: %.20g\n", n);
67 PRI (" nz, number of nonzeros in A: %.20g\n",
69 PRI (" symmetry of A: %.4f\n",
70 Info [AMD_SYMMETRY]) ;
71 PRI (" number of nonzeros on diagonal: %.20g\n",
73 PRI (" nonzeros in pattern of A+A' (excl. diagonal): %.20g\n",
74 Info [AMD_NZ_A_PLUS_AT]) ;
75 PRI (" # dense rows/columns of A+A': %.20g\n",
78 /* statistics about AMD's behavior */
79 PRI (" memory used, in bytes: %.20g\n",
81 PRI (" # of memory compactions: %.20g\n",
84 /* statistics about the ordering quality */
86 " The following approximate statistics are for a subsequent\n"
87 " factorization of A(P,P) + A(P,P)'. They are slight upper\n"
88 " bounds if there are no dense rows/columns in A+A', and become\n"
89 " looser if dense rows/columns exist.\n\n")) ;
91 PRI (" nonzeros in L (excluding diagonal): %.20g\n",
93 PRI (" nonzeros in L (including diagonal): %.20g\n",
95 PRI (" # divide operations for LDL' or LU: %.20g\n",
97 PRI (" # multiply-subtract operations for LDL': %.20g\n",
99 PRI (" # multiply-subtract operations for LU: %.20g\n",
101 PRI (" max nz. in any column of L (incl. diagonal): %.20g\n",
104 /* total flop counts for various factorizations */
106 if (n >= 0 && ndiv >= 0 && nmultsubs_ldl >= 0 && nmultsubs_lu >= 0)
109 " chol flop count for real A, sqrt counted as 1 flop: %.20g\n"
110 " LDL' flop count for real A: %.20g\n"
111 " LDL' flop count for complex A: %.20g\n"
112 " LU flop count for real A (with no pivoting): %.20g\n"
113 " LU flop count for complex A (with no pivoting): %.20g\n\n",
114 n + ndiv + 2*nmultsubs_ldl,
115 ndiv + 2*nmultsubs_ldl,
116 9*ndiv + 8*nmultsubs_ldl,
117 ndiv + 2*nmultsubs_lu,
118 9*ndiv + 8*nmultsubs_lu)) ;