SuperLU 6.0.1
colamd.h
Go to the documentation of this file.
1
12/* ========================================================================== */
13/* === colamd/symamd prototypes and definitions ============================= */
14/* ========================================================================== */
15
16/* COLAMD / SYMAMD include file
17
18 You must include this file (colamd.h) in any routine that uses colamd,
19 symamd, or the related macros and definitions.
20
21 Authors:
22
23 The authors of the code itself are Stefan I. Larimore and Timothy A.
24 Davis (DrTimothyAldenDavis@gmail.com). The algorithm was
25 developed in collaboration with John Gilbert, Xerox PARC, and Esmond
26 Ng, Oak Ridge National Laboratory.
27
28 Acknowledgements:
29
30 This work was supported by the National Science Foundation, under
31 grants DMS-9504974 and DMS-9803599.
32
33 Notice:
34
35 Copyright (c) 1998-2007, Timothy A. Davis, All Rights Reserved.
36
37 THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
38 EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
39
40 Permission is hereby granted to use, copy, modify, and/or distribute
41 this program, provided that the Copyright, this License, and the
42 Availability of the original version is retained on all copies and made
43 accessible to the end-user of any code or package that includes COLAMD
44 or any modified version of COLAMD.
45
46 Availability:
47
48 The colamd/symamd library is available at http://www.suitesparse.com
49 This file is required by the colamd.c, colamdmex.c, and symamdmex.c
50 files, and by any C code that calls the routines whose prototypes are
51 listed below, or that uses the colamd/symamd definitions listed below.
52
53*/
54
55#ifndef COLAMD_H
56#define COLAMD_H
57
58#include "superlu_config.h"
59
60/* make it easy for C++ programs to include COLAMD */
61#ifdef __cplusplus
62extern "C" {
63#endif
64
65#if defined ( _LONGINT )
66#define DLONG
67#endif
68
69
70/* ========================================================================== */
71/* === Include files ======================================================== */
72/* ========================================================================== */
73
74#include <stdlib.h>
75 /*#include <stdint.h>*/
76
77/* ========================================================================== */
78/* === COLAMD version ======================================================= */
79/* ========================================================================== */
80
81/* COLAMD Version 2.4 and later will include the following definitions.
82 * As an example, to test if the version you are using is 2.4 or later:
83 *
84 * #ifdef COLAMD_VERSION
85 * if (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) ...
86 * #endif
87 *
88 * This also works during compile-time:
89 *
90 * #if defined(COLAMD_VERSION) && (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4))
91 * printf ("This is version 2.4 or later\n") ;
92 * #else
93 * printf ("This is an early version\n") ;
94 * #endif
95 *
96 * Versions 2.3 and earlier of COLAMD do not include a #define'd version number.
97 */
98
99#define COLAMD_DATE "Oct 10, 2014"
100#define COLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub))
101#define COLAMD_MAIN_VERSION 2
102#define COLAMD_SUB_VERSION 9
103#define COLAMD_SUBSUB_VERSION 1
104#define COLAMD_VERSION \
105 COLAMD_VERSION_CODE(COLAMD_MAIN_VERSION,COLAMD_SUB_VERSION)
106
107/* ========================================================================== */
108/* === Knob and statistics definitions ====================================== */
109/* ========================================================================== */
110
111/* size of the knobs [ ] array. Only knobs [0..1] are currently used. */
112#define COLAMD_KNOBS 20
113
114/* number of output statistics. Only stats [0..6] are currently used. */
115#define COLAMD_STATS 20
116
117/* knobs [0] and stats [0]: dense row knob and output statistic. */
118#define COLAMD_DENSE_ROW 0
119
120/* knobs [1] and stats [1]: dense column knob and output statistic. */
121#define COLAMD_DENSE_COL 1
122
123/* knobs [2]: aggressive absorption */
124#define COLAMD_AGGRESSIVE 2
125
126/* stats [2]: memory defragmentation count output statistic */
127#define COLAMD_DEFRAG_COUNT 2
128
129/* stats [3]: colamd status: zero OK, > 0 warning or notice, < 0 error */
130#define COLAMD_STATUS 3
131
132/* stats [4..6]: error info, or info on jumbled columns */
133#define COLAMD_INFO1 4
134#define COLAMD_INFO2 5
135#define COLAMD_INFO3 6
136
137/* error codes returned in stats [3]: */
138#define COLAMD_OK (0)
139#define COLAMD_OK_BUT_JUMBLED (1)
140#define COLAMD_ERROR_A_not_present (-1)
141#define COLAMD_ERROR_p_not_present (-2)
142#define COLAMD_ERROR_nrow_negative (-3)
143#define COLAMD_ERROR_ncol_negative (-4)
144#define COLAMD_ERROR_nnz_negative (-5)
145#define COLAMD_ERROR_p0_nonzero (-6)
146#define COLAMD_ERROR_A_too_small (-7)
147#define COLAMD_ERROR_col_length_negative (-8)
148#define COLAMD_ERROR_row_index_out_of_bounds (-9)
149#define COLAMD_ERROR_out_of_memory (-10)
150#define COLAMD_ERROR_internal_error (-999)
151
152
153#define SUITESPARSE_PRINTF printf
154
155
156/* ========================================================================== */
157/* === Prototypes of user-callable routines ================================= */
158/* ========================================================================== */
159
160/*#include "SuiteSparse_config.h" */
161/**** The following is from SuiteSparse_config.h ****/
162#ifndef SuiteSparse_long
163
164#ifdef _WIN64
165
166#define SuiteSparse_long __int64
167#define SuiteSparse_long_max _I64_MAX
168#define SuiteSparse_long_idd "I64d"
169
170#else
171
172#if 0 /* commented out by Sherry */
173#define SuiteSparse_long long
174#define SuiteSparse_long_max LONG_MAX
175#define SuiteSparse_long_idd "ld"
176#endif
177
178#if 1
179#define SuiteSparse_long long long int
180#else
181#define SuiteSparse_long int64_t
182#endif
183#define SuiteSparse_long_max LONG_MAX
184#define SuiteSparse_long_idd "lld"
185
186#endif
187#define SuiteSparse_long_id "%" SuiteSparse_long_idd
188#endif
189/**** end from SuiteSparse_config.h ********/
190
191
192/* ========================================================================== */
193/* === int or SuiteSparse_long ============================================== */
194/* ========================================================================== */
195
196#ifdef DLONG
197
198#define Int SuiteSparse_long
199#define ID SuiteSparse_long_id
200#define Int_MAX SuiteSparse_long_max
201
202#define COLAMD_recommended colamd_l_recommended
203#define COLAMD_set_defaults colamd_l_set_defaults
204#define COLAMD_MAIN colamd_l
205#define SYMAMD_MAIN symamd_l
206#define COLAMD_report colamd_l_report
207#define SYMAMD_report symamd_l_report
208
209#else
210
211#define Int int
212#define ID "%d"
213#define Int_MAX INT_MAX
214
215#define COLAMD_recommended colamd_recommended
216#define COLAMD_set_defaults colamd_set_defaults
217#define COLAMD_MAIN colamd
218#define SYMAMD_MAIN symamd
219#define COLAMD_report colamd_report
220#define SYMAMD_report symamd_report
221
222#endif
223
224
225size_t colamd_recommended /* returns recommended value of Alen, */
226 /* or 0 if input arguments are erroneous */
227(
228 int nnz, /* nonzeros in A */
229 int n_row, /* number of rows in A */
230 int n_col /* number of columns in A */
231) ;
232
233size_t colamd_l_recommended /* returns recommended value of Alen, */
234 /* or 0 if input arguments are erroneous */
235(
236 SuiteSparse_long nnz, /* nonzeros in A */
237 SuiteSparse_long n_row, /* number of rows in A */
238 SuiteSparse_long n_col /* number of columns in A */
239) ;
240
241void colamd_set_defaults /* sets default parameters */
242( /* knobs argument is modified on output */
243 double knobs [COLAMD_KNOBS] /* parameter settings for colamd */
244) ;
245
246void colamd_l_set_defaults /* sets default parameters */
247( /* knobs argument is modified on output */
248 double knobs [COLAMD_KNOBS] /* parameter settings for colamd */
249) ;
250
251int colamd /* returns (1) if successful, (0) otherwise*/
252( /* A and p arguments are modified on output */
253 int n_row, /* number of rows in A */
254 int n_col, /* number of columns in A */
255 int Alen, /* size of the array A */
256 int A [], /* row indices of A, of size Alen */
257 int p [], /* column pointers of A, of size n_col+1 */
258 double knobs [COLAMD_KNOBS],/* parameter settings for colamd */
259 int stats [COLAMD_STATS] /* colamd output statistics and error codes */
260) ;
261
262SuiteSparse_long colamd_l /* returns (1) if successful, (0) otherwise*/
263( /* A and p arguments are modified on output */
264 SuiteSparse_long n_row, /* number of rows in A */
265 SuiteSparse_long n_col, /* number of columns in A */
266 SuiteSparse_long Alen, /* size of the array A */
267 SuiteSparse_long A [], /* row indices of A, of size Alen */
268 SuiteSparse_long p [], /* column pointers of A, of size n_col+1 */
269 double knobs [COLAMD_KNOBS],/* parameter settings for colamd */
270 SuiteSparse_long stats [COLAMD_STATS] /* colamd output statistics
271 * and error codes */
272) ;
273
274int symamd /* return (1) if OK, (0) otherwise */
275(
276 int n, /* number of rows and columns of A */
277 int A [], /* row indices of A */
278 int p [], /* column pointers of A */
279 int perm [], /* output permutation, size n_col+1 */
280 double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */
281 int stats [COLAMD_STATS], /* output statistics and error codes */
282 void * (*allocate) (size_t, size_t),
283 /* pointer to calloc (ANSI C) or */
284 /* mxCalloc (for MATLAB mexFunction) */
285 void (*release) (void *)
286 /* pointer to free (ANSI C) or */
287 /* mxFree (for MATLAB mexFunction) */
288) ;
289
290SuiteSparse_long symamd_l /* return (1) if OK, (0) otherwise */
291(
292 SuiteSparse_long n, /* number of rows and columns of A */
293 SuiteSparse_long A [], /* row indices of A */
294 SuiteSparse_long p [], /* column pointers of A */
295 SuiteSparse_long perm [], /* output permutation, size n_col+1 */
296 double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */
297 SuiteSparse_long stats [COLAMD_STATS], /* output stats and error codes */
298 void * (*allocate) (size_t, size_t),
299 /* pointer to calloc (ANSI C) or */
300 /* mxCalloc (for MATLAB mexFunction) */
301 void (*release) (void *)
302 /* pointer to free (ANSI C) or */
303 /* mxFree (for MATLAB mexFunction) */
304) ;
305
307(
308 int stats [COLAMD_STATS]
309) ;
310
312(
314) ;
315
317(
318 int stats [COLAMD_STATS]
319) ;
320
322(
324) ;
325
326#ifdef __cplusplus
327}
328#endif
329
330#endif /* COLAMD_H */
#define A(I, J)
void colamd_l_report(SuiteSparse_long stats[COLAMD_STATS])
#define COLAMD_STATS
Definition: colamd.h:115
#define SuiteSparse_long
Definition: colamd.h:179
void symamd_l_report(SuiteSparse_long stats[COLAMD_STATS])
SuiteSparse_long symamd_l(SuiteSparse_long n, SuiteSparse_long A[], SuiteSparse_long p[], SuiteSparse_long perm[], double knobs[COLAMD_KNOBS], SuiteSparse_long stats[COLAMD_STATS], void *(*allocate)(size_t, size_t), void(*release)(void *))
void colamd_report(int stats[COLAMD_STATS])
void symamd_report(int stats[COLAMD_STATS])
size_t colamd_l_recommended(SuiteSparse_long nnz, SuiteSparse_long n_row, SuiteSparse_long n_col)
SuiteSparse_long colamd_l(SuiteSparse_long n_row, SuiteSparse_long n_col, SuiteSparse_long Alen, SuiteSparse_long A[], SuiteSparse_long p[], double knobs[COLAMD_KNOBS], SuiteSparse_long stats[COLAMD_STATS])
size_t colamd_recommended(int nnz, int n_row, int n_col)
void colamd_l_set_defaults(double knobs[COLAMD_KNOBS])
int symamd(int n, int A[], int p[], int perm[], double knobs[COLAMD_KNOBS], int stats[COLAMD_STATS], void *(*allocate)(size_t, size_t), void(*release)(void *))
void colamd_set_defaults(double knobs[COLAMD_KNOBS])
#define COLAMD_KNOBS
Definition: colamd.h:112
int colamd(int n_row, int n_col, int Alen, int A[], int p[], double knobs[COLAMD_KNOBS], int stats[COLAMD_STATS])