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 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
|
//------------------------------------------------------------------------------
// CCOLAMD/Include/ccolamd.h: constrained column approx. min. degree ordering
//------------------------------------------------------------------------------
// CCOLAMD, Copyright (c) 1996-2024, Timothy A. Davis, Sivasankaran
// Rajamanickam, and Stefan Larimore. All Rights Reserved.
// SPDX-License-Identifier: BSD-3-clause
//------------------------------------------------------------------------------
/*
* You must include this file (ccolamd.h) in any routine that uses ccolamd,
* csymamd, or the related macros and definitions.
*/
#ifndef CCOLAMD_H
#define CCOLAMD_H
#include "SuiteSparse_config.h"
/* ========================================================================== */
/* === CCOLAMD version ====================================================== */
/* ========================================================================== */
/* All versions of CCOLAMD will include the following definitions.
* As an example, to test if the version you are using is 1.3 or later:
*
* if (CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)) ...
*
* This also works during compile-time:
*
* #if CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)
* printf ("This is version 1.3 or later\n") ;
* #else
* printf ("This is an early version\n") ;
* #endif
*/
#define CCOLAMD_DATE "June 20, 2024"
#define CCOLAMD_MAIN_VERSION 3
#define CCOLAMD_SUB_VERSION 3
#define CCOLAMD_SUBSUB_VERSION 4
#define CCOLAMD_VERSION_CODE(main,sub) SUITESPARSE_VER_CODE(main,sub)
#define CCOLAMD_VERSION CCOLAMD_VERSION_CODE(3,3)
#define CCOLAMD__VERSION SUITESPARSE__VERCODE(3,3,4)
#if !defined (SUITESPARSE__VERSION) || \
(SUITESPARSE__VERSION < SUITESPARSE__VERCODE(7,8,0))
#error "CCOLAMD 3.3.4 requires SuiteSparse_config 7.8.0 or later"
#endif
/* ========================================================================== */
/* === Knob and statistics definitions ====================================== */
/* ========================================================================== */
/* size of the knobs [ ] array. Only knobs [0..3] are currently used. */
#define CCOLAMD_KNOBS 20
/* number of output statistics. Only stats [0..10] are currently used. */
#define CCOLAMD_STATS 20
/* knobs [0] and stats [0]: dense row knob and output statistic. */
#define CCOLAMD_DENSE_ROW 0
/* knobs [1] and stats [1]: dense column knob and output statistic. */
#define CCOLAMD_DENSE_COL 1
/* knobs [2]: aggressive absorption option */
#define CCOLAMD_AGGRESSIVE 2
/* knobs [3]: LU or Cholesky factorization option */
#define CCOLAMD_LU 3
/* stats [2]: memory defragmentation count output statistic */
#define CCOLAMD_DEFRAG_COUNT 2
/* stats [3]: ccolamd status: zero OK, > 0 warning or notice, < 0 error */
#define CCOLAMD_STATUS 3
/* stats [4..6]: error info, or info on jumbled columns */
#define CCOLAMD_INFO1 4
#define CCOLAMD_INFO2 5
#define CCOLAMD_INFO3 6
/* stats [7]: number of originally empty rows */
#define CCOLAMD_EMPTY_ROW 7
/* stats [8]: number of originally empty cols */
#define CCOLAMD_EMPTY_COL 8
/* stats [9]: number of rows with entries only in dense cols */
#define CCOLAMD_NEWLY_EMPTY_ROW 9
/* stats [10]: number of cols with entries only in dense rows */
#define CCOLAMD_NEWLY_EMPTY_COL 10
/* error codes returned in stats [3]: */
#define CCOLAMD_OK (0)
#define CCOLAMD_OK_BUT_JUMBLED (1)
#define CCOLAMD_ERROR_A_not_present (-1)
#define CCOLAMD_ERROR_p_not_present (-2)
#define CCOLAMD_ERROR_nrow_negative (-3)
#define CCOLAMD_ERROR_ncol_negative (-4)
#define CCOLAMD_ERROR_nnz_negative (-5)
#define CCOLAMD_ERROR_p0_nonzero (-6)
#define CCOLAMD_ERROR_A_too_small (-7)
#define CCOLAMD_ERROR_col_length_negative (-8)
#define CCOLAMD_ERROR_row_index_out_of_bounds (-9)
#define CCOLAMD_ERROR_out_of_memory (-10)
#define CCOLAMD_ERROR_invalid_cmember (-11)
#define CCOLAMD_ERROR_internal_error (-999)
/* ========================================================================== */
/* === Prototypes of user-callable routines ================================= */
/* ========================================================================== */
/* make it easy for C++ programs to include CCOLAMD */
#ifdef __cplusplus
extern "C" {
#endif
size_t ccolamd_recommended /* returns recommended value of Alen, */
/* or 0 if input arguments are erroneous */
(
int nnz, /* nonzeros in A */
int n_row, /* number of rows in A */
int n_col /* number of columns in A */
) ;
size_t ccolamd_l_recommended /* returns recommended value of Alen, */
/* or 0 if input arguments are erroneous */
(
int64_t nnz, /* nonzeros in A */
int64_t n_row, /* number of rows in A */
int64_t n_col /* number of columns in A */
) ;
void ccolamd_set_defaults /* sets default parameters */
( /* knobs argument is modified on output */
double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */
) ;
void ccolamd_l_set_defaults /* sets default parameters */
( /* knobs argument is modified on output */
double knobs [CCOLAMD_KNOBS] /* parameter settings for ccolamd */
) ;
int ccolamd /* returns (1) if successful, (0) otherwise*/
( /* A and p arguments are modified on output */
int n_row, /* number of rows in A */
int n_col, /* number of columns in A */
int Alen, /* size of the array A */
int A [ ], /* row indices of A, of size Alen */
int p [ ], /* column pointers of A, of size n_col+1 */
double knobs [CCOLAMD_KNOBS],/* parameter settings for ccolamd */
int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */
int cmember [ ] /* Constraint set of A, of size n_col */
) ;
int ccolamd_l /* as ccolamd w/ int64_t integers */
(
int64_t n_row,
int64_t n_col,
int64_t Alen,
int64_t A [ ],
int64_t p [ ],
double knobs [CCOLAMD_KNOBS],
int64_t stats [CCOLAMD_STATS],
int64_t cmember [ ]
) ;
int csymamd /* return (1) if OK, (0) otherwise */
(
int n, /* number of rows and columns of A */
int A [ ], /* row indices of A */
int p [ ], /* column pointers of A */
int perm [ ], /* output permutation, size n_col+1 */
double knobs [CCOLAMD_KNOBS],/* parameters (uses defaults if NULL) */
int stats [CCOLAMD_STATS], /* output statistics and error codes */
void * (*allocate) (size_t, size_t), /* pointer to calloc (ANSI C) or */
/* mxCalloc (for MATLAB mexFunction) */
void (*release) (void *), /* pointer to free (ANSI C) or */
/* mxFree (for MATLAB mexFunction) */
int cmember [ ], /* Constraint set of A */
int stype /* 0: use both parts, >0: upper, <0: lower */
) ;
int csymamd_l /* as csymamd, w/ int64_t integers */
(
int64_t n,
int64_t A [ ],
int64_t p [ ],
int64_t perm [ ],
double knobs [CCOLAMD_KNOBS],
int64_t stats [CCOLAMD_STATS],
void * (*allocate) (size_t, size_t),
void (*release) (void *),
int64_t cmember [ ],
int64_t stype
) ;
void ccolamd_report
(
int stats [CCOLAMD_STATS]
) ;
void ccolamd_l_report
(
int64_t stats [CCOLAMD_STATS]
) ;
void csymamd_report
(
int stats [CCOLAMD_STATS]
) ;
void csymamd_l_report
(
int64_t stats [CCOLAMD_STATS]
) ;
void ccolamd_version (int version [3]) ;
/* ========================================================================== */
/* === Prototypes of "expert" routines ====================================== */
/* ========================================================================== */
/* These routines are meant to be used internally, or in a future version of
* UMFPACK. They appear here so that UMFPACK can use them, but they should not
* be called directly by the user.
*/
int ccolamd2
( /* A and p arguments are modified on output */
int n_row, /* number of rows in A */
int n_col, /* number of columns in A */
int Alen, /* size of the array A */
int A [ ], /* row indices of A, of size Alen */
int p [ ], /* column pointers of A, of size n_col+1 */
double knobs [CCOLAMD_KNOBS],/* parameter settings for ccolamd */
int stats [CCOLAMD_STATS], /* ccolamd output statistics and error codes */
/* each Front_ array is of size n_col+1: */
int Front_npivcol [ ], /* # pivot cols in each front */
int Front_nrows [ ], /* # of rows in each front (incl. pivot rows) */
int Front_ncols [ ], /* # of cols in each front (incl. pivot cols) */
int Front_parent [ ], /* parent of each front */
int Front_cols [ ], /* link list of pivot columns for each front */
int *p_nfr, /* total number of frontal matrices */
int InFront [ ], /* InFront [row] = f if row in front f */
int cmember [ ] /* Constraint set of A */
) ;
int ccolamd2_l /* as ccolamd2, w/ int64_t integers */
(
int64_t n_row,
int64_t n_col,
int64_t Alen,
int64_t A [ ],
int64_t p [ ],
double knobs [CCOLAMD_KNOBS],
int64_t stats [CCOLAMD_STATS],
int64_t Front_npivcol [ ],
int64_t Front_nrows [ ],
int64_t Front_ncols [ ],
int64_t Front_parent [ ],
int64_t Front_cols [ ],
int64_t *p_nfr,
int64_t InFront [ ],
int64_t cmember [ ]
) ;
void ccolamd_apply_order
(
int Front [ ],
const int Order [ ],
int Temp [ ],
int nn,
int nfr
) ;
void ccolamd_l_apply_order
(
int64_t Front [ ],
const int64_t Order [ ],
int64_t Temp [ ],
int64_t nn,
int64_t nfr
) ;
void ccolamd_fsize
(
int nn,
int MaxFsize [ ],
int Fnrows [ ],
int Fncols [ ],
int Parent [ ],
int Npiv [ ]
) ;
void ccolamd_l_fsize
(
int64_t nn,
int64_t MaxFsize [ ],
int64_t Fnrows [ ],
int64_t Fncols [ ],
int64_t Parent [ ],
int64_t Npiv [ ]
) ;
void ccolamd_postorder
(
int nn,
int Parent [ ],
int Npiv [ ],
int Fsize [ ],
int Order [ ],
int Child [ ],
int Sibling [ ],
int Stack [ ],
int Front_cols [ ],
int cmember [ ]
) ;
void ccolamd_l_postorder
(
int64_t nn,
int64_t Parent [ ],
int64_t Npiv [ ],
int64_t Fsize [ ],
int64_t Order [ ],
int64_t Child [ ],
int64_t Sibling [ ],
int64_t Stack [ ],
int64_t Front_cols [ ],
int64_t cmember [ ]
) ;
int ccolamd_post_tree
(
int root,
int k,
int Child [ ],
const int Sibling [ ],
int Order [ ],
int Stack [ ]
) ;
int64_t ccolamd_l_post_tree
(
int64_t root,
int64_t k,
int64_t Child [ ],
const int64_t Sibling [ ],
int64_t Order [ ],
int64_t Stack [ ]
) ;
#ifdef __cplusplus
}
#endif
#endif
|