Amesos Package Browser (Single Doxygen Collection) Development
amesos_colamd.h
Go to the documentation of this file.
00001 /* ========================================================================== */
00002 /* === colamd/symamd prototypes and definitions ============================= */
00003 /* ========================================================================== */
00004 
00005 /* COLAMD / SYMAMD include file
00006 
00007     You must include this file (colamd.h) in any routine that uses colamd,
00008     symamd, or the related macros and definitions.
00009 
00010     Authors:
00011 
00012   The authors of the code itself are Stefan I. Larimore and Timothy A.
00013   Davis (davis at cise.ufl.edu), University of Florida.  The algorithm was
00014   developed in collaboration with John Gilbert, Xerox PARC, and Esmond
00015   Ng, Oak Ridge National Laboratory.
00016 
00017     Acknowledgements:
00018 
00019   This work was supported by the National Science Foundation, under
00020   grants DMS-9504974 and DMS-9803599.
00021 
00022     Notice:
00023 
00024   Copyright (c) 1998-2007, Timothy A. Davis, All Rights Reserved.
00025 
00026   THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY
00027   EXPRESSED OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
00028 
00029   Permission is hereby granted to use, copy, modify, and/or distribute
00030   this program, provided that the Copyright, this License, and the
00031   Availability of the original version is retained on all copies and made
00032   accessible to the end-user of any code or package that includes COLAMD
00033   or any modified version of COLAMD. 
00034 
00035     Availability:
00036 
00037   The colamd/symamd library is available at
00038 
00039       http://www.cise.ufl.edu/research/sparse/colamd/
00040 
00041   This is the http://www.cise.ufl.edu/research/sparse/colamd/colamd.h
00042   file.  It is required by the colamd.c, colamdmex.c, and symamdmex.c
00043   files, and by any C code that calls the routines whose prototypes are
00044   listed below, or that uses the colamd/symamd definitions listed below.
00045 
00046 */
00047 
00048 #ifndef AMESOS_COLAMD_H
00049 #define AMESOS_COLAMD_H
00050 
00051 /* make it easy for C++ programs to include COLAMD */
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055 
00056 /* ========================================================================== */
00057 /* === Include files ======================================================== */
00058 /* ========================================================================== */
00059 
00060 #include <stdlib.h>
00061 
00062 /* ========================================================================== */
00063 /* === COLAMD version ======================================================= */
00064 /* ========================================================================== */
00065 
00066 /* COLAMD Version 2.4 and later will include the following definitions.
00067  * As an example, to test if the version you are using is 2.4 or later:
00068  *
00069  * #ifdef COLAMD_VERSION
00070  *  if (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) ...
00071  * #endif
00072  *
00073  * This also works during compile-time:
00074  *
00075  *  #if defined(COLAMD_VERSION) && (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4))
00076  *    printf ("This is version 2.4 or later\n") ;
00077  *  #else
00078  *    printf ("This is an early version\n") ;
00079  *  #endif
00080  *
00081  * Versions 2.3 and earlier of COLAMD do not include a #define'd version number.
00082  */
00083 
00084 #define COLAMD_DATE "May 31, 2007"
00085 #define COLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub))
00086 #define COLAMD_MAIN_VERSION 2
00087 #define COLAMD_SUB_VERSION 7
00088 #define COLAMD_SUBSUB_VERSION 0
00089 #define COLAMD_VERSION \
00090   COLAMD_VERSION_CODE(COLAMD_MAIN_VERSION,COLAMD_SUB_VERSION)
00091 
00092 /* ========================================================================== */
00093 /* === Knob and statistics definitions ====================================== */
00094 /* ========================================================================== */
00095 
00096 /* size of the knobs [ ] array.  Only knobs [0..1] are currently used. */
00097 #define COLAMD_KNOBS 20
00098 
00099 /* number of output statistics.  Only stats [0..6] are currently used. */
00100 #define COLAMD_STATS 20
00101 
00102 /* knobs [0] and stats [0]: dense row knob and output statistic. */
00103 #define COLAMD_DENSE_ROW 0
00104 
00105 /* knobs [1] and stats [1]: dense column knob and output statistic. */
00106 #define COLAMD_DENSE_COL 1
00107 
00108 /* knobs [2]: aggressive absorption */
00109 #define COLAMD_AGGRESSIVE 2
00110 
00111 /* stats [2]: memory defragmentation count output statistic */
00112 #define COLAMD_DEFRAG_COUNT 2
00113 
00114 /* stats [3]: colamd status:  zero OK, > 0 warning or notice, < 0 error */
00115 #define COLAMD_STATUS 3
00116 
00117 /* stats [4..6]: error info, or info on jumbled columns */ 
00118 #define COLAMD_INFO1 4
00119 #define COLAMD_INFO2 5
00120 #define COLAMD_INFO3 6
00121 
00122 /* error codes returned in stats [3]: */
00123 #define COLAMD_OK       (0)
00124 #define COLAMD_OK_BUT_JUMBLED     (1)
00125 #define COLAMD_ERROR_A_not_present    (-1)
00126 #define COLAMD_ERROR_p_not_present    (-2)
00127 #define COLAMD_ERROR_nrow_negative    (-3)
00128 #define COLAMD_ERROR_ncol_negative    (-4)
00129 #define COLAMD_ERROR_nnz_negative   (-5)
00130 #define COLAMD_ERROR_p0_nonzero     (-6)
00131 #define COLAMD_ERROR_A_too_small    (-7)
00132 #define COLAMD_ERROR_col_length_negative  (-8)
00133 #define COLAMD_ERROR_row_index_out_of_bounds  (-9)
00134 #define COLAMD_ERROR_out_of_memory    (-10)
00135 #define COLAMD_ERROR_internal_error   (-999)
00136 
00137 
00138 /* ========================================================================== */
00139 /* === Prototypes of user-callable routines ================================= */
00140 /* ========================================================================== */
00141 
00142 /* define UF_long */
00143 #include "amesos_UFconfig.h"
00144 
00145 size_t amesos_colamd_recommended  /* returns recommended value of Alen, */
00146         /* or 0 if input arguments are erroneous */
00147 (
00148     int nnz,      /* nonzeros in A */
00149     int n_row,      /* number of rows in A */
00150     int n_col     /* number of columns in A */
00151 ) ;
00152 
00153 size_t amesos_colamd_l_recommended  /* returns recommended value of Alen, */
00154         /* or 0 if input arguments are erroneous */
00155 (
00156     UF_long nnz,    /* nonzeros in A */
00157     UF_long n_row,    /* number of rows in A */
00158     UF_long n_col   /* number of columns in A */
00159 ) ;
00160 
00161 void amesos_colamd_set_defaults /* sets default parameters */
00162 (       /* knobs argument is modified on output */
00163     double knobs [COLAMD_KNOBS] /* parameter settings for colamd */
00164 ) ;
00165 
00166 void amesos_colamd_l_set_defaults /* sets default parameters */
00167 (       /* knobs argument is modified on output */
00168     double knobs [COLAMD_KNOBS] /* parameter settings for colamd */
00169 ) ;
00170 
00171 int amesos_colamd   /* returns (1) if successful, (0) otherwise*/
00172 (       /* A and p arguments are modified on output */
00173     int n_row,      /* number of rows in A */
00174     int n_col,      /* number of columns in A */
00175     int Alen,     /* size of the array A */
00176     int A [],     /* row indices of A, of size Alen */
00177     int p [],     /* column pointers of A, of size n_col+1 */
00178     double knobs [COLAMD_KNOBS],/* parameter settings for colamd */
00179     int stats [COLAMD_STATS]  /* colamd output statistics and error codes */
00180 ) ;
00181 
00182 UF_long amesos_colamd_l   /* returns (1) if successful, (0) otherwise*/
00183 (       /* A and p arguments are modified on output */
00184     UF_long n_row,    /* number of rows in A */
00185     UF_long n_col,    /* number of columns in A */
00186     UF_long Alen,   /* size of the array A */
00187     UF_long A [],   /* row indices of A, of size Alen */
00188     UF_long p [],   /* column pointers of A, of size n_col+1 */
00189     double knobs [COLAMD_KNOBS],/* parameter settings for colamd */
00190     UF_long stats [COLAMD_STATS]/* colamd output statistics and error codes */
00191 ) ;
00192 
00193 int amesos_symamd           /* return (1) if OK, (0) otherwise */
00194 (
00195     int n,        /* number of rows and columns of A */
00196     int A [],       /* row indices of A */
00197     int p [],       /* column pointers of A */
00198     int perm [],      /* output permutation, size n_col+1 */
00199     double knobs [COLAMD_KNOBS],  /* parameters (uses defaults if NULL) */
00200     int stats [COLAMD_STATS],   /* output statistics and error codes */
00201     void * (*allocate) (size_t, size_t),
00202               /* pointer to calloc (ANSI C) or */
00203           /* mxCalloc (for MATLAB mexFunction) */
00204     void (*release) (void *)
00205               /* pointer to free (ANSI C) or */
00206               /* mxFree (for MATLAB mexFunction) */
00207 ) ;
00208 
00209 UF_long amesos_symamd_l     /* return (1) if OK, (0) otherwise */
00210 (
00211     UF_long n,        /* number of rows and columns of A */
00212     UF_long A [],     /* row indices of A */
00213     UF_long p [],     /* column pointers of A */
00214     UF_long perm [],      /* output permutation, size n_col+1 */
00215     double knobs [COLAMD_KNOBS],  /* parameters (uses defaults if NULL) */
00216     UF_long stats [COLAMD_STATS], /* output statistics and error codes */
00217     void * (*allocate) (size_t, size_t),
00218               /* pointer to calloc (ANSI C) or */
00219           /* mxCalloc (for MATLAB mexFunction) */
00220     void (*release) (void *)
00221               /* pointer to free (ANSI C) or */
00222               /* mxFree (for MATLAB mexFunction) */
00223 ) ;
00224 
00225 void amesos_colamd_report
00226 (
00227     int stats [COLAMD_STATS]
00228 ) ;
00229 
00230 void amesos_colamd_l_report
00231 (
00232     UF_long stats [COLAMD_STATS]
00233 ) ;
00234 
00235 void amesos_symamd_report
00236 (
00237     int stats [COLAMD_STATS]
00238 ) ;
00239 
00240 void amesos_symamd_l_report
00241 (
00242     UF_long stats [COLAMD_STATS]
00243 ) ;
00244 
00245 #ifndef EXTERN
00246 #define EXTERN extern
00247 #endif
00248 
00249 EXTERN int (*amesos_colamd_printf) (const char *, ...) ;
00250 
00251 #ifdef __cplusplus
00252 }
00253 #endif
00254 
00255 #endif /* AMESOS_COLAMD_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines