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  * -------------------------------------------------------------------------- */
9 
10 /*
11  * You must include this file (ccolamd.h) in any routine that uses ccolamd,
12  * csymamd, or the related macros and definitions.
13  */
14 
15 #ifndef CCOLAMD_H
16 #define CCOLAMD_H
17 
18 /* make it easy for C++ programs to include CCOLAMD */
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /* for size_t definition: */
24 #include <stdlib.h>
25 
26 /* ========================================================================== */
27 /* === CCOLAMD version ====================================================== */
28 /* ========================================================================== */
29 
30 /* All versions of CCOLAMD will include the following definitions.
31  * As an example, to test if the version you are using is 1.3 or later:
32  *
33  * if (CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)) ...
34  *
35  * This also works during compile-time:
36  *
37  * #if CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)
38  * printf ("This is version 1.3 or later\n") ;
39  * #else
40  * printf ("This is an early version\n") ;
41  * #endif
42  */
43 
44 #define CCOLAMD_DATE "May 4, 2016"
45 #define CCOLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub))
46 #define CCOLAMD_MAIN_VERSION 2
47 #define CCOLAMD_SUB_VERSION 9
48 #define CCOLAMD_SUBSUB_VERSION 6
49 #define CCOLAMD_VERSION \
50  CCOLAMD_VERSION_CODE(CCOLAMD_MAIN_VERSION,CCOLAMD_SUB_VERSION)
51 
52 /* ========================================================================== */
53 /* === Knob and statistics definitions ====================================== */
54 /* ========================================================================== */
55 
56 /* size of the knobs [ ] array. Only knobs [0..3] are currently used. */
57 #define CCOLAMD_KNOBS 20
58 
59 /* number of output statistics. Only stats [0..10] are currently used. */
60 #define CCOLAMD_STATS 20
61 
62 /* knobs [0] and stats [0]: dense row knob and output statistic. */
63 #define CCOLAMD_DENSE_ROW 0
64 
65 /* knobs [1] and stats [1]: dense column knob and output statistic. */
66 #define CCOLAMD_DENSE_COL 1
67 
68 /* knobs [2]: aggressive absorption option */
69 #define CCOLAMD_AGGRESSIVE 2
70 
71 /* knobs [3]: LU or Cholesky factorization option */
72 #define CCOLAMD_LU 3
73 
74 /* stats [2]: memory defragmentation count output statistic */
75 #define CCOLAMD_DEFRAG_COUNT 2
76 
77 /* stats [3]: ccolamd status: zero OK, > 0 warning or notice, < 0 error */
78 #define CCOLAMD_STATUS 3
79 
80 /* stats [4..6]: error info, or info on jumbled columns */
81 #define CCOLAMD_INFO1 4
82 #define CCOLAMD_INFO2 5
83 #define CCOLAMD_INFO3 6
84 
85 /* stats [7]: number of originally empty rows */
86 #define CCOLAMD_EMPTY_ROW 7
87 /* stats [8]: number of originally empty cols */
88 #define CCOLAMD_EMPTY_COL 8
89 /* stats [9]: number of rows with entries only in dense cols */
90 #define CCOLAMD_NEWLY_EMPTY_ROW 9
91 /* stats [10]: number of cols with entries only in dense rows */
92 #define CCOLAMD_NEWLY_EMPTY_COL 10
93 
94 /* error codes returned in stats [3]: */
95 #define CCOLAMD_OK (0)
96 #define CCOLAMD_OK_BUT_JUMBLED (1)
97 #define CCOLAMD_ERROR_A_not_present (-1)
98 #define CCOLAMD_ERROR_p_not_present (-2)
99 #define CCOLAMD_ERROR_nrow_negative (-3)
100 #define CCOLAMD_ERROR_ncol_negative (-4)
101 #define CCOLAMD_ERROR_nnz_negative (-5)
102 #define CCOLAMD_ERROR_p0_nonzero (-6)
103 #define CCOLAMD_ERROR_A_too_small (-7)
104 #define CCOLAMD_ERROR_col_length_negative (-8)
105 #define CCOLAMD_ERROR_row_index_out_of_bounds (-9)
106 #define CCOLAMD_ERROR_out_of_memory (-10)
107 #define CCOLAMD_ERROR_invalid_cmember (-11)
108 #define CCOLAMD_ERROR_internal_error (-999)
109 
110 /* ========================================================================== */
111 /* === Prototypes of user-callable routines ================================= */
112 /* ========================================================================== */
113 
114 #include "SuiteSparse_config.h"
115 
116 size_t ccolamd_recommended /* returns recommended value of Alen, */
117  /* or 0 if input arguments are erroneous */
118 (
119  int nnz, /* nonzeros in A */
120  int n_row, /* number of rows in A */
121  int n_col /* number of columns in A */
122 ) ;
123 
124 size_t ccolamd_l_recommended /* returns recommended value of Alen, */
125  /* or 0 if input arguments are erroneous */
126 (
127  SuiteSparse_long nnz, /* nonzeros in A */
128  SuiteSparse_long n_row, /* number of rows in A */
129  SuiteSparse_long n_col /* number of columns in A */
130 ) ;
131 
132 void ccolamd_set_defaults /* sets default parameters */
133 ( /* knobs argument is modified on output */
134  double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */
135 ) ;
136 
137 void ccolamd_l_set_defaults /* sets default parameters */
138 ( /* knobs argument is modified on output */
139  double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */
140 ) ;
141 
142 int ccolamd /* returns (1) if successful, (0) otherwise*/
143 ( /* A and p arguments are modified on output */
144  int n_row, /* number of rows in A */
145  int n_col, /* number of columns in A */
146  int Alen, /* size of the array A */
147  int A [ ], /* row indices of A, of size Alen */
148  int p [ ], /* column pointers of A, of size n_col+1 */
149  double knobs [CCOLAMD_KNOBS],/* parameter settings for ccolamd */
150  int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */
151  int cmember [ ] /* Constraint set of A, of size n_col */
152 ) ;
153 
154 SuiteSparse_long ccolamd_l /* as ccolamd w/ SuiteSparse_long integers */
155 (
156  SuiteSparse_long n_row,
157  SuiteSparse_long n_col,
158  SuiteSparse_long Alen,
159  SuiteSparse_long A [ ],
160  SuiteSparse_long p [ ],
161  double knobs [CCOLAMD_KNOBS],
163  SuiteSparse_long cmember [ ]
164 ) ;
165 
166 int csymamd /* return (1) if OK, (0) otherwise */
167 (
168  int n, /* number of rows and columns of A */
169  int A [ ], /* row indices of A */
170  int p [ ], /* column pointers of A */
171  int perm [ ], /* output permutation, size n_col+1 */
172  double knobs [CCOLAMD_KNOBS],/* parameters (uses defaults if NULL) */
173  int stats [CCOLAMD_STATS], /* output statistics and error codes */
174  void * (*allocate) (size_t, size_t), /* pointer to calloc (ANSI C) or */
175  /* mxCalloc (for MATLAB mexFunction) */
176  void (*release) (void *), /* pointer to free (ANSI C) or */
177  /* mxFree (for MATLAB mexFunction) */
178  int cmember [ ], /* Constraint set of A */
179  int stype /* 0: use both parts, >0: upper, <0: lower */
180 ) ;
181 
182 SuiteSparse_long csymamd_l /* as csymamd, w/ SuiteSparse_long integers */
183 (
185  SuiteSparse_long A [ ],
186  SuiteSparse_long p [ ],
188  double knobs [CCOLAMD_KNOBS],
190  void * (*allocate) (size_t, size_t),
191  void (*release) (void *),
192  SuiteSparse_long cmember [ ],
193  SuiteSparse_long stype
194 ) ;
195 
196 void ccolamd_report
197 (
198  int stats [CCOLAMD_STATS]
199 ) ;
200 
201 void ccolamd_l_report
202 (
204 ) ;
205 
206 void csymamd_report
207 (
208  int stats [CCOLAMD_STATS]
209 ) ;
210 
211 void csymamd_l_report
212 (
214 ) ;
215 
216 
217 /* ========================================================================== */
218 /* === Prototypes of "expert" routines ====================================== */
219 /* ========================================================================== */
220 
221 /* These routines are meant to be used internally, or in a future version of
222  * UMFPACK. They appear here so that UMFPACK can use them, but they should not
223  * be called directly by the user.
224  */
225 
226 int ccolamd2
227 ( /* A and p arguments are modified on output */
228  int n_row, /* number of rows in A */
229  int n_col, /* number of columns in A */
230  int Alen, /* size of the array A */
231  int A [ ], /* row indices of A, of size Alen */
232  int p [ ], /* column pointers of A, of size n_col+1 */
233  double knobs [CCOLAMD_KNOBS],/* parameter settings for ccolamd */
234  int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */
235  /* each Front_ array is of size n_col+1: */
236  int Front_npivcol [ ], /* # pivot cols in each front */
237  int Front_nrows [ ], /* # of rows in each front (incl. pivot rows) */
238  int Front_ncols [ ], /* # of cols in each front (incl. pivot cols) */
239  int Front_parent [ ], /* parent of each front */
240  int Front_cols [ ], /* link list of pivot columns for each front */
241  int *p_nfr, /* total number of frontal matrices */
242  int InFront [ ], /* InFront [row] = f if row in front f */
243  int cmember [ ] /* Constraint set of A */
244 ) ;
245 
246 SuiteSparse_long ccolamd2_l /* as ccolamd2, w/ SuiteSparse_long integers */
247 (
248  SuiteSparse_long n_row,
249  SuiteSparse_long n_col,
250  SuiteSparse_long Alen,
251  SuiteSparse_long A [ ],
252  SuiteSparse_long p [ ],
253  double knobs [CCOLAMD_KNOBS],
255  SuiteSparse_long Front_npivcol [ ],
256  SuiteSparse_long Front_nrows [ ],
257  SuiteSparse_long Front_ncols [ ],
258  SuiteSparse_long Front_parent [ ],
259  SuiteSparse_long Front_cols [ ],
260  SuiteSparse_long *p_nfr,
261  SuiteSparse_long InFront [ ],
262  SuiteSparse_long cmember [ ]
263 ) ;
264 
266 (
267  int Front [ ],
268  const int Order [ ],
269  int Temp [ ],
270  int nn,
271  int nfr
272 ) ;
273 
275 (
276  SuiteSparse_long Front [ ],
277  const SuiteSparse_long Order [ ],
278  SuiteSparse_long Temp [ ],
280  SuiteSparse_long nfr
281 ) ;
282 
283 
284 void ccolamd_fsize
285 (
286  int nn,
287  int MaxFsize [ ],
288  int Fnrows [ ],
289  int Fncols [ ],
290  int Parent [ ],
291  int Npiv [ ]
292 ) ;
293 
294 void ccolamd_l_fsize
295 (
297  SuiteSparse_long MaxFsize [ ],
298  SuiteSparse_long Fnrows [ ],
299  SuiteSparse_long Fncols [ ],
300  SuiteSparse_long Parent [ ],
301  SuiteSparse_long Npiv [ ]
302 ) ;
303 
305 (
306  int nn,
307  int Parent [ ],
308  int Npiv [ ],
309  int Fsize [ ],
310  int Order [ ],
311  int Child [ ],
312  int Sibling [ ],
313  int Stack [ ],
314  int Front_cols [ ],
315  int cmember [ ]
316 ) ;
317 
319 (
321  SuiteSparse_long Parent [ ],
322  SuiteSparse_long Npiv [ ],
323  SuiteSparse_long Fsize [ ],
324  SuiteSparse_long Order [ ],
325  SuiteSparse_long Child [ ],
326  SuiteSparse_long Sibling [ ],
327  SuiteSparse_long Stack [ ],
328  SuiteSparse_long Front_cols [ ],
329  SuiteSparse_long cmember [ ]
330 ) ;
331 
333 (
334  int root,
335  int k,
336  int Child [ ],
337  const int Sibling [ ],
338  int Order [ ],
339  int Stack [ ]
340 ) ;
341 
343 (
344  SuiteSparse_long root,
346  SuiteSparse_long Child [ ],
347  const SuiteSparse_long Sibling [ ],
348  SuiteSparse_long Order [ ],
349  SuiteSparse_long Stack [ ]
350 ) ;
351 
352 #ifdef __cplusplus
353 }
354 #endif
355 
356 #endif
ccolamd_set_defaults
void ccolamd_set_defaults(double knobs[CCOLAMD_KNOBS])
ccolamd
int ccolamd(int n_row, int n_col, int Alen, int A[], int p[], double knobs[CCOLAMD_KNOBS], int stats[CCOLAMD_STATS], int cmember[])
perm
idx_t idx_t idx_t idx_t idx_t * perm
Definition: include/metis.h:223
ccolamd_l_set_defaults
void ccolamd_l_set_defaults(double knobs[CCOLAMD_KNOBS])
csymamd_report
void csymamd_report(int stats[CCOLAMD_STATS])
ccolamd_fsize
void ccolamd_fsize(int nn, int MaxFsize[], int Fnrows[], int Fncols[], int Parent[], int Npiv[])
ccolamd_l_report
void ccolamd_l_report(SuiteSparse_long stats[CCOLAMD_STATS])
ccolamd_report
void ccolamd_report(int stats[CCOLAMD_STATS])
ccolamd_postorder
void ccolamd_postorder(int nn, int Parent[], int Npiv[], int Fsize[], int Order[], int Child[], int Sibling[], int Stack[], int Front_cols[], int cmember[])
ccolamd_recommended
size_t ccolamd_recommended(int nnz, int n_row, int n_col)
ccolamd_l_apply_order
void ccolamd_l_apply_order(SuiteSparse_long Front[], const SuiteSparse_long Order[], SuiteSparse_long Temp[], SuiteSparse_long nn, SuiteSparse_long nfr)
csymamd
int 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)
ccolamd2_l
SuiteSparse_long ccolamd2_l(SuiteSparse_long n_row, SuiteSparse_long n_col, SuiteSparse_long Alen, SuiteSparse_long A[], SuiteSparse_long p[], double knobs[CCOLAMD_KNOBS], SuiteSparse_long stats[CCOLAMD_STATS], SuiteSparse_long Front_npivcol[], SuiteSparse_long Front_nrows[], SuiteSparse_long Front_ncols[], SuiteSparse_long Front_parent[], SuiteSparse_long Front_cols[], SuiteSparse_long *p_nfr, SuiteSparse_long InFront[], SuiteSparse_long cmember[])
n
int n
Definition: BiCGSTAB_simple.cpp:1
ccolamd_l
SuiteSparse_long ccolamd_l(SuiteSparse_long n_row, SuiteSparse_long n_col, SuiteSparse_long Alen, SuiteSparse_long A[], SuiteSparse_long p[], double knobs[CCOLAMD_KNOBS], SuiteSparse_long stats[CCOLAMD_STATS], SuiteSparse_long cmember[])
A
Definition: test_numpy_dtypes.cpp:298
conf.release
release
Definition: gtsam/3rdparty/GeographicLib/python/doc/conf.py:69
stats
bool stats
Definition: SolverComparer.cpp:100
ccolamd_post_tree
int ccolamd_post_tree(int root, int k, int Child[], const int Sibling[], int Order[], int Stack[])
ccolamd_l_post_tree
SuiteSparse_long ccolamd_l_post_tree(SuiteSparse_long root, SuiteSparse_long k, SuiteSparse_long Child[], const SuiteSparse_long Sibling[], SuiteSparse_long Order[], SuiteSparse_long Stack[])
ccolamd2
int 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[])
ccolamd_apply_order
void ccolamd_apply_order(int Front[], const int Order[], int Temp[], int nn, int nfr)
size_t
std::size_t size_t
Definition: wrap/pybind11/include/pybind11/detail/common.h:490
SuiteSparse_long
#define SuiteSparse_long
Definition: SuiteSparse_config.h:62
CCOLAMD_KNOBS
#define CCOLAMD_KNOBS
Definition: ccolamd.h:57
ccolamd_l_postorder
void ccolamd_l_postorder(SuiteSparse_long nn, SuiteSparse_long Parent[], SuiteSparse_long Npiv[], SuiteSparse_long Fsize[], SuiteSparse_long Order[], SuiteSparse_long Child[], SuiteSparse_long Sibling[], SuiteSparse_long Stack[], SuiteSparse_long Front_cols[], SuiteSparse_long cmember[])
CCOLAMD_STATS
#define CCOLAMD_STATS
Definition: ccolamd.h:60
ccolamd_l_recommended
size_t ccolamd_l_recommended(SuiteSparse_long nnz, SuiteSparse_long n_row, SuiteSparse_long n_col)
p
float * p
Definition: Tutorial_Map_using.cpp:9
ccolamd_l_fsize
void ccolamd_l_fsize(SuiteSparse_long nn, SuiteSparse_long MaxFsize[], SuiteSparse_long Fnrows[], SuiteSparse_long Fncols[], SuiteSparse_long Parent[], SuiteSparse_long Npiv[])
nn
idx_t * nn
Definition: include/metis.h:207
csymamd_l
SuiteSparse_long csymamd_l(SuiteSparse_long n, SuiteSparse_long A[], SuiteSparse_long p[], SuiteSparse_long perm[], double knobs[CCOLAMD_KNOBS], SuiteSparse_long stats[CCOLAMD_STATS], void *(*allocate)(size_t, size_t), void(*release)(void *), SuiteSparse_long cmember[], SuiteSparse_long stype)
csymamd_l_report
void csymamd_l_report(SuiteSparse_long stats[CCOLAMD_STATS])
SuiteSparse_config.h


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:14