Blame view

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