1 | /* ========================================================================= */ |
---|
2 | /* === AMD_info ============================================================ */ |
---|
3 | /* ========================================================================= */ |
---|
4 | |
---|
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 | /* ------------------------------------------------------------------------- */ |
---|
11 | |
---|
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. |
---|
14 | */ |
---|
15 | |
---|
16 | #include "amd_internal.h" |
---|
17 | |
---|
18 | #define PRI(format,x) { if (x >= 0) { PRINTF ((format, x)) ; }} |
---|
19 | |
---|
20 | GLOBAL void AMD_info |
---|
21 | ( |
---|
22 | double Info [ ] |
---|
23 | ) |
---|
24 | { |
---|
25 | double n, ndiv, nmultsubs_ldl, nmultsubs_lu, lnz, lnzd ; |
---|
26 | |
---|
27 | PRINTF (("\nAMD version %d.%d.%d, %s, results:\n", |
---|
28 | AMD_MAIN_VERSION, AMD_SUB_VERSION, AMD_SUBSUB_VERSION, AMD_DATE)) ; |
---|
29 | |
---|
30 | if (!Info) |
---|
31 | { |
---|
32 | return ; |
---|
33 | } |
---|
34 | |
---|
35 | n = Info [AMD_N] ; |
---|
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) ; |
---|
41 | |
---|
42 | /* AMD return status */ |
---|
43 | PRINTF ((" status: ")) ; |
---|
44 | if (Info [AMD_STATUS] == AMD_OK) |
---|
45 | { |
---|
46 | PRINTF (("OK\n")) ; |
---|
47 | } |
---|
48 | else if (Info [AMD_STATUS] == AMD_OUT_OF_MEMORY) |
---|
49 | { |
---|
50 | PRINTF (("out of memory\n")) ; |
---|
51 | } |
---|
52 | else if (Info [AMD_STATUS] == AMD_INVALID) |
---|
53 | { |
---|
54 | PRINTF (("invalid matrix\n")) ; |
---|
55 | } |
---|
56 | else if (Info [AMD_STATUS] == AMD_OK_BUT_JUMBLED) |
---|
57 | { |
---|
58 | PRINTF (("OK, but jumbled\n")) ; |
---|
59 | } |
---|
60 | else |
---|
61 | { |
---|
62 | PRINTF (("unknown\n")) ; |
---|
63 | } |
---|
64 | |
---|
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", |
---|
68 | Info [AMD_NZ]) ; |
---|
69 | PRI (" symmetry of A: %.4f\n", |
---|
70 | Info [AMD_SYMMETRY]) ; |
---|
71 | PRI (" number of nonzeros on diagonal: %.20g\n", |
---|
72 | Info [AMD_NZDIAG]) ; |
---|
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", |
---|
76 | Info [AMD_NDENSE]) ; |
---|
77 | |
---|
78 | /* statistics about AMD's behavior */ |
---|
79 | PRI (" memory used, in bytes: %.20g\n", |
---|
80 | Info [AMD_MEMORY]) ; |
---|
81 | PRI (" # of memory compactions: %.20g\n", |
---|
82 | Info [AMD_NCMPA]) ; |
---|
83 | |
---|
84 | /* statistics about the ordering quality */ |
---|
85 | PRINTF (("\n" |
---|
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")) ; |
---|
90 | |
---|
91 | PRI (" nonzeros in L (excluding diagonal): %.20g\n", |
---|
92 | lnz) ; |
---|
93 | PRI (" nonzeros in L (including diagonal): %.20g\n", |
---|
94 | lnzd) ; |
---|
95 | PRI (" # divide operations for LDL' or LU: %.20g\n", |
---|
96 | ndiv) ; |
---|
97 | PRI (" # multiply-subtract operations for LDL': %.20g\n", |
---|
98 | nmultsubs_ldl) ; |
---|
99 | PRI (" # multiply-subtract operations for LU: %.20g\n", |
---|
100 | nmultsubs_lu) ; |
---|
101 | PRI (" max nz. in any column of L (incl. diagonal): %.20g\n", |
---|
102 | Info [AMD_DMAX]) ; |
---|
103 | |
---|
104 | /* total flop counts for various factorizations */ |
---|
105 | |
---|
106 | if (n >= 0 && ndiv >= 0 && nmultsubs_ldl >= 0 && nmultsubs_lu >= 0) |
---|
107 | { |
---|
108 | PRINTF (("\n" |
---|
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)) ; |
---|
119 | } |
---|
120 | } |
---|