Amesos Package Browser (Single Doxygen Collection) Development
amesos_ccolamd.h
Go to the documentation of this file.
00001 /* ========================================================================== */
00002 /* === CCOLAMD/ccolamd.h ==================================================== */
00003 /* ========================================================================== */
00004 
00005 /* ----------------------------------------------------------------------------
00006  * CCOLAMD Copyright (C), Univ. of Florida.  Authors: Timothy A. Davis,
00007  * Sivasankaran Rajamanickam, and Stefan Larimore
00008  * See License.txt for the Version 2.1 of the GNU Lesser General Public License
00009  * http://www.cise.ufl.edu/research/sparse
00010  * -------------------------------------------------------------------------- */
00011 
00012 /*
00013  *  You must include this file (ccolamd.h) in any routine that uses ccolamd,
00014  *  csymamd, or the related macros and definitions.
00015  */
00016 
00017 #ifndef AMESOS_CCOLAMD_H
00018 #define AMESOS_CCOLAMD_H
00019 
00020 /* make it easy for C++ programs to include CCOLAMD */
00021 #ifdef __cplusplus
00022 extern "C" {
00023 #endif
00024 
00025 /* for size_t definition: */
00026 #include <stdlib.h>
00027 
00028 /* ========================================================================== */
00029 /* === CCOLAMD version ====================================================== */
00030 /* ========================================================================== */
00031 
00032 /* All versions of CCOLAMD will include the following definitions.
00033  * As an example, to test if the version you are using is 1.3 or later:
00034  *
00035  *  if (CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)) ...
00036  *
00037  * This also works during compile-time:
00038  *
00039  *  #if CCOLAMD_VERSION >= CCOLAMD_VERSION_CODE (1,3)
00040  *      printf ("This is version 1.3 or later\n") ;
00041  *  #else
00042  *      printf ("This is an early version\n") ;
00043  *  #endif
00044  */
00045 
00046 #define CCOLAMD_DATE "May 31, 2007"
00047 #define CCOLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub))
00048 #define CCOLAMD_MAIN_VERSION 2
00049 #define CCOLAMD_SUB_VERSION 7
00050 #define CCOLAMD_SUBSUB_VERSION 0
00051 #define CCOLAMD_VERSION \
00052   CCOLAMD_VERSION_CODE(CCOLAMD_MAIN_VERSION,CCOLAMD_SUB_VERSION)
00053 
00054 /* ========================================================================== */
00055 /* === Knob and statistics definitions ====================================== */
00056 /* ========================================================================== */
00057 
00058 /* size of the knobs [ ] array.  Only knobs [0..3] are currently used. */
00059 #define CCOLAMD_KNOBS 20
00060 
00061 /* number of output statistics.  Only stats [0..10] are currently used. */
00062 #define CCOLAMD_STATS 20
00063 
00064 /* knobs [0] and stats [0]: dense row knob and output statistic. */
00065 #define CCOLAMD_DENSE_ROW 0
00066 
00067 /* knobs [1] and stats [1]: dense column knob and output statistic. */
00068 #define CCOLAMD_DENSE_COL 1
00069 
00070 /* knobs [2]: aggressive absorption option */
00071 #define CCOLAMD_AGGRESSIVE 2
00072 
00073 /* knobs [3]: LU or Cholesky factorization option */
00074 #define CCOLAMD_LU 3
00075 
00076 /* stats [2]: memory defragmentation count output statistic */
00077 #define CCOLAMD_DEFRAG_COUNT 2
00078 
00079 /* stats [3]: ccolamd status:  zero OK, > 0 warning or notice, < 0 error */
00080 #define CCOLAMD_STATUS 3
00081 
00082 /* stats [4..6]: error info, or info on jumbled columns */ 
00083 #define CCOLAMD_INFO1 4
00084 #define CCOLAMD_INFO2 5
00085 #define CCOLAMD_INFO3 6
00086 
00087 /* stats [7]: number of originally empty rows */
00088 #define CCOLAMD_EMPTY_ROW 7
00089 /* stats [8]: number of originally empty cols */
00090 #define CCOLAMD_EMPTY_COL 8
00091 /* stats [9]: number of rows with entries only in dense cols */
00092 #define CCOLAMD_NEWLY_EMPTY_ROW 9
00093 /* stats [10]: number of cols with entries only in dense rows */
00094 #define CCOLAMD_NEWLY_EMPTY_COL 10
00095 
00096 /* error codes returned in stats [3]: */
00097 #define CCOLAMD_OK        (0)
00098 #define CCOLAMD_OK_BUT_JUMBLED      (1)
00099 #define CCOLAMD_ERROR_A_not_present   (-1)
00100 #define CCOLAMD_ERROR_p_not_present   (-2)
00101 #define CCOLAMD_ERROR_nrow_negative   (-3)
00102 #define CCOLAMD_ERROR_ncol_negative   (-4)
00103 #define CCOLAMD_ERROR_nnz_negative    (-5)
00104 #define CCOLAMD_ERROR_p0_nonzero    (-6)
00105 #define CCOLAMD_ERROR_A_too_small   (-7)
00106 #define CCOLAMD_ERROR_col_length_negative (-8)
00107 #define CCOLAMD_ERROR_row_index_out_of_bounds (-9)
00108 #define CCOLAMD_ERROR_out_of_memory   (-10)
00109 #define CCOLAMD_ERROR_invalid_cmember   (-11)
00110 #define CCOLAMD_ERROR_internal_error    (-999)
00111 
00112 /* ========================================================================== */
00113 /* === Prototypes of user-callable routines ================================= */
00114 /* ========================================================================== */
00115 
00116 /* define UF_long */
00117 #include "amesos_UFconfig.h"
00118 
00119 size_t amesos_ccolamd_recommended /* returns recommended value of Alen, */
00120         /* or 0 if input arguments are erroneous */
00121 (
00122     int nnz,      /* nonzeros in A */
00123     int n_row,      /* number of rows in A */
00124     int n_col     /* number of columns in A */
00125 ) ;
00126 
00127 size_t amesos_ccolamd_l_recommended /* returns recommended value of Alen, */
00128         /* or 0 if input arguments are erroneous */
00129 (
00130     UF_long nnz,    /* nonzeros in A */
00131     UF_long n_row,    /* number of rows in A */
00132     UF_long n_col   /* number of columns in A */
00133 ) ;
00134 
00135 void amesos_ccolamd_set_defaults  /* sets default parameters */
00136 (       /* knobs argument is modified on output */
00137     double knobs [CCOLAMD_KNOBS]  /* parameter settings for ccolamd */
00138 ) ;
00139 
00140 void amesos_ccolamd_l_set_defaults  /* sets default parameters */
00141 (       /* knobs argument is modified on output */
00142     double knobs [CCOLAMD_KNOBS]  /* parameter settings for ccolamd */
00143 ) ;
00144 
00145 int amesos_ccolamd    /* returns (1) if successful, (0) otherwise*/
00146 (       /* A and p arguments are modified on output */
00147     int n_row,      /* number of rows in A */
00148     int n_col,      /* number of columns in A */
00149     int Alen,     /* size of the array A */
00150     int A [ ],      /* row indices of A, of size Alen */
00151     int p [ ],      /* column pointers of A, of size n_col+1 */
00152     double knobs [CCOLAMD_KNOBS],/* parameter settings for ccolamd */
00153     int stats [CCOLAMD_STATS],  /* ccolamd output statistics and error codes */
00154     int cmember [ ]   /* Constraint set of A, of size n_col */
00155 ) ;
00156 
00157 UF_long amesos_ccolamd_l  /* same as ccolamd, but with UF_long integers */
00158 (
00159     UF_long n_row,
00160     UF_long n_col,
00161     UF_long Alen,
00162     UF_long A [ ],
00163     UF_long p [ ],
00164     double knobs [CCOLAMD_KNOBS],
00165     UF_long stats [CCOLAMD_STATS],
00166     UF_long cmember [ ]
00167 ) ;
00168 
00169 int amesos_csymamd    /* return (1) if OK, (0) otherwise */
00170 (
00171     int n,      /* number of rows and columns of A */
00172     int A [ ],      /* row indices of A */
00173     int p [ ],      /* column pointers of A */
00174     int perm [ ],   /* output permutation, size n_col+1 */
00175     double knobs [CCOLAMD_KNOBS],/* parameters (uses defaults if NULL) */
00176     int stats [CCOLAMD_STATS],  /* output statistics and error codes */
00177     void * (*allocate) (size_t, size_t), /* pointer to calloc (ANSI C) or */
00178         /* mxCalloc (for MATLAB mexFunction) */
00179     void (*release) (void *), /* pointer to free (ANSI C) or */
00180             /* mxFree (for MATLAB mexFunction) */
00181     int cmember [ ],    /* Constraint set of A */
00182     int stype     /* 0: use both parts, >0: upper, <0: lower */
00183 ) ;
00184 
00185 UF_long amesos_csymamd_l    /* same as csymamd, but with UF_long integers */
00186 (
00187     UF_long n,
00188     UF_long A [ ],
00189     UF_long p [ ],
00190     UF_long perm [ ],
00191     double knobs [CCOLAMD_KNOBS],
00192     UF_long stats [CCOLAMD_STATS],
00193     void * (*allocate) (size_t, size_t),
00194     void (*release) (void *),
00195     UF_long cmember [ ],
00196     UF_long stype
00197 ) ;
00198 
00199 void amesos_ccolamd_report
00200 (
00201     int stats [CCOLAMD_STATS]
00202 ) ;
00203 
00204 void amesos_ccolamd_l_report
00205 (
00206     UF_long stats [CCOLAMD_STATS]
00207 ) ;
00208 
00209 void amesos_csymamd_report
00210 (
00211     int stats [CCOLAMD_STATS]
00212 ) ;
00213 
00214 void amesos_csymamd_l_report
00215 (
00216     UF_long stats [CCOLAMD_STATS]
00217 ) ;
00218 
00219 
00220 /* ========================================================================== */
00221 /* === Prototypes of "expert" routines ====================================== */
00222 /* ========================================================================== */
00223 
00224 /* These routines are meant to be used internally, or in a future version of
00225  * UMFPACK.  They appear here so that UMFPACK can use them, but they should not
00226  * be called directly by the user.
00227  */
00228 
00229 int amesos_ccolamd2
00230 (       /* A and p arguments are modified on output */
00231     int n_row,      /* number of rows in A */
00232     int n_col,      /* number of columns in A */
00233     int Alen,     /* size of the array A */
00234     int A [ ],      /* row indices of A, of size Alen */
00235     int p [ ],      /* column pointers of A, of size n_col+1 */
00236     double knobs [CCOLAMD_KNOBS],/* parameter settings for ccolamd */
00237     int stats [CCOLAMD_STATS],  /* ccolamd output statistics and error codes */
00238     /* each Front_ array is of size n_col+1: */
00239     int Front_npivcol [ ],  /* # pivot cols in each front */
00240     int Front_nrows [ ],  /* # of rows in each front (incl. pivot rows) */
00241     int Front_ncols [ ],  /* # of cols in each front (incl. pivot cols) */
00242     int Front_parent [ ], /* parent of each front */
00243     int Front_cols [ ],   /* link list of pivot columns for each front */
00244     int *p_nfr,     /* total number of frontal matrices */
00245     int InFront [ ],    /* InFront [row] = f if row in front f */
00246     int cmember [ ]   /* Constraint set of A */
00247 ) ;
00248 
00249 UF_long amesos_ccolamd2_l     /* same as ccolamd2, but with UF_long integers */
00250 (
00251     UF_long n_row,
00252     UF_long n_col,
00253     UF_long Alen,
00254     UF_long A [ ],
00255     UF_long p [ ],
00256     double knobs [CCOLAMD_KNOBS],
00257     UF_long stats [CCOLAMD_STATS],
00258     UF_long Front_npivcol [ ],
00259     UF_long Front_nrows [ ],
00260     UF_long Front_ncols [ ],
00261     UF_long Front_parent [ ],
00262     UF_long Front_cols [ ],
00263     UF_long *p_nfr,
00264     UF_long InFront [ ],
00265     UF_long cmember [ ]
00266 ) ;
00267 
00268 void amesos_ccolamd_apply_order
00269 (
00270     int Front [ ],
00271     const int Order [ ],
00272     int Temp [ ],
00273     int nn,
00274     int nfr
00275 ) ;
00276 
00277 void amesos_ccolamd_l_apply_order
00278 (
00279     UF_long Front [ ],
00280     const UF_long Order [ ],
00281     UF_long Temp [ ],
00282     UF_long nn,
00283     UF_long nfr
00284 ) ;
00285 
00286 
00287 void amesos_ccolamd_fsize
00288 (
00289     int nn,
00290     int MaxFsize [ ],
00291     int Fnrows [ ],
00292     int Fncols [ ],
00293     int Parent [ ],
00294     int Npiv [ ]
00295 ) ;
00296 
00297 void amesos_ccolamd_l_fsize
00298 (
00299     UF_long nn,
00300     UF_long MaxFsize [ ],
00301     UF_long Fnrows [ ],
00302     UF_long Fncols [ ],
00303     UF_long Parent [ ],
00304     UF_long Npiv [ ]
00305 ) ;
00306 
00307 void amesos_ccolamd_postorder
00308 (
00309     int nn,
00310     int Parent [ ],
00311     int Npiv [ ],
00312     int Fsize [ ],
00313     int Order [ ],
00314     int Child [ ],
00315     int Sibling [ ],
00316     int Stack [ ],
00317     int Front_cols [ ],
00318     int cmember [ ]
00319 ) ;
00320 
00321 void amesos_ccolamd_l_postorder
00322 (
00323     UF_long nn,
00324     UF_long Parent [ ],
00325     UF_long Npiv [ ],
00326     UF_long Fsize [ ],
00327     UF_long Order [ ],
00328     UF_long Child [ ],
00329     UF_long Sibling [ ],
00330     UF_long Stack [ ],
00331     UF_long Front_cols [ ],
00332     UF_long cmember [ ]
00333 ) ;
00334 
00335 int amesos_ccolamd_post_tree
00336 (
00337     int root,
00338     int k,
00339     int Child [ ],
00340     const int Sibling [ ],
00341     int Order [ ],
00342     int Stack [ ]
00343 ) ;
00344 
00345 UF_long amesos_ccolamd_l_post_tree
00346 (
00347     UF_long root,
00348     UF_long k,
00349     UF_long Child [ ],
00350     const UF_long Sibling [ ],
00351     UF_long Order [ ],
00352     UF_long Stack [ ]
00353 ) ;
00354 
00355 #ifndef EXTERN
00356 #define EXTERN extern
00357 #endif
00358 
00359 EXTERN int (*amesos_ccolamd_printf) (const char *, ...) ;
00360 
00361 #ifdef __cplusplus
00362 }
00363 #endif
00364 
00365 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines