00001 /* ========================================================================== */ 00002 /* === Include/cholmod_check.h ============================================== */ 00003 /* ========================================================================== */ 00004 00005 /* ----------------------------------------------------------------------------- 00006 * CHOLMOD/Include/cholmod_check.h. Copyright (C) 2005-2006, Timothy A. Davis 00007 * CHOLMOD/Include/cholmod_check.h is licensed under Version 2.1 of the GNU 00008 * Lesser General Public License. See lesser.txt for a text of the license. 00009 * CHOLMOD is also available under other licenses; contact authors for details. 00010 * http://www.cise.ufl.edu/research/sparse 00011 * -------------------------------------------------------------------------- */ 00012 00013 /* CHOLMOD Check module. 00014 * 00015 * Routines that check and print the 5 basic data types in CHOLMOD, and 3 kinds 00016 * of integer vectors (subset, perm, and parent), and read in matrices from a 00017 * file: 00018 * 00019 * cholmod_check_common check/print the Common object 00020 * cholmod_print_common 00021 * 00022 * cholmod_check_sparse check/print a sparse matrix in column-oriented form 00023 * cholmod_print_sparse 00024 * 00025 * cholmod_check_dense check/print a dense matrix 00026 * cholmod_print_dense 00027 * 00028 * cholmod_check_factor check/print a Cholesky factorization 00029 * cholmod_print_factor 00030 * 00031 * cholmod_check_triplet check/print a sparse matrix in triplet form 00032 * cholmod_print_triplet 00033 * 00034 * cholmod_check_subset check/print a subset (integer vector in given range) 00035 * cholmod_print_subset 00036 * 00037 * cholmod_check_perm check/print a permutation (an integer vector) 00038 * cholmod_print_perm 00039 * 00040 * cholmod_check_parent check/print an elimination tree (an integer vector) 00041 * cholmod_print_parent 00042 * 00043 * cholmod_read_triplet read a matrix in triplet form (any Matrix Market 00044 * "coordinate" format, or a generic triplet format). 00045 * 00046 * cholmod_read_sparse read a matrix in sparse form (same file format as 00047 * cholmod_read_triplet). 00048 * 00049 * cholmod_read_dense read a dense matrix (any Matrix Market "array" 00050 * format, or a generic dense format). 00051 * 00052 * cholmod_write_sparse write a sparse matrix to a Matrix Market file. 00053 * 00054 * cholmod_write_dense write a dense matrix to a Matrix Market file. 00055 * 00056 * cholmod_print_common and cholmod_check_common are the only two routines that 00057 * you may call after calling cholmod_finish. 00058 * 00059 * Requires the Core module. Not required by any CHOLMOD module, except when 00060 * debugging is enabled (in which case all modules require the Check module). 00061 * 00062 * See cholmod_read.c for a description of the file formats supported by the 00063 * cholmod_read_* routines. 00064 */ 00065 00066 #ifndef CHOLMOD_CHECK_H 00067 #define CHOLMOD_CHECK_H 00068 00069 #include "cholmod_core.h" 00070 #include <stdio.h> 00071 00072 /* -------------------------------------------------------------------------- */ 00073 /* cholmod_check_common: check the Common object */ 00074 /* -------------------------------------------------------------------------- */ 00075 00076 int cholmod_check_common 00077 ( 00078 cholmod_common *Common 00079 ) ; 00080 00081 int cholmod_l_check_common (cholmod_common *) ; 00082 00083 /* -------------------------------------------------------------------------- */ 00084 /* cholmod_print_common: print the Common object */ 00085 /* -------------------------------------------------------------------------- */ 00086 00087 int cholmod_print_common 00088 ( 00089 /* ---- input ---- */ 00090 const char *name, /* printed name of Common object */ 00091 /* --------------- */ 00092 cholmod_common *Common 00093 ) ; 00094 00095 int cholmod_l_print_common (const char *, cholmod_common *) ; 00096 00097 /* -------------------------------------------------------------------------- */ 00098 /* cholmod_check_sparse: check a sparse matrix */ 00099 /* -------------------------------------------------------------------------- */ 00100 00101 int cholmod_check_sparse 00102 ( 00103 /* ---- input ---- */ 00104 cholmod_sparse *A, /* sparse matrix to check */ 00105 /* --------------- */ 00106 cholmod_common *Common 00107 ) ; 00108 00109 int cholmod_l_check_sparse (cholmod_sparse *, cholmod_common *) ; 00110 00111 /* -------------------------------------------------------------------------- */ 00112 /* cholmod_print_sparse */ 00113 /* -------------------------------------------------------------------------- */ 00114 00115 int cholmod_print_sparse 00116 ( 00117 /* ---- input ---- */ 00118 cholmod_sparse *A, /* sparse matrix to print */ 00119 const char *name, /* printed name of sparse matrix */ 00120 /* --------------- */ 00121 cholmod_common *Common 00122 ) ; 00123 00124 int cholmod_l_print_sparse (cholmod_sparse *, const char *, cholmod_common *) ; 00125 00126 /* -------------------------------------------------------------------------- */ 00127 /* cholmod_check_dense: check a dense matrix */ 00128 /* -------------------------------------------------------------------------- */ 00129 00130 int cholmod_check_dense 00131 ( 00132 /* ---- input ---- */ 00133 cholmod_dense *X, /* dense matrix to check */ 00134 /* --------------- */ 00135 cholmod_common *Common 00136 ) ; 00137 00138 int cholmod_l_check_dense (cholmod_dense *, cholmod_common *) ; 00139 00140 /* -------------------------------------------------------------------------- */ 00141 /* cholmod_print_dense: print a dense matrix */ 00142 /* -------------------------------------------------------------------------- */ 00143 00144 int cholmod_print_dense 00145 ( 00146 /* ---- input ---- */ 00147 cholmod_dense *X, /* dense matrix to print */ 00148 const char *name, /* printed name of dense matrix */ 00149 /* --------------- */ 00150 cholmod_common *Common 00151 ) ; 00152 00153 int cholmod_l_print_dense (cholmod_dense *, const char *, cholmod_common *) ; 00154 00155 /* -------------------------------------------------------------------------- */ 00156 /* cholmod_check_factor: check a factor */ 00157 /* -------------------------------------------------------------------------- */ 00158 00159 int cholmod_check_factor 00160 ( 00161 /* ---- input ---- */ 00162 cholmod_factor *L, /* factor to check */ 00163 /* --------------- */ 00164 cholmod_common *Common 00165 ) ; 00166 00167 int cholmod_l_check_factor (cholmod_factor *, cholmod_common *) ; 00168 00169 /* -------------------------------------------------------------------------- */ 00170 /* cholmod_print_factor: print a factor */ 00171 /* -------------------------------------------------------------------------- */ 00172 00173 int cholmod_print_factor 00174 ( 00175 /* ---- input ---- */ 00176 cholmod_factor *L, /* factor to print */ 00177 const char *name, /* printed name of factor */ 00178 /* --------------- */ 00179 cholmod_common *Common 00180 ) ; 00181 00182 int cholmod_l_print_factor (cholmod_factor *, const char *, cholmod_common *) ; 00183 00184 /* -------------------------------------------------------------------------- */ 00185 /* cholmod_check_triplet: check a sparse matrix in triplet form */ 00186 /* -------------------------------------------------------------------------- */ 00187 00188 int cholmod_check_triplet 00189 ( 00190 /* ---- input ---- */ 00191 cholmod_triplet *T, /* triplet matrix to check */ 00192 /* --------------- */ 00193 cholmod_common *Common 00194 ) ; 00195 00196 int cholmod_l_check_triplet (cholmod_triplet *, cholmod_common *) ; 00197 00198 /* -------------------------------------------------------------------------- */ 00199 /* cholmod_print_triplet: print a triplet matrix */ 00200 /* -------------------------------------------------------------------------- */ 00201 00202 int cholmod_print_triplet 00203 ( 00204 /* ---- input ---- */ 00205 cholmod_triplet *T, /* triplet matrix to print */ 00206 const char *name, /* printed name of triplet matrix */ 00207 /* --------------- */ 00208 cholmod_common *Common 00209 ) ; 00210 00211 int cholmod_l_print_triplet (cholmod_triplet *, const char *, cholmod_common *); 00212 00213 /* -------------------------------------------------------------------------- */ 00214 /* cholmod_check_subset: check a subset */ 00215 /* -------------------------------------------------------------------------- */ 00216 00217 int cholmod_check_subset 00218 ( 00219 /* ---- input ---- */ 00220 int *Set, /* Set [0:len-1] is a subset of 0:n-1. Duplicates OK */ 00221 UF_long len, /* size of Set (an integer array) */ 00222 size_t n, /* 0:n-1 is valid range */ 00223 /* --------------- */ 00224 cholmod_common *Common 00225 ) ; 00226 00227 int cholmod_l_check_subset (UF_long *, UF_long, size_t, cholmod_common *) ; 00228 00229 /* -------------------------------------------------------------------------- */ 00230 /* cholmod_print_subset: print a subset */ 00231 /* -------------------------------------------------------------------------- */ 00232 00233 int cholmod_print_subset 00234 ( 00235 /* ---- input ---- */ 00236 int *Set, /* Set [0:len-1] is a subset of 0:n-1. Duplicates OK */ 00237 UF_long len, /* size of Set (an integer array) */ 00238 size_t n, /* 0:n-1 is valid range */ 00239 const char *name, /* printed name of Set */ 00240 /* --------------- */ 00241 cholmod_common *Common 00242 ) ; 00243 00244 int cholmod_l_print_subset (UF_long *, UF_long, size_t, const char *, 00245 cholmod_common *) ; 00246 00247 /* -------------------------------------------------------------------------- */ 00248 /* cholmod_check_perm: check a permutation */ 00249 /* -------------------------------------------------------------------------- */ 00250 00251 int cholmod_check_perm 00252 ( 00253 /* ---- input ---- */ 00254 int *Perm, /* Perm [0:len-1] is a permutation of subset of 0:n-1 */ 00255 size_t len, /* size of Perm (an integer array) */ 00256 size_t n, /* 0:n-1 is valid range */ 00257 /* --------------- */ 00258 cholmod_common *Common 00259 ) ; 00260 00261 int cholmod_l_check_perm (UF_long *, size_t, size_t, cholmod_common *) ; 00262 00263 /* -------------------------------------------------------------------------- */ 00264 /* cholmod_print_perm: print a permutation vector */ 00265 /* -------------------------------------------------------------------------- */ 00266 00267 int cholmod_print_perm 00268 ( 00269 /* ---- input ---- */ 00270 int *Perm, /* Perm [0:len-1] is a permutation of subset of 0:n-1 */ 00271 size_t len, /* size of Perm (an integer array) */ 00272 size_t n, /* 0:n-1 is valid range */ 00273 const char *name, /* printed name of Perm */ 00274 /* --------------- */ 00275 cholmod_common *Common 00276 ) ; 00277 00278 int cholmod_l_print_perm (UF_long *, size_t, size_t, const char *, 00279 cholmod_common *) ; 00280 00281 /* -------------------------------------------------------------------------- */ 00282 /* cholmod_check_parent: check an elimination tree */ 00283 /* -------------------------------------------------------------------------- */ 00284 00285 int cholmod_check_parent 00286 ( 00287 /* ---- input ---- */ 00288 int *Parent, /* Parent [0:n-1] is an elimination tree */ 00289 size_t n, /* size of Parent */ 00290 /* --------------- */ 00291 cholmod_common *Common 00292 ) ; 00293 00294 int cholmod_l_check_parent (UF_long *, size_t, cholmod_common *) ; 00295 00296 /* -------------------------------------------------------------------------- */ 00297 /* cholmod_print_parent */ 00298 /* -------------------------------------------------------------------------- */ 00299 00300 int cholmod_print_parent 00301 ( 00302 /* ---- input ---- */ 00303 int *Parent, /* Parent [0:n-1] is an elimination tree */ 00304 size_t n, /* size of Parent */ 00305 const char *name, /* printed name of Parent */ 00306 /* --------------- */ 00307 cholmod_common *Common 00308 ) ; 00309 00310 int cholmod_l_print_parent (UF_long *, size_t, const char *, cholmod_common *) ; 00311 00312 /* -------------------------------------------------------------------------- */ 00313 /* cholmod_read_sparse: read a sparse matrix from a file */ 00314 /* -------------------------------------------------------------------------- */ 00315 00316 cholmod_sparse *cholmod_read_sparse 00317 ( 00318 /* ---- input ---- */ 00319 FILE *f, /* file to read from, must already be open */ 00320 /* --------------- */ 00321 cholmod_common *Common 00322 ) ; 00323 00324 cholmod_sparse *cholmod_l_read_sparse (FILE *, cholmod_common *) ; 00325 00326 /* -------------------------------------------------------------------------- */ 00327 /* cholmod_read_triplet: read a triplet matrix from a file */ 00328 /* -------------------------------------------------------------------------- */ 00329 00330 cholmod_triplet *cholmod_read_triplet 00331 ( 00332 /* ---- input ---- */ 00333 FILE *f, /* file to read from, must already be open */ 00334 /* --------------- */ 00335 cholmod_common *Common 00336 ) ; 00337 00338 cholmod_triplet *cholmod_l_read_triplet (FILE *, cholmod_common *) ; 00339 00340 /* -------------------------------------------------------------------------- */ 00341 /* cholmod_read_dense: read a dense matrix from a file */ 00342 /* -------------------------------------------------------------------------- */ 00343 00344 cholmod_dense *cholmod_read_dense 00345 ( 00346 /* ---- input ---- */ 00347 FILE *f, /* file to read from, must already be open */ 00348 /* --------------- */ 00349 cholmod_common *Common 00350 ) ; 00351 00352 cholmod_dense *cholmod_l_read_dense (FILE *, cholmod_common *) ; 00353 00354 /* -------------------------------------------------------------------------- */ 00355 /* cholmod_read_matrix: read a sparse or dense matrix from a file */ 00356 /* -------------------------------------------------------------------------- */ 00357 00358 void *cholmod_read_matrix 00359 ( 00360 /* ---- input ---- */ 00361 FILE *f, /* file to read from, must already be open */ 00362 int prefer, /* If 0, a sparse matrix is always return as a 00363 * cholmod_triplet form. It can have any stype 00364 * (symmetric-lower, unsymmetric, or 00365 * symmetric-upper). 00366 * If 1, a sparse matrix is returned as an unsymmetric 00367 * cholmod_sparse form (A->stype == 0), with both 00368 * upper and lower triangular parts present. 00369 * This is what the MATLAB mread mexFunction does, 00370 * since MATLAB does not have an stype. 00371 * If 2, a sparse matrix is returned with an stype of 0 00372 * or 1 (unsymmetric, or symmetric with upper part 00373 * stored). 00374 * This argument has no effect for dense matrices. 00375 */ 00376 /* ---- output---- */ 00377 int *mtype, /* CHOLMOD_TRIPLET, CHOLMOD_SPARSE or CHOLMOD_DENSE */ 00378 /* --------------- */ 00379 cholmod_common *Common 00380 ) ; 00381 00382 void *cholmod_l_read_matrix (FILE *, int, int *, cholmod_common *) ; 00383 00384 /* -------------------------------------------------------------------------- */ 00385 /* cholmod_write_sparse: write a sparse matrix to a file */ 00386 /* -------------------------------------------------------------------------- */ 00387 00388 int cholmod_write_sparse 00389 ( 00390 /* ---- input ---- */ 00391 FILE *f, /* file to write to, must already be open */ 00392 cholmod_sparse *A, /* matrix to print */ 00393 cholmod_sparse *Z, /* optional matrix with pattern of explicit zeros */ 00394 const char *comments, /* optional filename of comments to include */ 00395 /* --------------- */ 00396 cholmod_common *Common 00397 ) ; 00398 00399 int cholmod_l_write_sparse (FILE *, cholmod_sparse *, cholmod_sparse *, 00400 const char *c, cholmod_common *) ; 00401 00402 /* -------------------------------------------------------------------------- */ 00403 /* cholmod_write_dense: write a dense matrix to a file */ 00404 /* -------------------------------------------------------------------------- */ 00405 00406 int cholmod_write_dense 00407 ( 00408 /* ---- input ---- */ 00409 FILE *f, /* file to write to, must already be open */ 00410 cholmod_dense *X, /* matrix to print */ 00411 const char *comments, /* optional filename of comments to include */ 00412 /* --------------- */ 00413 cholmod_common *Common 00414 ) ; 00415 00416 int cholmod_l_write_dense (FILE *, cholmod_dense *, const char *, 00417 cholmod_common *) ; 00418 #endif