Amesos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
amesos_colamd.h
Go to the documentation of this file.
1 /* ========================================================================== */
2 /* === colamd/symamd prototypes and definitions ============================= */
3 /* ========================================================================== */
4 
5 /* COLAMD / SYMAMD include file
6 
7  You must include this file (colamd.h) in any routine that uses colamd,
8  symamd, or the related macros and definitions.
9 
10  Authors:
11 
12  The authors of the code itself are Stefan I. Larimore and Timothy A.
13  Davis (davis at cise.ufl.edu), University of Florida. The algorithm was
14  developed in collaboration with John Gilbert, Xerox PARC, and Esmond
15  Ng, Oak Ridge National Laboratory.
16 
17  Acknowledgements:
18 
19  This work was supported by the National Science Foundation, under
20  grants DMS-9504974 and DMS-9803599.
21 
22  Notice:
23 
24  Copyright (c) 1998-2007, Timothy A. Davis, All Rights Reserved.
25 
26  THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
27  EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
28 
29  Permission is hereby granted to use, copy, modify, and/or distribute
30  this program, provided that the Copyright, this License, and the
31  Availability of the original version is retained on all copies and made
32  accessible to the end-user of any code or package that includes COLAMD
33  or any modified version of COLAMD.
34 
35  Availability:
36 
37  The colamd/symamd library is available at
38 
39  http://www.cise.ufl.edu/research/sparse/colamd/
40 
41  This is the http://www.cise.ufl.edu/research/sparse/colamd/colamd.h
42  file. It is required by the colamd.c, colamdmex.c, and symamdmex.c
43  files, and by any C code that calls the routines whose prototypes are
44  listed below, or that uses the colamd/symamd definitions listed below.
45 
46 */
47 
48 #ifndef AMESOS_COLAMD_H
49 #define AMESOS_COLAMD_H
50 
51 /* make it easy for C++ programs to include COLAMD */
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
56 /* ========================================================================== */
57 /* === Include files ======================================================== */
58 /* ========================================================================== */
59 
60 #include <stdlib.h>
61 
62 /* ========================================================================== */
63 /* === COLAMD version ======================================================= */
64 /* ========================================================================== */
65 
66 /* COLAMD Version 2.4 and later will include the following definitions.
67  * As an example, to test if the version you are using is 2.4 or later:
68  *
69  * #ifdef COLAMD_VERSION
70  * if (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) ...
71  * #endif
72  *
73  * This also works during compile-time:
74  *
75  * #if defined(COLAMD_VERSION) && (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4))
76  * printf ("This is version 2.4 or later\n") ;
77  * #else
78  * printf ("This is an early version\n") ;
79  * #endif
80  *
81  * Versions 2.3 and earlier of COLAMD do not include a #define'd version number.
82  */
83 
84 #define COLAMD_DATE "May 31, 2007"
85 #define COLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub))
86 #define COLAMD_MAIN_VERSION 2
87 #define COLAMD_SUB_VERSION 7
88 #define COLAMD_SUBSUB_VERSION 0
89 #define COLAMD_VERSION \
90  COLAMD_VERSION_CODE(COLAMD_MAIN_VERSION,COLAMD_SUB_VERSION)
91 
92 /* ========================================================================== */
93 /* === Knob and statistics definitions ====================================== */
94 /* ========================================================================== */
95 
96 /* size of the knobs [ ] array. Only knobs [0..1] are currently used. */
97 #define COLAMD_KNOBS 20
98 
99 /* number of output statistics. Only stats [0..6] are currently used. */
100 #define COLAMD_STATS 20
101 
102 /* knobs [0] and stats [0]: dense row knob and output statistic. */
103 #define COLAMD_DENSE_ROW 0
104 
105 /* knobs [1] and stats [1]: dense column knob and output statistic. */
106 #define COLAMD_DENSE_COL 1
107 
108 /* knobs [2]: aggressive absorption */
109 #define COLAMD_AGGRESSIVE 2
110 
111 /* stats [2]: memory defragmentation count output statistic */
112 #define COLAMD_DEFRAG_COUNT 2
113 
114 /* stats [3]: colamd status: zero OK, > 0 warning or notice, < 0 error */
115 #define COLAMD_STATUS 3
116 
117 /* stats [4..6]: error info, or info on jumbled columns */
118 #define COLAMD_INFO1 4
119 #define COLAMD_INFO2 5
120 #define COLAMD_INFO3 6
121 
122 /* error codes returned in stats [3]: */
123 #define COLAMD_OK (0)
124 #define COLAMD_OK_BUT_JUMBLED (1)
125 #define COLAMD_ERROR_A_not_present (-1)
126 #define COLAMD_ERROR_p_not_present (-2)
127 #define COLAMD_ERROR_nrow_negative (-3)
128 #define COLAMD_ERROR_ncol_negative (-4)
129 #define COLAMD_ERROR_nnz_negative (-5)
130 #define COLAMD_ERROR_p0_nonzero (-6)
131 #define COLAMD_ERROR_A_too_small (-7)
132 #define COLAMD_ERROR_col_length_negative (-8)
133 #define COLAMD_ERROR_row_index_out_of_bounds (-9)
134 #define COLAMD_ERROR_out_of_memory (-10)
135 #define COLAMD_ERROR_internal_error (-999)
136 
137 
138 /* ========================================================================== */
139 /* === Prototypes of user-callable routines ================================= */
140 /* ========================================================================== */
141 
142 /* define UF_long */
143 #include "amesos_UFconfig.h"
144 
145 size_t amesos_colamd_recommended /* returns recommended value of Alen, */
146  /* or 0 if input arguments are erroneous */
147 (
148  int nnz, /* nonzeros in A */
149  int n_row, /* number of rows in A */
150  int n_col /* number of columns in A */
151 ) ;
152 
153 size_t amesos_colamd_l_recommended /* returns recommended value of Alen, */
154  /* or 0 if input arguments are erroneous */
155 (
156  UF_long nnz, /* nonzeros in A */
157  UF_long n_row, /* number of rows in A */
158  UF_long n_col /* number of columns in A */
159 ) ;
160 
161 void amesos_colamd_set_defaults /* sets default parameters */
162 ( /* knobs argument is modified on output */
163  double knobs [COLAMD_KNOBS] /* parameter settings for colamd */
164 ) ;
165 
166 void amesos_colamd_l_set_defaults /* sets default parameters */
167 ( /* knobs argument is modified on output */
168  double knobs [COLAMD_KNOBS] /* parameter settings for colamd */
169 ) ;
170 
171 int amesos_colamd /* returns (1) if successful, (0) otherwise*/
172 ( /* A and p arguments are modified on output */
173  int n_row, /* number of rows in A */
174  int n_col, /* number of columns in A */
175  int Alen, /* size of the array A */
176  int A [], /* row indices of A, of size Alen */
177  int p [], /* column pointers of A, of size n_col+1 */
178  double knobs [COLAMD_KNOBS],/* parameter settings for colamd */
179  int stats [COLAMD_STATS] /* colamd output statistics and error codes */
180 ) ;
181 
182 UF_long amesos_colamd_l /* returns (1) if successful, (0) otherwise*/
183 ( /* A and p arguments are modified on output */
184  UF_long n_row, /* number of rows in A */
185  UF_long n_col, /* number of columns in A */
186  UF_long Alen, /* size of the array A */
187  UF_long A [], /* row indices of A, of size Alen */
188  UF_long p [], /* column pointers of A, of size n_col+1 */
189  double knobs [COLAMD_KNOBS],/* parameter settings for colamd */
190  UF_long stats [COLAMD_STATS]/* colamd output statistics and error codes */
191 ) ;
192 
193 int amesos_symamd /* return (1) if OK, (0) otherwise */
194 (
195  int n, /* number of rows and columns of A */
196  int A [], /* row indices of A */
197  int p [], /* column pointers of A */
198  int perm [], /* output permutation, size n_col+1 */
199  double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */
200  int stats [COLAMD_STATS], /* output statistics and error codes */
201  void * (*allocate) (size_t, size_t),
202  /* pointer to calloc (ANSI C) or */
203  /* mxCalloc (for MATLAB mexFunction) */
204  void (*release) (void *)
205  /* pointer to free (ANSI C) or */
206  /* mxFree (for MATLAB mexFunction) */
207 ) ;
208 
209 UF_long amesos_symamd_l /* return (1) if OK, (0) otherwise */
210 (
211  UF_long n, /* number of rows and columns of A */
212  UF_long A [], /* row indices of A */
213  UF_long p [], /* column pointers of A */
214  UF_long perm [], /* output permutation, size n_col+1 */
215  double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */
216  UF_long stats [COLAMD_STATS], /* output statistics and error codes */
217  void * (*allocate) (size_t, size_t),
218  /* pointer to calloc (ANSI C) or */
219  /* mxCalloc (for MATLAB mexFunction) */
220  void (*release) (void *)
221  /* pointer to free (ANSI C) or */
222  /* mxFree (for MATLAB mexFunction) */
223 ) ;
224 
226 (
227  int stats [COLAMD_STATS]
228 ) ;
229 
231 (
232  UF_long stats [COLAMD_STATS]
233 ) ;
234 
236 (
237  int stats [COLAMD_STATS]
238 ) ;
239 
241 (
242  UF_long stats [COLAMD_STATS]
243 ) ;
244 
245 #ifndef EXTERN
246 #define EXTERN extern
247 #endif
248 
249 EXTERN int (*amesos_colamd_printf) (const char *, ...) ;
250 
251 #ifdef __cplusplus
252 }
253 #endif
254 
255 #endif /* AMESOS_COLAMD_H */
UF_long CHOLMOD() nnz(cholmod_sparse *A, cholmod_common *Common)
#define EXTERN
#define COLAMD_KNOBS
Definition: amesos_colamd.h:97
void amesos_symamd_l_report(UF_long stats[COLAMD_STATS])
UF_long amesos_colamd_l(UF_long n_row, UF_long n_col, UF_long Alen, UF_long A[], UF_long p[], double knobs[COLAMD_KNOBS], UF_long stats[COLAMD_STATS])
void amesos_colamd_report(int stats[COLAMD_STATS])
void amesos_colamd_l_report(UF_long stats[COLAMD_STATS])
void amesos_symamd_report(int stats[COLAMD_STATS])
size_t amesos_colamd_l_recommended(UF_long nnz, UF_long n_row, UF_long n_col)
UF_long amesos_symamd_l(UF_long n, UF_long A[], UF_long p[], UF_long perm[], double knobs[COLAMD_KNOBS], UF_long stats[COLAMD_STATS], void *(*allocate)(size_t, size_t), void(*release)(void *))
#define COLAMD_STATS
EXTERN int(* amesos_colamd_printf)(const char *,...)
int amesos_colamd(int n_row, int n_col, int Alen, int A[], int p[], double knobs[COLAMD_KNOBS], int stats[COLAMD_STATS])
void amesos_colamd_l_set_defaults(double knobs[COLAMD_KNOBS])
size_t amesos_colamd_recommended(int nnz, int n_row, int n_col)
int amesos_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 *))
#define UF_long
int n
void amesos_colamd_set_defaults(double knobs[COLAMD_KNOBS])