rev |
line source |
alpar@9
|
1 /* ========================================================================= */
|
alpar@9
|
2 /* === AMD_info ============================================================ */
|
alpar@9
|
3 /* ========================================================================= */
|
alpar@9
|
4
|
alpar@9
|
5 /* ------------------------------------------------------------------------- */
|
alpar@9
|
6 /* AMD, Copyright (c) Timothy A. Davis, */
|
alpar@9
|
7 /* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */
|
alpar@9
|
8 /* email: davis at cise.ufl.edu CISE Department, Univ. of Florida. */
|
alpar@9
|
9 /* web: http://www.cise.ufl.edu/research/sparse/amd */
|
alpar@9
|
10 /* ------------------------------------------------------------------------- */
|
alpar@9
|
11
|
alpar@9
|
12 /* User-callable. Prints the output statistics for AMD. See amd.h
|
alpar@9
|
13 * for details. If the Info array is not present, nothing is printed.
|
alpar@9
|
14 */
|
alpar@9
|
15
|
alpar@9
|
16 #include "amd_internal.h"
|
alpar@9
|
17
|
alpar@9
|
18 #define PRI(format,x) { if (x >= 0) { PRINTF ((format, x)) ; }}
|
alpar@9
|
19
|
alpar@9
|
20 GLOBAL void AMD_info
|
alpar@9
|
21 (
|
alpar@9
|
22 double Info [ ]
|
alpar@9
|
23 )
|
alpar@9
|
24 {
|
alpar@9
|
25 double n, ndiv, nmultsubs_ldl, nmultsubs_lu, lnz, lnzd ;
|
alpar@9
|
26
|
alpar@9
|
27 PRINTF (("\nAMD version %d.%d.%d, %s, results:\n",
|
alpar@9
|
28 AMD_MAIN_VERSION, AMD_SUB_VERSION, AMD_SUBSUB_VERSION, AMD_DATE)) ;
|
alpar@9
|
29
|
alpar@9
|
30 if (!Info)
|
alpar@9
|
31 {
|
alpar@9
|
32 return ;
|
alpar@9
|
33 }
|
alpar@9
|
34
|
alpar@9
|
35 n = Info [AMD_N] ;
|
alpar@9
|
36 ndiv = Info [AMD_NDIV] ;
|
alpar@9
|
37 nmultsubs_ldl = Info [AMD_NMULTSUBS_LDL] ;
|
alpar@9
|
38 nmultsubs_lu = Info [AMD_NMULTSUBS_LU] ;
|
alpar@9
|
39 lnz = Info [AMD_LNZ] ;
|
alpar@9
|
40 lnzd = (n >= 0 && lnz >= 0) ? (n + lnz) : (-1) ;
|
alpar@9
|
41
|
alpar@9
|
42 /* AMD return status */
|
alpar@9
|
43 PRINTF ((" status: ")) ;
|
alpar@9
|
44 if (Info [AMD_STATUS] == AMD_OK)
|
alpar@9
|
45 {
|
alpar@9
|
46 PRINTF (("OK\n")) ;
|
alpar@9
|
47 }
|
alpar@9
|
48 else if (Info [AMD_STATUS] == AMD_OUT_OF_MEMORY)
|
alpar@9
|
49 {
|
alpar@9
|
50 PRINTF (("out of memory\n")) ;
|
alpar@9
|
51 }
|
alpar@9
|
52 else if (Info [AMD_STATUS] == AMD_INVALID)
|
alpar@9
|
53 {
|
alpar@9
|
54 PRINTF (("invalid matrix\n")) ;
|
alpar@9
|
55 }
|
alpar@9
|
56 else if (Info [AMD_STATUS] == AMD_OK_BUT_JUMBLED)
|
alpar@9
|
57 {
|
alpar@9
|
58 PRINTF (("OK, but jumbled\n")) ;
|
alpar@9
|
59 }
|
alpar@9
|
60 else
|
alpar@9
|
61 {
|
alpar@9
|
62 PRINTF (("unknown\n")) ;
|
alpar@9
|
63 }
|
alpar@9
|
64
|
alpar@9
|
65 /* statistics about the input matrix */
|
alpar@9
|
66 PRI (" n, dimension of A: %.20g\n", n);
|
alpar@9
|
67 PRI (" nz, number of nonzeros in A: %.20g\n",
|
alpar@9
|
68 Info [AMD_NZ]) ;
|
alpar@9
|
69 PRI (" symmetry of A: %.4f\n",
|
alpar@9
|
70 Info [AMD_SYMMETRY]) ;
|
alpar@9
|
71 PRI (" number of nonzeros on diagonal: %.20g\n",
|
alpar@9
|
72 Info [AMD_NZDIAG]) ;
|
alpar@9
|
73 PRI (" nonzeros in pattern of A+A' (excl. diagonal): %.20g\n",
|
alpar@9
|
74 Info [AMD_NZ_A_PLUS_AT]) ;
|
alpar@9
|
75 PRI (" # dense rows/columns of A+A': %.20g\n",
|
alpar@9
|
76 Info [AMD_NDENSE]) ;
|
alpar@9
|
77
|
alpar@9
|
78 /* statistics about AMD's behavior */
|
alpar@9
|
79 PRI (" memory used, in bytes: %.20g\n",
|
alpar@9
|
80 Info [AMD_MEMORY]) ;
|
alpar@9
|
81 PRI (" # of memory compactions: %.20g\n",
|
alpar@9
|
82 Info [AMD_NCMPA]) ;
|
alpar@9
|
83
|
alpar@9
|
84 /* statistics about the ordering quality */
|
alpar@9
|
85 PRINTF (("\n"
|
alpar@9
|
86 " The following approximate statistics are for a subsequent\n"
|
alpar@9
|
87 " factorization of A(P,P) + A(P,P)'. They are slight upper\n"
|
alpar@9
|
88 " bounds if there are no dense rows/columns in A+A', and become\n"
|
alpar@9
|
89 " looser if dense rows/columns exist.\n\n")) ;
|
alpar@9
|
90
|
alpar@9
|
91 PRI (" nonzeros in L (excluding diagonal): %.20g\n",
|
alpar@9
|
92 lnz) ;
|
alpar@9
|
93 PRI (" nonzeros in L (including diagonal): %.20g\n",
|
alpar@9
|
94 lnzd) ;
|
alpar@9
|
95 PRI (" # divide operations for LDL' or LU: %.20g\n",
|
alpar@9
|
96 ndiv) ;
|
alpar@9
|
97 PRI (" # multiply-subtract operations for LDL': %.20g\n",
|
alpar@9
|
98 nmultsubs_ldl) ;
|
alpar@9
|
99 PRI (" # multiply-subtract operations for LU: %.20g\n",
|
alpar@9
|
100 nmultsubs_lu) ;
|
alpar@9
|
101 PRI (" max nz. in any column of L (incl. diagonal): %.20g\n",
|
alpar@9
|
102 Info [AMD_DMAX]) ;
|
alpar@9
|
103
|
alpar@9
|
104 /* total flop counts for various factorizations */
|
alpar@9
|
105
|
alpar@9
|
106 if (n >= 0 && ndiv >= 0 && nmultsubs_ldl >= 0 && nmultsubs_lu >= 0)
|
alpar@9
|
107 {
|
alpar@9
|
108 PRINTF (("\n"
|
alpar@9
|
109 " chol flop count for real A, sqrt counted as 1 flop: %.20g\n"
|
alpar@9
|
110 " LDL' flop count for real A: %.20g\n"
|
alpar@9
|
111 " LDL' flop count for complex A: %.20g\n"
|
alpar@9
|
112 " LU flop count for real A (with no pivoting): %.20g\n"
|
alpar@9
|
113 " LU flop count for complex A (with no pivoting): %.20g\n\n",
|
alpar@9
|
114 n + ndiv + 2*nmultsubs_ldl,
|
alpar@9
|
115 ndiv + 2*nmultsubs_ldl,
|
alpar@9
|
116 9*ndiv + 8*nmultsubs_ldl,
|
alpar@9
|
117 ndiv + 2*nmultsubs_lu,
|
alpar@9
|
118 9*ndiv + 8*nmultsubs_lu)) ;
|
alpar@9
|
119 }
|
alpar@9
|
120 }
|