Blame view

fvn_sparse/UMFPACK/Source/umfpack_report_symbolic.c 6.92 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
  /* ========================================================================== */
  /* === UMFPACK_report_symbolic ============================================== */
  /* ========================================================================== */
  
  /* -------------------------------------------------------------------------- */
  /* UMFPACK Copyright (c) Timothy A. Davis, CISE,                              */
  /* Univ. of Florida.  All Rights Reserved.  See ../Doc/License for License.   */
  /* web: http://www.cise.ufl.edu/research/sparse/umfpack                       */
  /* -------------------------------------------------------------------------- */
  
  /*
      User-callable.  Prints the Symbolic object. See umfpack_report_symbolic.h
      for details.  Does not print new Cdeg, Rdeg, Esize, and the Diagonal_map.
  
      Dynamic memory usage:  Allocates a size MAX (n_row,n_col)*sizeof(Int)
      workspace via a single call to UMF_malloc and then frees all of it via
      UMF_free on return.  The workspace is not allocated if an early error
      return occurs before the workspace is needed.
  */
  
  #include "umf_internal.h"
  #include "umf_valid_symbolic.h"
  #include "umf_report_perm.h"
  #include "umf_malloc.h"
  #include "umf_free.h"
  
  GLOBAL Int UMFPACK_report_symbolic
  (
      void *SymbolicHandle,
      const double Control [UMFPACK_CONTROL]
  )
  {
      Int n_row, n_col, nz, nchains, nfr, maxnrows, maxncols, prl,
  	k, chain, frontid, frontid1, frontid2, kk, *Chain_start, *W,
  	*Chain_maxrows, *Chain_maxcols, *Front_npivcol, *Front_1strow,
  	*Front_leftmostdesc, *Front_parent, done, status1, status2 ;
      SymbolicType *Symbolic ;
  
      prl = GET_CONTROL (UMFPACK_PRL, UMFPACK_DEFAULT_PRL) ;
  
      if (prl <= 2)
      {
  	return (UMFPACK_OK) ;
      }
  
      PRINTF (("Symbolic object: ")) ;
  
      Symbolic = (SymbolicType *) SymbolicHandle ;
      if (!UMF_valid_symbolic (Symbolic))
      {
  	PRINTF (("ERROR: invalid
  ")) ;
  	return (UMFPACK_ERROR_invalid_Symbolic_object) ;
      }
  
      n_row = Symbolic->n_row ;
      n_col = Symbolic->n_col ;
  
      nz = Symbolic->nz ;
  
      nchains = Symbolic->nchains ;
      nfr = Symbolic->nfr ;
      maxnrows = Symbolic->maxnrows ;
      maxncols = Symbolic->maxncols ;
  
      Chain_start = Symbolic->Chain_start ;
      Chain_maxrows = Symbolic->Chain_maxrows ;
      Chain_maxcols = Symbolic->Chain_maxcols ;
      Front_npivcol = Symbolic->Front_npivcol ;
      Front_1strow = Symbolic->Front_1strow ;
      Front_leftmostdesc = Symbolic->Front_leftmostdesc ;
      Front_parent = Symbolic->Front_parent ;
  
      if (prl >= 4)
      {
  
  	PRINTF (("
      matrix to be factorized:
  ")) ;
  	PRINTF (("\tn_row: "ID" n_col: "ID"
  ", n_row, n_col)) ;
  	PRINTF (("\tnumber of entries: "ID"
  ", nz)) ;
  	PRINTF (("    block size used for dense matrix kernels:   "ID"
  ",
  	Symbolic->nb)) ;
  
  	PRINTF (("    strategy used:                              ")) ;
  	/* strategy cannot be auto */
  	if (Symbolic->strategy == UMFPACK_STRATEGY_SYMMETRIC)
  	{
  	    PRINTF (("symmetric")) ;
  	}
  	else if (Symbolic->strategy == UMFPACK_STRATEGY_UNSYMMETRIC)
  	{
  	    PRINTF (("unsymmetric")) ;
  	}
  	else if (Symbolic->strategy == UMFPACK_STRATEGY_2BY2)
  	{
  	    PRINTF (("symmetric 2-by-2")) ;
  	}
  	PRINTF (("
  ")) ;
  
  	PRINTF (("    ordering used:                              ")) ;
  	if (Symbolic->ordering == UMFPACK_ORDERING_COLAMD)
  	{
  	    PRINTF (("colamd on A
  ")) ;
  	}
  	else if (Symbolic->ordering == UMFPACK_ORDERING_AMD)
  	{
  	    PRINTF (("amd on A+A'
  ")) ;
  	}
  	else if (Symbolic->ordering == UMFPACK_ORDERING_GIVEN)
  	{
  	    PRINTF (("provided by user")) ;
  	}
  	PRINTF (("
  ")) ;
  
  	PRINTF (("    performn column etree postorder:            ")) ;
  	if (Symbolic->fixQ)
  	{
  	    PRINTF (("no
  ")) ;
  	}
  	else
  	{
  	    PRINTF (("yes
  ")) ;
  	}
  
  	PRINTF (("    prefer diagonal pivoting (attempt P=Q):     ")) ;
  	if (Symbolic->prefer_diagonal)
  	{
  	    PRINTF (("yes
  ")) ;
  	}
  	else
  	{
  	    PRINTF (("no
  ")) ;
  	}
  
  	PRINTF (("    variable-size part of Numeric object:
  ")) ;
  	PRINTF (("\tminimum initial size (Units): %.20g  (MBytes): %.1f
  ",
  	    Symbolic->dnum_mem_init_usage,
  	    MBYTES (Symbolic->dnum_mem_init_usage))) ;
  	PRINTF (("\testimated peak size (Units):  %.20g  (MBytes): %.1f
  ",
  	    Symbolic->num_mem_usage_est,
  	    MBYTES (Symbolic->num_mem_usage_est))) ;
  	PRINTF (("\testimated final size (Units): %.20g  (MBytes): %.1f
  ",
  	    Symbolic->num_mem_size_est,
  	    MBYTES (Symbolic->num_mem_size_est))) ;
  	PRINTF (("    symbolic factorization memory usage (Units):"
  	    " %.20g  (MBytes): %.1f
  ",
  	    Symbolic->peak_sym_usage,
  	    MBYTES (Symbolic->peak_sym_usage))) ;
  	PRINTF (("    frontal matrices / supercolumns:
  ")) ;
  	PRINTF (("\tnumber of frontal chains: "ID"
  ", nchains)) ;
  	PRINTF (("\tnumber of frontal matrices: "ID"
  ", nfr)) ;
  	PRINTF (("\tlargest frontal matrix row dimension: "ID"
  ", maxnrows)) ;
  	PRINTF (("\tlargest frontal matrix column dimension: "ID"
  ",maxncols));
      }
  
      k = 0 ;
      done = FALSE ;
  
      for (chain = 0 ; chain < nchains ; chain++)
      {
  	frontid1 = Chain_start [chain] ;
  	frontid2 = Chain_start [chain+1] - 1 ;
  	PRINTF4 (("
      Frontal chain: "ID".  Frontal matrices "ID" to "ID"
  ",
  	    INDEX (chain), INDEX (frontid1), INDEX (frontid2))) ;
  	PRINTF4 (("\tLargest frontal matrix in Frontal chain: "ID"-by-"ID"
  ",
  	    Chain_maxrows [chain], Chain_maxcols [chain])) ;
  	for (frontid = frontid1 ; frontid <= frontid2 ; frontid++)
  	{
  	    kk = Front_npivcol [frontid] ;
  	    PRINTF4 (("\tFront: "ID"  pivot cols: "ID" (pivot columns "ID" to "
  		ID")
  ", INDEX (frontid), kk, INDEX (k), INDEX (k+kk-1))) ;
  	    PRINTF4 (("\t    pivot row candidates: "ID" to "ID"
  ",
  		INDEX (Front_1strow [Front_leftmostdesc [frontid]]),
  		INDEX (Front_1strow [frontid+1]-1))) ;
  	    PRINTF4 (("\t    leftmost descendant: "ID"
  ",
  		INDEX (Front_leftmostdesc [frontid]))) ;
  	    PRINTF4 (("\t    1st new candidate row : "ID"
  ",
  		INDEX (Front_1strow [frontid]))) ;
  	    PRINTF4 (("\t    parent:")) ;
  	    if (Front_parent [frontid] == EMPTY)
  	    {
  		PRINTF4 ((" (none)
  ")) ;
  	    }
  	    else
  	    {
  		PRINTF4 ((" "ID"
  ", INDEX (Front_parent [frontid]))) ;
  	    }
  	    done = (frontid == 20 && frontid < nfr-1 && prl == 4) ;
  	    if (done)
  	    {
  		PRINTF4 (("\t...
  ")) ;
  		break ;
  	    }
  	    k += kk ;
  	}
  	if (Front_npivcol [nfr] != 0)
  	{
  	    PRINTF4 (("\tFront: "ID" placeholder for "ID" empty columns
  ",
  		INDEX (nfr), Front_npivcol [nfr])) ;
  	}
  	if (done)
  	{
  	    break ;
  	}
      }
  
      W = (Int *) UMF_malloc (MAX (n_row, n_col), sizeof (Int)) ;
      if (!W)
      {
  	PRINTF (("ERROR: out of memory to check Symbolic object
  
  ")) ;
  	return (UMFPACK_ERROR_out_of_memory) ;
      }
  
      PRINTF4 (("
  Initial column permutation, Q1: ")) ;
      status1 = UMF_report_perm (n_col, Symbolic->Cperm_init, W, prl, 0) ;
  
      PRINTF4 (("
  Initial row permutation, P1: ")) ;
      status2 = UMF_report_perm (n_row, Symbolic->Rperm_init, W, prl, 0) ;
  
      (void) UMF_free ((void *) W) ;
  
      if (status1 != UMFPACK_OK || status2 != UMFPACK_OK)
      {
  	return (UMFPACK_ERROR_invalid_Symbolic_object) ;
      }
  
      PRINTF4 (("    Symbolic object:  ")) ;
      PRINTF (("OK
  
  ")) ;
      return (UMFPACK_OK) ;
  }