Amesos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
amesos_camd_info.c
Go to the documentation of this file.
1 /* ========================================================================= */
2 /* === CAMD_info =========================================================== */
3 /* ========================================================================= */
4 
5 /* ------------------------------------------------------------------------- */
6 /* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */
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/camd */
10 /* ------------------------------------------------------------------------- */
11 
12 /* User-callable. Prints the output statistics for CAMD. See camd.h
13  * for details. If the Info array is not present, nothing is printed.
14  */
15 
16 #include "amesos_camd_internal.h"
17 
18 #define PRI(format,x) { if (x >= 0) { PRINTF ((format, x)) ; }}
19 
20 GLOBAL void CAMD_info
21 (
22  double Info [ ]
23 )
24 {
25  double n, ndiv, nmultsubs_ldl, nmultsubs_lu, lnz, lnzd ;
26 
27  if (!Info)
28  {
29  return ;
30  }
31 
32  n = Info [CAMD_N] ;
33  ndiv = Info [CAMD_NDIV] ;
34  nmultsubs_ldl = Info [CAMD_NMULTSUBS_LDL] ;
35  nmultsubs_lu = Info [CAMD_NMULTSUBS_LU] ;
36  lnz = Info [CAMD_LNZ] ;
37  lnzd = (n >= 0 && lnz >= 0) ? (n + lnz) : (-1) ;
38 
39  /* CAMD return status */
40  PRINTF ((
41  "\ncamd: approximate minimum degree ordering, results:\n"
42  " status: ")) ;
43  if (Info [CAMD_STATUS] == CAMD_OK)
44  {
45  PRINTF (("OK\n")) ;
46  }
47  else if (Info [CAMD_STATUS] == CAMD_OUT_OF_MEMORY)
48  {
49  PRINTF (("out of memory\n")) ;
50  }
51  else if (Info [CAMD_STATUS] == CAMD_INVALID)
52  {
53  PRINTF (("invalid matrix\n")) ;
54  }
55  else if (Info [CAMD_STATUS] == CAMD_OK_BUT_JUMBLED)
56  {
57  PRINTF (("OK, but jumbled\n")) ;
58  }
59  else
60  {
61  PRINTF (("unknown\n")) ;
62  }
63 
64  /* statistics about the input matrix */
65  PRI (" n, dimension of A: %.20g\n", n);
66  PRI (" nz, number of nonzeros in A: %.20g\n",
67  Info [CAMD_NZ]) ;
68  PRI (" symmetry of A: %.4f\n",
69  Info [CAMD_SYMMETRY]) ;
70  PRI (" number of nonzeros on diagonal: %.20g\n",
71  Info [CAMD_NZDIAG]) ;
72  PRI (" nonzeros in pattern of A+A' (excl. diagonal): %.20g\n",
73  Info [CAMD_NZ_A_PLUS_AT]) ;
74  PRI (" # dense rows/columns of A+A': %.20g\n",
75  Info [CAMD_NDENSE]) ;
76 
77  /* statistics about CAMD's behavior */
78  PRI (" memory used, in bytes: %.20g\n",
79  Info [CAMD_MEMORY]) ;
80  PRI (" # of memory compactions: %.20g\n",
81  Info [CAMD_NCMPA]) ;
82 
83  /* statistics about the ordering quality */
84  PRINTF (("\n"
85  " The following approximate statistics are for a subsequent\n"
86  " factorization of A(P,P) + A(P,P)'. They are slight upper\n"
87  " bounds if there are no dense rows/columns in A+A', and become\n"
88  " looser if dense rows/columns exist.\n\n")) ;
89 
90  PRI (" nonzeros in L (excluding diagonal): %.20g\n",
91  lnz) ;
92  PRI (" nonzeros in L (including diagonal): %.20g\n",
93  lnzd) ;
94  PRI (" # divide operations for LDL' or LU: %.20g\n",
95  ndiv) ;
96  PRI (" # multiply-subtract operations for LDL': %.20g\n",
97  nmultsubs_ldl) ;
98  PRI (" # multiply-subtract operations for LU: %.20g\n",
99  nmultsubs_lu) ;
100  PRI (" max nz. in any column of L (incl. diagonal): %.20g\n",
101  Info [CAMD_DMAX]) ;
102 
103  /* total flop counts for various factorizations */
104 
105  if (n >= 0 && ndiv >= 0 && nmultsubs_ldl >= 0 && nmultsubs_lu >= 0)
106  {
107  PRINTF (("\n"
108  " chol flop count for real A, sqrt counted as 1 flop: %.20g\n"
109  " LDL' flop count for real A: %.20g\n"
110  " LDL' flop count for complex A: %.20g\n"
111  " LU flop count for real A (with no pivoting): %.20g\n"
112  " LU flop count for complex A (with no pivoting): %.20g\n\n",
113  n + ndiv + 2*nmultsubs_ldl,
114  ndiv + 2*nmultsubs_ldl,
115  9*ndiv + 8*nmultsubs_ldl,
116  ndiv + 2*nmultsubs_lu,
117  9*ndiv + 8*nmultsubs_lu)) ;
118  }
119 }
#define CAMD_NZ
Definition: amesos_camd.h:365
#define PRI(format, x)
#define CAMD_DMAX
Definition: amesos_camd.h:376
#define CAMD_MEMORY
Definition: amesos_camd.h:370
#define CAMD_STATUS
Definition: amesos_camd.h:363
#define GLOBAL
#define CAMD_NCMPA
Definition: amesos_camd.h:371
#define CAMD_LNZ
Definition: amesos_camd.h:372
#define CAMD_NMULTSUBS_LDL
Definition: amesos_camd.h:374
#define CAMD_NZDIAG
Definition: amesos_camd.h:367
#define CAMD_NDENSE
Definition: amesos_camd.h:369
#define CAMD_NDIV
Definition: amesos_camd.h:373
#define CAMD_SYMMETRY
Definition: amesos_camd.h:366
#define CAMD_INVALID
Definition: amesos_camd.h:384
#define CAMD_NMULTSUBS_LU
Definition: amesos_camd.h:375
#define CAMD_OUT_OF_MEMORY
Definition: amesos_camd.h:383
#define CAMD_NZ_A_PLUS_AT
Definition: amesos_camd.h:368
#define CAMD_OK
Definition: amesos_camd.h:382
#define CAMD_OK_BUT_JUMBLED
Definition: amesos_camd.h:385
#define PRINTF(params)
GLOBAL void CAMD_info(double Info[])
int n
#define CAMD_N
Definition: amesos_camd.h:364