Amesos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
amesos_ccolamd.h
Go to the documentation of this file.
1 /* ========================================================================== */
2 /* === CCOLAMD/ccolamd.h ==================================================== */
3 /* ========================================================================== */
4 
5 /* ----------------------------------------------------------------------------
6  * CCOLAMD Copyright (C), Univ. of Florida. Authors: Timothy A. Davis,
7  * Sivasankaran Rajamanickam, and Stefan Larimore
8  * See License.txt for the Version 2.1 of the GNU Lesser General Public License
9  * http://www.cise.ufl.edu/research/sparse
10  * -------------------------------------------------------------------------- */
11 
12 /*
13  * You must include this file (ccolamd.h) in any routine that uses ccolamd,
14  * csymamd, or the related macros and definitions.
15  */
16 
17 #ifndef AMESOS_CCOLAMD_H
18 #define AMESOS_CCOLAMD_H
19 
20 /* make it easy for C++ programs to include CCOLAMD */
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 /* for size_t definition: */
26 #include <stdlib.h>
27 
28 /* ========================================================================== */
29 /* === CCOLAMD version ====================================================== */
30 /* ========================================================================== */
31 
32 /* All versions of CCOLAMD will include the following definitions.
33  * As an example, to test if the version you are using is 1.3 or later:
34  *
35  * if (CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)) ...
36  *
37  * This also works during compile-time:
38  *
39  * #if CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)
40  * printf ("This is version 1.3 or later\n") ;
41  * #else
42  * printf ("This is an early version\n") ;
43  * #endif
44  */
45 
46 #define CCOLAMD_DATE "May 31, 2007"
47 #define CCOLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub))
48 #define CCOLAMD_MAIN_VERSION 2
49 #define CCOLAMD_SUB_VERSION 7
50 #define CCOLAMD_SUBSUB_VERSION 0
51 #define CCOLAMD_VERSION \
52  CCOLAMD_VERSION_CODE(CCOLAMD_MAIN_VERSION,CCOLAMD_SUB_VERSION)
53 
54 /* ========================================================================== */
55 /* === Knob and statistics definitions ====================================== */
56 /* ========================================================================== */
57 
58 /* size of the knobs [ ] array. Only knobs [0..3] are currently used. */
59 #define CCOLAMD_KNOBS 20
60 
61 /* number of output statistics. Only stats [0..10] are currently used. */
62 #define CCOLAMD_STATS 20
63 
64 /* knobs [0] and stats [0]: dense row knob and output statistic. */
65 #define CCOLAMD_DENSE_ROW 0
66 
67 /* knobs [1] and stats [1]: dense column knob and output statistic. */
68 #define CCOLAMD_DENSE_COL 1
69 
70 /* knobs [2]: aggressive absorption option */
71 #define CCOLAMD_AGGRESSIVE 2
72 
73 /* knobs [3]: LU or Cholesky factorization option */
74 #define CCOLAMD_LU 3
75 
76 /* stats [2]: memory defragmentation count output statistic */
77 #define CCOLAMD_DEFRAG_COUNT 2
78 
79 /* stats [3]: ccolamd status: zero OK, > 0 warning or notice, < 0 error */
80 #define CCOLAMD_STATUS 3
81 
82 /* stats [4..6]: error info, or info on jumbled columns */
83 #define CCOLAMD_INFO1 4
84 #define CCOLAMD_INFO2 5
85 #define CCOLAMD_INFO3 6
86 
87 /* stats [7]: number of originally empty rows */
88 #define CCOLAMD_EMPTY_ROW 7
89 /* stats [8]: number of originally empty cols */
90 #define CCOLAMD_EMPTY_COL 8
91 /* stats [9]: number of rows with entries only in dense cols */
92 #define CCOLAMD_NEWLY_EMPTY_ROW 9
93 /* stats [10]: number of cols with entries only in dense rows */
94 #define CCOLAMD_NEWLY_EMPTY_COL 10
95 
96 /* error codes returned in stats [3]: */
97 #define CCOLAMD_OK (0)
98 #define CCOLAMD_OK_BUT_JUMBLED (1)
99 #define CCOLAMD_ERROR_A_not_present (-1)
100 #define CCOLAMD_ERROR_p_not_present (-2)
101 #define CCOLAMD_ERROR_nrow_negative (-3)
102 #define CCOLAMD_ERROR_ncol_negative (-4)
103 #define CCOLAMD_ERROR_nnz_negative (-5)
104 #define CCOLAMD_ERROR_p0_nonzero (-6)
105 #define CCOLAMD_ERROR_A_too_small (-7)
106 #define CCOLAMD_ERROR_col_length_negative (-8)
107 #define CCOLAMD_ERROR_row_index_out_of_bounds (-9)
108 #define CCOLAMD_ERROR_out_of_memory (-10)
109 #define CCOLAMD_ERROR_invalid_cmember (-11)
110 #define CCOLAMD_ERROR_internal_error (-999)
111 
112 /* ========================================================================== */
113 /* === Prototypes of user-callable routines ================================= */
114 /* ========================================================================== */
115 
116 /* define UF_long */
117 #include "amesos_UFconfig.h"
118 
119 size_t amesos_ccolamd_recommended /* returns recommended value of Alen, */
120  /* or 0 if input arguments are erroneous */
121 (
122  int nnz, /* nonzeros in A */
123  int n_row, /* number of rows in A */
124  int n_col /* number of columns in A */
125 ) ;
126 
127 size_t amesos_ccolamd_l_recommended /* returns recommended value of Alen, */
128  /* or 0 if input arguments are erroneous */
129 (
130  UF_long nnz, /* nonzeros in A */
131  UF_long n_row, /* number of rows in A */
132  UF_long n_col /* number of columns in A */
133 ) ;
134 
135 void amesos_ccolamd_set_defaults /* sets default parameters */
136 ( /* knobs argument is modified on output */
137  double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */
138 ) ;
139 
140 void amesos_ccolamd_l_set_defaults /* sets default parameters */
141 ( /* knobs argument is modified on output */
142  double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */
143 ) ;
144 
145 int amesos_ccolamd /* returns (1) if successful, (0) otherwise*/
146 ( /* A and p arguments are modified on output */
147  int n_row, /* number of rows in A */
148  int n_col, /* number of columns in A */
149  int Alen, /* size of the array A */
150  int A [ ], /* row indices of A, of size Alen */
151  int p [ ], /* column pointers of A, of size n_col+1 */
152  double knobs [CCOLAMD_KNOBS],/* parameter settings for ccolamd */
153  int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */
154  int cmember [ ] /* Constraint set of A, of size n_col */
155 ) ;
156 
157 UF_long amesos_ccolamd_l /* same as ccolamd, but with UF_long integers */
158 (
159  UF_long n_row,
160  UF_long n_col,
161  UF_long Alen,
162  UF_long A [ ],
163  UF_long p [ ],
164  double knobs [CCOLAMD_KNOBS],
165  UF_long stats [CCOLAMD_STATS],
166  UF_long cmember [ ]
167 ) ;
168 
169 int amesos_csymamd /* return (1) if OK, (0) otherwise */
170 (
171  int n, /* number of rows and columns of A */
172  int A [ ], /* row indices of A */
173  int p [ ], /* column pointers of A */
174  int perm [ ], /* output permutation, size n_col+1 */
175  double knobs [CCOLAMD_KNOBS],/* parameters (uses defaults if NULL) */
176  int stats [CCOLAMD_STATS], /* output statistics and error codes */
177  void * (*allocate) (size_t, size_t), /* pointer to calloc (ANSI C) or */
178  /* mxCalloc (for MATLAB mexFunction) */
179  void (*release) (void *), /* pointer to free (ANSI C) or */
180  /* mxFree (for MATLAB mexFunction) */
181  int cmember [ ], /* Constraint set of A */
182  int stype /* 0: use both parts, >0: upper, <0: lower */
183 ) ;
184 
185 UF_long amesos_csymamd_l /* same as csymamd, but with UF_long integers */
186 (
187  UF_long n,
188  UF_long A [ ],
189  UF_long p [ ],
190  UF_long perm [ ],
191  double knobs [CCOLAMD_KNOBS],
192  UF_long stats [CCOLAMD_STATS],
193  void * (*allocate) (size_t, size_t),
194  void (*release) (void *),
195  UF_long cmember [ ],
196  UF_long stype
197 ) ;
198 
200 (
201  int stats [CCOLAMD_STATS]
202 ) ;
203 
205 (
206  UF_long stats [CCOLAMD_STATS]
207 ) ;
208 
210 (
211  int stats [CCOLAMD_STATS]
212 ) ;
213 
215 (
216  UF_long stats [CCOLAMD_STATS]
217 ) ;
218 
219 
220 /* ========================================================================== */
221 /* === Prototypes of "expert" routines ====================================== */
222 /* ========================================================================== */
223 
224 /* These routines are meant to be used internally, or in a future version of
225  * UMFPACK. They appear here so that UMFPACK can use them, but they should not
226  * be called directly by the user.
227  */
228 
229 int amesos_ccolamd2
230 ( /* A and p arguments are modified on output */
231  int n_row, /* number of rows in A */
232  int n_col, /* number of columns in A */
233  int Alen, /* size of the array A */
234  int A [ ], /* row indices of A, of size Alen */
235  int p [ ], /* column pointers of A, of size n_col+1 */
236  double knobs [CCOLAMD_KNOBS],/* parameter settings for ccolamd */
237  int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */
238  /* each Front_ array is of size n_col+1: */
239  int Front_npivcol [ ], /* # pivot cols in each front */
240  int Front_nrows [ ], /* # of rows in each front (incl. pivot rows) */
241  int Front_ncols [ ], /* # of cols in each front (incl. pivot cols) */
242  int Front_parent [ ], /* parent of each front */
243  int Front_cols [ ], /* link list of pivot columns for each front */
244  int *p_nfr, /* total number of frontal matrices */
245  int InFront [ ], /* InFront [row] = f if row in front f */
246  int cmember [ ] /* Constraint set of A */
247 ) ;
248 
249 UF_long amesos_ccolamd2_l /* same as ccolamd2, but with UF_long integers */
250 (
251  UF_long n_row,
252  UF_long n_col,
253  UF_long Alen,
254  UF_long A [ ],
255  UF_long p [ ],
256  double knobs [CCOLAMD_KNOBS],
257  UF_long stats [CCOLAMD_STATS],
258  UF_long Front_npivcol [ ],
259  UF_long Front_nrows [ ],
260  UF_long Front_ncols [ ],
261  UF_long Front_parent [ ],
262  UF_long Front_cols [ ],
263  UF_long *p_nfr,
264  UF_long InFront [ ],
265  UF_long cmember [ ]
266 ) ;
267 
269 (
270  int Front [ ],
271  const int Order [ ],
272  int Temp [ ],
273  int nn,
274  int nfr
275 ) ;
276 
278 (
279  UF_long Front [ ],
280  const UF_long Order [ ],
281  UF_long Temp [ ],
282  UF_long nn,
283  UF_long nfr
284 ) ;
285 
286 
288 (
289  int nn,
290  int MaxFsize [ ],
291  int Fnrows [ ],
292  int Fncols [ ],
293  int Parent [ ],
294  int Npiv [ ]
295 ) ;
296 
298 (
299  UF_long nn,
300  UF_long MaxFsize [ ],
301  UF_long Fnrows [ ],
302  UF_long Fncols [ ],
303  UF_long Parent [ ],
304  UF_long Npiv [ ]
305 ) ;
306 
308 (
309  int nn,
310  int Parent [ ],
311  int Npiv [ ],
312  int Fsize [ ],
313  int Order [ ],
314  int Child [ ],
315  int Sibling [ ],
316  int Stack [ ],
317  int Front_cols [ ],
318  int cmember [ ]
319 ) ;
320 
322 (
323  UF_long nn,
324  UF_long Parent [ ],
325  UF_long Npiv [ ],
326  UF_long Fsize [ ],
327  UF_long Order [ ],
328  UF_long Child [ ],
329  UF_long Sibling [ ],
330  UF_long Stack [ ],
331  UF_long Front_cols [ ],
332  UF_long cmember [ ]
333 ) ;
334 
336 (
337  int root,
338  int k,
339  int Child [ ],
340  const int Sibling [ ],
341  int Order [ ],
342  int Stack [ ]
343 ) ;
344 
346 (
347  UF_long root,
348  UF_long k,
349  UF_long Child [ ],
350  const UF_long Sibling [ ],
351  UF_long Order [ ],
352  UF_long Stack [ ]
353 ) ;
354 
355 #ifndef EXTERN
356 #define EXTERN extern
357 #endif
358 
359 EXTERN int (*amesos_ccolamd_printf) (const char *, ...) ;
360 
361 #ifdef __cplusplus
362 }
363 #endif
364 
365 #endif
void amesos_ccolamd_l_report(UF_long stats[CCOLAMD_STATS])
void amesos_ccolamd_report(int stats[CCOLAMD_STATS])
void amesos_ccolamd_l_set_defaults(double knobs[CCOLAMD_KNOBS])
UF_long amesos_ccolamd_l_post_tree(UF_long root, UF_long k, UF_long Child[], const UF_long Sibling[], UF_long Order[], UF_long Stack[])
UF_long CHOLMOD() nnz(cholmod_sparse *A, cholmod_common *Common)
void amesos_ccolamd_l_fsize(UF_long nn, UF_long MaxFsize[], UF_long Fnrows[], UF_long Fncols[], UF_long Parent[], UF_long Npiv[])
UF_long amesos_ccolamd2_l(UF_long n_row, UF_long n_col, UF_long Alen, UF_long A[], UF_long p[], double knobs[CCOLAMD_KNOBS], UF_long stats[CCOLAMD_STATS], UF_long Front_npivcol[], UF_long Front_nrows[], UF_long Front_ncols[], UF_long Front_parent[], UF_long Front_cols[], UF_long *p_nfr, UF_long InFront[], UF_long cmember[])
void amesos_ccolamd_postorder(int nn, int Parent[], int Npiv[], int Fsize[], int Order[], int Child[], int Sibling[], int Stack[], int Front_cols[], int cmember[])
size_t amesos_ccolamd_recommended(int nnz, int n_row, int n_col)
size_t amesos_ccolamd_l_recommended(UF_long nnz, UF_long n_row, UF_long n_col)
UF_long amesos_csymamd_l(UF_long n, UF_long A[], UF_long p[], UF_long perm[], double knobs[CCOLAMD_KNOBS], UF_long stats[CCOLAMD_STATS], void *(*allocate)(size_t, size_t), void(*release)(void *), UF_long cmember[], UF_long stype)
void amesos_ccolamd_set_defaults(double knobs[CCOLAMD_KNOBS])
int amesos_ccolamd2(int n_row, int n_col, int Alen, int A[], int p[], double knobs[CCOLAMD_KNOBS], int stats[CCOLAMD_STATS], int Front_npivcol[], int Front_nrows[], int Front_ncols[], int Front_parent[], int Front_cols[], int *p_nfr, int InFront[], int cmember[])
#define CCOLAMD_KNOBS
void amesos_ccolamd_fsize(int nn, int MaxFsize[], int Fnrows[], int Fncols[], int Parent[], int Npiv[])
int amesos_csymamd(int n, int A[], int p[], int perm[], double knobs[CCOLAMD_KNOBS], int stats[CCOLAMD_STATS], void *(*allocate)(size_t, size_t), void(*release)(void *), int cmember[], int stype)
void amesos_ccolamd_l_apply_order(UF_long Front[], const UF_long Order[], UF_long Temp[], UF_long nn, UF_long nfr)
int amesos_ccolamd_post_tree(int root, int k, int Child[], const int Sibling[], int Order[], int Stack[])
EXTERN int(* amesos_ccolamd_printf)(const char *,...)
int amesos_ccolamd(int n_row, int n_col, int Alen, int A[], int p[], double knobs[CCOLAMD_KNOBS], int stats[CCOLAMD_STATS], int cmember[])
void amesos_csymamd_l_report(UF_long stats[CCOLAMD_STATS])
#define EXTERN
UF_long amesos_ccolamd_l(UF_long n_row, UF_long n_col, UF_long Alen, UF_long A[], UF_long p[], double knobs[CCOLAMD_KNOBS], UF_long stats[CCOLAMD_STATS], UF_long cmember[])
#define UF_long
int n
#define CCOLAMD_STATS
void amesos_ccolamd_l_postorder(UF_long nn, UF_long Parent[], UF_long Npiv[], UF_long Fsize[], UF_long Order[], UF_long Child[], UF_long Sibling[], UF_long Stack[], UF_long Front_cols[], UF_long cmember[])
void amesos_ccolamd_apply_order(int Front[], const int Order[], int Temp[], int nn, int nfr)
void amesos_csymamd_report(int stats[CCOLAMD_STATS])