Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/umfpack/src/amd/amd_info.c
3203 views
1
/* ========================================================================= */
2
/* === AMD_info ============================================================ */
3
/* ========================================================================= */
4
5
/* ------------------------------------------------------------------------- */
6
/* AMD Version 1.1 (Jan. 21, 2004), Copyright (c) 2004 by Timothy A. Davis, */
7
/* Patrick R. Amestoy, and Iain S. Duff. See ../README for License. */
8
/* email: [email protected] 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
if (!Info)
28
{
29
return ;
30
}
31
32
n = Info [AMD_N] ;
33
ndiv = Info [AMD_NDIV] ;
34
nmultsubs_ldl = Info [AMD_NMULTSUBS_LDL] ;
35
nmultsubs_lu = Info [AMD_NMULTSUBS_LU] ;
36
lnz = Info [AMD_LNZ] ;
37
lnzd = (n >= 0 && lnz >= 0) ? (n + lnz) : (-1) ;
38
39
/* AMD return status */
40
PRINTF ((
41
"\namd: approximate minimum degree ordering, results:\n"
42
" status: ")) ;
43
if (Info [AMD_STATUS] == AMD_OK)
44
{
45
PRINTF (("OK\n")) ;
46
}
47
else if (Info [AMD_STATUS] == AMD_OUT_OF_MEMORY)
48
{
49
PRINTF (("out of memory\n")) ;
50
}
51
else if (Info [AMD_STATUS] == AMD_INVALID)
52
{
53
PRINTF (("invalid matrix\n")) ;
54
}
55
else
56
{
57
PRINTF (("unknown\n")) ;
58
}
59
60
/* statistics about the input matrix */
61
PRI (" n, dimension of A: %.20g\n", n);
62
PRI (" nz, number of nonzeros in A: %.20g\n",
63
Info [AMD_NZ]) ;
64
PRI (" symmetry of A: %.4f\n",
65
Info [AMD_SYMMETRY]) ;
66
PRI (" number of nonzeros on diagonal: %.20g\n",
67
Info [AMD_NZDIAG]) ;
68
PRI (" nonzeros in pattern of A+A' (excl. diagonal): %.20g\n",
69
Info [AMD_NZ_A_PLUS_AT]) ;
70
PRI (" # dense rows/columns of A+A': %.20g\n",
71
Info [AMD_NDENSE]) ;
72
73
/* statistics about AMD's behavior */
74
PRI (" memory used, in bytes: %.20g\n",
75
Info [AMD_MEMORY]) ;
76
PRI (" # of memory compactions: %.20g\n",
77
Info [AMD_NCMPA]) ;
78
79
/* statistics about the ordering quality */
80
PRINTF (("\n"
81
" The following approximate statistics are for a subsequent\n"
82
" factorization of A(P,P) + A(P,P)'. They are slight upper\n"
83
" bounds if there are no dense rows/columns in A+A', and become\n"
84
" looser if dense rows/columns exist.\n\n")) ;
85
86
PRI (" nonzeros in L (excluding diagonal): %.20g\n",
87
lnz) ;
88
PRI (" nonzeros in L (including diagonal): %.20g\n",
89
lnzd) ;
90
PRI (" # divide operations for LDL' or LU: %.20g\n",
91
ndiv) ;
92
PRI (" # multiply-subtract operations for LDL': %.20g\n",
93
nmultsubs_ldl) ;
94
PRI (" # multiply-subtract operations for LU: %.20g\n",
95
nmultsubs_lu) ;
96
PRI (" max nz. in any column of L (incl. diagonal): %.20g\n",
97
Info [AMD_DMAX]) ;
98
99
/* total flop counts for various factorizations */
100
101
if (n >= 0 && ndiv >= 0 && nmultsubs_ldl >= 0 && nmultsubs_lu >= 0)
102
{
103
PRINTF (("\n"
104
" chol flop count for real A, sqrt counted as 1 flop: %.20g\n"
105
" LDL' flop count for real A: %.20g\n"
106
" LDL' flop count for complex A: %.20g\n"
107
" LU flop count for real A (with no pivoting): %.20g\n"
108
" LU flop count for complex A (with no pivoting): %.20g\n\n",
109
n + ndiv + 2*nmultsubs_ldl,
110
ndiv + 2*nmultsubs_ldl,
111
9*ndiv + 8*nmultsubs_ldl,
112
ndiv + 2*nmultsubs_lu,
113
9*ndiv + 8*nmultsubs_lu)) ;
114
}
115
}
116
117