Amesos Package Browser (Single Doxygen Collection) Development
amesos_klu_decl.h
Go to the documentation of this file.
00001 /* ========================================================================== */
00002 /* === klu include file ===================================================== */
00003 /* ========================================================================== */
00004 
00005 /* Include file for user programs that call klu_* routines */
00006 
00007 #ifndef AMESOS_KLU_DECL_H
00008 #define AMESOS_KLU_DECL_H
00009 
00010 /* make it easy for C++ programs to include KLU */
00011 #ifdef __cplusplus
00012 extern "C" {
00013 #endif
00014 
00015 #include "amesos_amd.h"
00016 #include "amesos_colamd.h"
00017 #include "amesos_btf_decl.h"
00018 
00019 /* -------------------------------------------------------------------------- */
00020 /* Symbolic object - contains the pre-ordering computed by klu_analyze */
00021 /* -------------------------------------------------------------------------- */
00022 
00023 typedef struct
00024 {
00025     /* A (P,Q) is in upper block triangular form.  The kth block goes from
00026      * row/col index R [k] to R [k+1]-1.  The estimated number of nonzeros
00027      * in the L factor of the kth block is Lnz [k]. 
00028      */
00029 
00030     /* only computed if the AMD ordering is chosen: */
00031     double symmetry ; /* symmetry of largest block */
00032     double est_flops ;  /* est. factorization flop count */
00033     double lnz, unz ; /* estimated nz in L and U, including diagonals */
00034     double *Lnz ; /* size n, but only Lnz [0..nblocks-1] is used */
00035 
00036     /* computed for all orderings: */
00037     int
00038   n,    /* input matrix A is n-by-n */
00039   nz,   /* # entries in input matrix */
00040   *P,     /* size n */
00041   *Q,   /* size n */
00042   *R,   /* size n+1, but only R [0..nblocks] is used */
00043   nzoff,    /* nz in off-diagonal blocks */
00044   nblocks,  /* number of blocks */
00045   maxblock, /* size of largest block */
00046   ordering, /* ordering used (AMD, COLAMD, or GIVEN) */
00047   do_btf ;  /* whether or not BTF preordering was requested */
00048 
00049     /* only computed if BTF preordering requested */
00050     int structural_rank ;   /* 0 to n-1 if the matrix is structurally rank
00051       * deficient.  -1 if not computed.  n if the matrix has
00052       * full structural rank */
00053 
00054 } klu_symbolic ;
00055 
00056 typedef struct    /* 64-bit version (otherwise same as above) */
00057 {
00058     double symmetry, est_flops, lnz, unz ;
00059     double *Lnz ;
00060     UF_long n, nz, *P, *Q, *R, nzoff, nblocks, maxblock, ordering, do_btf,
00061   structural_rank ;
00062 
00063 } klu_l_symbolic ;
00064 
00065 /* -------------------------------------------------------------------------- */
00066 /* Numeric object - contains the factors computed by klu_factor */
00067 /* -------------------------------------------------------------------------- */
00068 
00069 typedef struct
00070 {
00071     /* LU factors of each block, the pivot row permutation, and the
00072      * entries in the off-diagonal blocks */
00073 
00074     int n ;   /* A is n-by-n */
00075     int nblocks ; /* number of diagonal blocks */
00076     int lnz ;   /* actual nz in L, including diagonal */
00077     int unz ;   /* actual nz in U, including diagonal */
00078     int max_lnz_block ; /* max actual nz in L in any one block, incl. diag */
00079     int max_unz_block ; /* max actual nz in U in any one block, incl. diag */
00080     int *Pnum ;   /* size n. final pivot permutation */
00081     int *Pinv ;   /* size n. inverse of final pivot permutation */
00082 
00083     /* LU factors of each block */
00084     int *Lip ;    /* size n. pointers into LUbx[block] for L */
00085     int *Uip ;    /* size n. pointers into LUbx[block] for U */
00086     int *Llen ;   /* size n. Llen [k] = # of entries in kth column of L */
00087     int *Ulen ;   /* size n. Ulen [k] = # of entries in kth column of U */
00088     void **LUbx ; /* L and U indices and entries (excl. diagonal of U) */
00089     size_t *LUsize ;  /* size of each LUbx [block], in sizeof (Unit) */
00090     void *Udiag ; /* diagonal of U */
00091 
00092     /* scale factors; can be NULL if no scaling */
00093     double *Rs ;  /* size n. Rs [i] is scale factor for row i */
00094 
00095     /* permanent workspace for factorization and solve */
00096     size_t worksize ; /* size (in bytes) of Work */
00097     void *Work ;  /* workspace */
00098     void *Xwork ; /* alias into Numeric->Work */
00099     int *Iwork ;  /* alias into Numeric->Work */
00100 
00101     /* off-diagonal entries in a conventional compressed-column sparse matrix */
00102     int *Offp ;   /* size n+1, column pointers */
00103     int *Offi ;   /* size nzoff, row indices */
00104     void *Offx ;  /* size nzoff, numerical values */
00105     int nzoff ;
00106 
00107 } klu_numeric ;
00108 
00109 typedef struct    /* 64-bit version (otherwise same as above) */
00110 {
00111     UF_long n, nblocks, lnz, unz, max_lnz_block, max_unz_block, *Pnum, *Pinv,
00112   *Lip, *Uip, *Llen, *Ulen ;
00113     void **LUbx ;
00114     size_t *LUsize ;
00115     void *Udiag ;
00116     double *Rs ;
00117     size_t worksize ;
00118     void *Work, *Xwork ;
00119     UF_long *Iwork ;
00120     UF_long *Offp, *Offi ;
00121     void *Offx ;
00122     UF_long nzoff ;
00123 
00124 } klu_l_numeric ;
00125 
00126 /* -------------------------------------------------------------------------- */
00127 /* KLU control parameters and statistics */
00128 /* -------------------------------------------------------------------------- */
00129 
00130 /* Common->status values */
00131 #define KLU_OK 0
00132 #define KLU_SINGULAR (1)      /* status > 0 is a warning, not an error */
00133 #define KLU_OUT_OF_MEMORY (-2)
00134 #define KLU_INVALID (-3)
00135 #define KLU_TOO_LARGE (-4)      /* integer overflow has occured */
00136 
00137 typedef struct klu_common_struct
00138 {
00139 
00140     /* ---------------------------------------------------------------------- */
00141     /* parameters */
00142     /* ---------------------------------------------------------------------- */
00143 
00144     double tol ;      /* pivot tolerance for diagonal preference */
00145     double memgrow ;      /* realloc memory growth size for LU factors */
00146     double initmem_amd ;    /* init. memory size with AMD: c*nnz(L) + n */
00147     double initmem ;      /* init. memory size: c*nnz(A) + n */
00148     double maxwork ;      /* maxwork for BTF, <= 0 if no limit */
00149 
00150     int btf ;       /* use BTF pre-ordering, or not */
00151     int ordering ;      /* 0: AMD, 1: COLAMD, 2: user P and Q,
00152            * 3: user function */
00153     int scale ;       /* row scaling: -1: none (and no error check),
00154            * 0: none, 1: sum, 2: max */
00155 
00156     /* memory management routines */
00157     void *(*malloc_memory) (size_t) ;   /* pointer to malloc */
00158     void *(*realloc_memory) (void *, size_t) ;  /* pointer to realloc */
00159     void (*free_memory) (void *) ;    /* pointer to free */
00160     void *(*calloc_memory) (size_t, size_t) ; /* pointer to calloc */
00161 
00162     /* pointer to user ordering function */
00163     int (*user_order) (int, int *, int *, int *, struct klu_common_struct *) ;
00164 
00165     /* pointer to user data, passed unchanged as the last parameter to the
00166      * user ordering function (optional, the user function need not use this
00167      * information). */
00168     void *user_data ;
00169 
00170     int halt_if_singular ;  /* how to handle a singular matrix:
00171   * FALSE: keep going.  Return a Numeric object with a zero U(k,k).  A
00172   *   divide-by-zero may occur when computing L(:,k).  The Numeric object
00173   *   can be passed to klu_solve (a divide-by-zero will occur).  It can
00174   *   also be safely passed to klu_refactor.
00175   * TRUE: stop quickly.  klu_factor will free the partially-constructed
00176   *   Numeric object.  klu_refactor will not free it, but will leave the
00177   *   numerical values only partially defined.  This is the default. */
00178 
00179     /* ---------------------------------------------------------------------- */
00180     /* statistics */
00181     /* ---------------------------------------------------------------------- */
00182 
00183     int status ;          /* KLU_OK if OK, < 0 if error */
00184     int nrealloc ;    /* # of reallocations of L and U */
00185 
00186     int structural_rank ; /* 0 to n-1 if the matrix is structurally rank
00187   * deficient (as determined by maxtrans).  -1 if not computed.  n if the
00188   * matrix has full structural rank.  This is computed by klu_analyze
00189   * if a BTF preordering is requested. */
00190 
00191     int numerical_rank ;  /* First k for which a zero U(k,k) was found,
00192   * if the matrix was singular (in the range 0 to n-1).  n if the matrix
00193   * has full rank. This is not a true rank-estimation.  It just reports
00194   * where the first zero pivot was found.  -1 if not computed.
00195   * Computed by klu_factor and klu_refactor. */
00196 
00197     int singular_col ;    /* n if the matrix is not singular.  If in the
00198   * range 0 to n-1, this is the column index of the original matrix A that
00199   * corresponds to the column of U that contains a zero diagonal entry.
00200   * -1 if not computed.  Computed by klu_factor and klu_refactor. */
00201 
00202     int noffdiag ;  /* # of off-diagonal pivots, -1 if not computed */
00203 
00204     double flops ;  /* actual factorization flop count, from klu_flops */
00205     double rcond ;  /* crude reciprocal condition est., from klu_rcond */
00206     double condest ;  /* accurate condition est., from klu_condest */
00207     double rgrowth ;  /* reciprocal pivot rgrowth, from klu_rgrowth */
00208     double work ; /* actual work done in BTF, in klu_analyze */
00209 
00210     size_t memusage ; /* current memory usage, in bytes */
00211     size_t mempeak ;  /* peak memory usage, in bytes */
00212 
00213 } klu_common ;
00214 
00215 typedef struct klu_l_common_struct /* 64-bit version (otherwise same as above)*/
00216 {
00217 
00218     double tol, memgrow, initmem_amd, initmem, maxwork ;
00219     UF_long btf, ordering, scale ;
00220     void *(*malloc_memory) (size_t) ;
00221     void *(*realloc_memory) (void *, size_t) ;
00222     void (*free_memory) (void *) ;
00223     void *(*calloc_memory) (size_t, size_t) ;
00224     UF_long (*user_order) (UF_long, UF_long *, UF_long *, UF_long *,
00225   struct klu_l_common_struct *) ;
00226     void *user_data ;
00227     UF_long halt_if_singular ;
00228     UF_long status, nrealloc, structural_rank, numerical_rank, singular_col,
00229   noffdiag ;
00230     double flops, rcond, condest, rgrowth, work ;
00231     size_t memusage, mempeak ;
00232 
00233 } klu_l_common ;
00234 
00235 /* -------------------------------------------------------------------------- */
00236 /* klu_defaults: sets default control parameters */
00237 /* -------------------------------------------------------------------------- */
00238 
00239 int amesos_klu_defaults
00240 (
00241     klu_common *Common
00242 ) ;
00243 
00244 UF_long amesos_klu_l_defaults (klu_l_common *Common) ;
00245 
00246 /* -------------------------------------------------------------------------- */
00247 /* klu_analyze:  orders and analyzes a matrix */
00248 /* -------------------------------------------------------------------------- */
00249 
00250 /* Order the matrix with BTF (or not), then order each block with AMD, COLAMD,
00251  * a natural ordering, or with a user-provided ordering function */
00252 
00253 klu_symbolic *amesos_klu_analyze
00254 (
00255     /* inputs, not modified */
00256     int n,    /* A is n-by-n */
00257     int Ap [ ],   /* size n+1, column pointers */
00258     int Ai [ ],   /* size nz, row indices */
00259     klu_common *Common
00260 ) ;
00261 
00262 klu_l_symbolic *amesos_klu_l_analyze (UF_long, UF_long *, UF_long *,
00263     klu_l_common *Common) ;
00264 
00265 
00266 /* -------------------------------------------------------------------------- */
00267 /* klu_analyze_given: analyzes a matrix using given P and Q */
00268 /* -------------------------------------------------------------------------- */
00269 
00270 /* Order the matrix with BTF (or not), then use natural or given ordering
00271  * P and Q on the blocks.  P and Q are interpretted as identity
00272  * if NULL. */
00273 
00274 klu_symbolic *amesos_klu_analyze_given
00275 (
00276     /* inputs, not modified */
00277     int n,    /* A is n-by-n */
00278     int Ap [ ],   /* size n+1, column pointers */
00279     int Ai [ ],   /* size nz, row indices */
00280     int P [ ],    /* size n, user's row permutation (may be NULL) */
00281     int Q [ ],    /* size n, user's column permutation (may be NULL) */
00282     klu_common *Common
00283 ) ;
00284 
00285 klu_l_symbolic *amesos_klu_l_analyze_given (UF_long, UF_long *, UF_long *, UF_long *,
00286     UF_long *, klu_l_common *) ;
00287 
00288 
00289 /* -------------------------------------------------------------------------- */
00290 /* klu_factor:  factors a matrix using the klu_analyze results */
00291 /* -------------------------------------------------------------------------- */
00292 
00293 klu_numeric *amesos_klu_factor  /* returns KLU_OK if OK, < 0 if error */
00294 (
00295     /* inputs, not modified */
00296     int Ap [ ],   /* size n+1, column pointers */
00297     int Ai [ ],   /* size nz, row indices */
00298     double Ax [ ],  /* size nz, numerical values */
00299     klu_symbolic *Symbolic,
00300     klu_common *Common
00301 ) ;
00302 
00303 klu_numeric *amesos_klu_z_factor      /* returns KLU_OK if OK, < 0 if error */
00304 (
00305      /* inputs, not modified */
00306      int Ap [ ],        /* size n+1, column pointers */
00307      int Ai [ ],        /* size nz, row indices */
00308      double Ax [ ], /* size 2*nz, numerical values (real,imag pairs) */
00309      klu_symbolic *Symbolic,
00310      klu_common *Common
00311 ) ;
00312 
00313 /* long / real version */
00314 klu_l_numeric *amesos_klu_l_factor (UF_long *, UF_long *, double *, klu_l_symbolic *,
00315     klu_l_common *) ;
00316 
00317 /* long / complex version */
00318 klu_l_numeric *amesos_klu_zl_factor (UF_long *, UF_long *, double *, klu_l_symbolic *,
00319     klu_l_common *) ;
00320 
00321 
00322 /* -------------------------------------------------------------------------- */
00323 /* klu_solve: solves Ax=b using the Symbolic and Numeric objects */
00324 /* -------------------------------------------------------------------------- */
00325 
00326 int amesos_klu_solve
00327 (
00328     /* inputs, not modified */
00329     klu_symbolic *Symbolic,
00330     klu_numeric *Numeric,
00331     int ldim,       /* leading dimension of B */
00332     int nrhs,       /* number of right-hand-sides */
00333 
00334     /* right-hand-side on input, overwritten with solution to Ax=b on output */
00335     double B [ ],     /* size ldim*nrhs */
00336     klu_common *Common
00337 ) ;
00338 
00339 int amesos_klu_z_solve
00340 (
00341      /* inputs, not modified */
00342      klu_symbolic *Symbolic,
00343      klu_numeric *Numeric,
00344      int ldim,               /* leading dimension of B */
00345      int nrhs,               /* number of right-hand-sides */
00346 
00347      /* right-hand-side on input, overwritten with solution to Ax=b on output */
00348      double B [ ],      /* size 2*ldim*nrhs */
00349      klu_common *Common
00350 ) ;
00351 
00352 UF_long amesos_klu_l_solve (klu_l_symbolic *, klu_l_numeric *, UF_long, UF_long,
00353     double *, klu_l_common *) ;
00354 
00355 UF_long amesos_klu_zl_solve (klu_l_symbolic *, klu_l_numeric *, UF_long, UF_long,
00356     double *, klu_l_common *) ;
00357 
00358 
00359 /* -------------------------------------------------------------------------- */
00360 /* klu_tsolve: solves A'x=b using the Symbolic and Numeric objects */
00361 /* -------------------------------------------------------------------------- */
00362 
00363 int amesos_klu_tsolve
00364 (
00365     /* inputs, not modified */
00366     klu_symbolic *Symbolic,
00367     klu_numeric *Numeric,
00368     int ldim,       /* leading dimension of B */
00369     int nrhs,       /* number of right-hand-sides */
00370 
00371     /* right-hand-side on input, overwritten with solution to Ax=b on output */
00372     double B [ ],     /* size ldim*nrhs */
00373     klu_common *Common
00374 ) ;
00375 
00376 int amesos_klu_z_tsolve
00377 (
00378     /* inputs, not modified */
00379     klu_symbolic *Symbolic,
00380     klu_numeric *Numeric,
00381     int ldim,       /* leading dimension of B */
00382     int nrhs,       /* number of right-hand-sides */
00383 
00384     /* right-hand-side on input, overwritten with solution to Ax=b on output */
00385     double B [ ],     /* size 2*ldim*nrhs */
00386     int conj_solve,     /* TRUE: conjugate solve, FALSE: solve A.'x=b */
00387     klu_common *Common
00388      
00389 ) ;
00390 
00391 UF_long amesos_klu_l_tsolve (klu_l_symbolic *, klu_l_numeric *, UF_long, UF_long,
00392     double *, klu_l_common *) ;
00393 
00394 UF_long amesos_klu_zl_tsolve (klu_l_symbolic *, klu_l_numeric *, UF_long, UF_long,
00395     double *, UF_long, klu_l_common * ) ;
00396 
00397 
00398 /* -------------------------------------------------------------------------- */
00399 /* klu_refactor: refactorizes matrix with same ordering as klu_factor */
00400 /* -------------------------------------------------------------------------- */
00401 
00402 int amesos_klu_refactor     /* return TRUE if successful, FALSE otherwise */
00403 (
00404     /* inputs, not modified */
00405     int Ap [ ],   /* size n+1, column pointers */
00406     int Ai [ ],   /* size nz, row indices */
00407     double Ax [ ],  /* size nz, numerical values */
00408     klu_symbolic *Symbolic,
00409     /* input, and numerical values modified on output */
00410     klu_numeric *Numeric,
00411     klu_common *Common
00412 ) ;
00413 
00414 int amesos_klu_z_refactor     /* return TRUE if successful, FALSE otherwise */
00415 (
00416      /* inputs, not modified */
00417      int Ap [ ],  /* size n+1, column pointers */
00418      int Ai [ ],  /* size nz, row indices */
00419      double Ax [ ], /* size 2*nz, numerical values */
00420      klu_symbolic *Symbolic,
00421      /* input, and numerical values modified on output */
00422      klu_numeric *Numeric,
00423      klu_common *Common
00424 ) ;
00425 
00426 UF_long amesos_klu_l_refactor (UF_long *, UF_long *, double *, klu_l_symbolic *,
00427     klu_l_numeric *, klu_l_common *) ;
00428 
00429 UF_long amesos_klu_zl_refactor (UF_long *, UF_long *, double *, klu_l_symbolic *,
00430     klu_l_numeric *, klu_l_common *) ;
00431 
00432 
00433 /* -------------------------------------------------------------------------- */
00434 /* klu_free_symbolic: destroys the Symbolic object */
00435 /* -------------------------------------------------------------------------- */
00436 
00437 int amesos_klu_free_symbolic
00438 (
00439     klu_symbolic **Symbolic,
00440     klu_common *Common
00441 ) ;
00442 
00443 UF_long amesos_klu_l_free_symbolic (klu_l_symbolic **, klu_l_common *) ;
00444 
00445 
00446 /* -------------------------------------------------------------------------- */
00447 /* klu_free_numeric: destroys the Numeric object */
00448 /* -------------------------------------------------------------------------- */
00449 
00450 /* Note that klu_free_numeric and klu_z_free_numeric are identical; each can
00451  * free both kinds of Numeric objects (real and complex) */
00452 
00453 int amesos_klu_free_numeric
00454 (
00455     klu_numeric **Numeric,
00456     klu_common *Common
00457 ) ;
00458 
00459 int amesos_klu_z_free_numeric
00460 (
00461      klu_numeric **Numeric,
00462      klu_common *Common
00463 ) ;
00464 
00465 UF_long amesos_klu_l_free_numeric (klu_l_numeric **, klu_l_common *) ;
00466 UF_long amesos_klu_zl_free_numeric (klu_l_numeric **, klu_l_common *) ;
00467 
00468 
00469 /* -------------------------------------------------------------------------- */
00470 /* klu_sort: sorts the columns of the LU factorization */
00471 /* -------------------------------------------------------------------------- */
00472 
00473 /* this is not needed except for the MATLAB interface */
00474 
00475 int amesos_klu_sort
00476 (
00477     /* inputs, not modified */
00478     klu_symbolic *Symbolic,
00479     /* input/output */
00480     klu_numeric *Numeric,
00481     klu_common *Common
00482 ) ;
00483 
00484 int amesos_klu_z_sort
00485 (
00486     /* inputs, not modified */
00487     klu_symbolic *Symbolic,
00488     /* input/output */
00489     klu_numeric *Numeric,
00490     klu_common *Common
00491 ) ;
00492 
00493 UF_long amesos_klu_l_sort (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ;
00494 UF_long amesos_klu_zl_sort (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ;
00495 
00496 
00497 /* -------------------------------------------------------------------------- */
00498 /* klu_flops: determines # of flops performed in numeric factorzation */
00499 /* -------------------------------------------------------------------------- */
00500 
00501 int amesos_klu_flops
00502 (
00503     /* inputs, not modified */
00504     klu_symbolic *Symbolic,
00505     klu_numeric *Numeric,
00506     /* input/output */
00507     klu_common *Common
00508 ) ;
00509 
00510 int amesos_klu_z_flops
00511 (
00512     /* inputs, not modified */
00513     klu_symbolic *Symbolic,
00514     klu_numeric *Numeric,
00515     /* input/output */
00516     klu_common *Common
00517 ) ;
00518 
00519 UF_long amesos_klu_l_flops (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ;
00520 UF_long amesos_klu_zl_flops (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ;
00521 
00522 
00523 
00524 /* -------------------------------------------------------------------------- */
00525 /* klu_rgrowth : compute the reciprocal pivot growth */
00526 /* -------------------------------------------------------------------------- */
00527 
00528 /* Pivot growth is computed after the input matrix is permuted, scaled, and
00529  * off-diagonal entries pruned.  This is because the LU factorization of each
00530  * block takes as input the scaled diagonal blocks of the BTF form.  The
00531  * reciprocal pivot growth in column j of an LU factorization of a matrix C
00532  * is the largest entry in C divided by the largest entry in U; then the overall
00533  * reciprocal pivot growth is the smallest such value for all columns j.  Note
00534  * that the off-diagonal entries are not scaled, since they do not take part in
00535  * the LU factorization of the diagonal blocks.
00536  *
00537  * In MATLAB notation:
00538  *
00539  * rgrowth = min (max (abs ((R \ A(p,q)) - F)) ./ max (abs (U))) */
00540 
00541 int amesos_klu_rgrowth
00542 (
00543     int Ap [ ],
00544     int Ai [ ],
00545     double Ax [ ],
00546     klu_symbolic *Symbolic,
00547     klu_numeric *Numeric,
00548     klu_common *Common    /* Common->rgrowth = reciprocal pivot growth */
00549 ) ;
00550 
00551 int amesos_klu_z_rgrowth
00552 (
00553     int Ap [ ],
00554     int Ai [ ],
00555     double Ax [ ],
00556     klu_symbolic *Symbolic,
00557     klu_numeric *Numeric,
00558     klu_common *Common    /* Common->rgrowth = reciprocal pivot growth */
00559 ) ;
00560 
00561 UF_long amesos_klu_l_rgrowth (UF_long *, UF_long *, double *, klu_l_symbolic *,
00562     klu_l_numeric *, klu_l_common *) ;
00563 
00564 UF_long amesos_klu_zl_rgrowth (UF_long *, UF_long *, double *, klu_l_symbolic *,
00565     klu_l_numeric *, klu_l_common *) ;
00566 
00567 
00568 /* -------------------------------------------------------------------------- */
00569 /* klu_condest */
00570 /* -------------------------------------------------------------------------- */
00571 
00572 /* Computes a reasonably accurate estimate of the 1-norm condition number, using
00573  * Hager's method, as modified by Higham and Tisseur (same method as used in
00574  * MATLAB's condest */
00575 
00576 int amesos_klu_condest
00577 (
00578     int Ap [ ],       /* size n+1, column pointers, not modified */
00579     double Ax [ ],      /* size nz = Ap[n], numerical values, not modified*/
00580     klu_symbolic *Symbolic, /* symbolic analysis, not modified */
00581     klu_numeric *Numeric,   /* numeric factorization, not modified */
00582     klu_common *Common      /* result returned in Common->condest */
00583 ) ;
00584 
00585 int amesos_klu_z_condest
00586 (
00587     int Ap [ ],
00588     double Ax [ ],      /* size 2*nz */
00589     klu_symbolic *Symbolic,
00590     klu_numeric *Numeric,
00591     klu_common *Common      /* result returned in Common->condest */
00592 ) ;
00593 
00594 UF_long amesos_klu_l_condest (UF_long *, double *, klu_l_symbolic *, klu_l_numeric *,
00595     klu_l_common *) ;
00596 
00597 UF_long amesos_klu_zl_condest (UF_long *, double *, klu_l_symbolic *, klu_l_numeric *,
00598     klu_l_common *) ;
00599 
00600 
00601 /* -------------------------------------------------------------------------- */
00602 /* klu_rcond: compute min(abs(diag(U))) / max(abs(diag(U))) */
00603 /* -------------------------------------------------------------------------- */
00604 
00605 int amesos_klu_rcond
00606 (
00607     klu_symbolic *Symbolic,     /* input, not modified */
00608     klu_numeric *Numeric,     /* input, not modified */
00609     klu_common *Common        /* result in Common->rcond */
00610 ) ;
00611 
00612 int amesos_klu_z_rcond
00613 (
00614     klu_symbolic *Symbolic,     /* input, not modified */
00615     klu_numeric *Numeric,     /* input, not modified */
00616     klu_common *Common        /* result in Common->rcond */
00617 ) ;
00618 
00619 UF_long amesos_klu_l_rcond (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ;
00620 
00621 UF_long amesos_klu_zl_rcond (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ;
00622 
00623 
00624 
00625 /* -------------------------------------------------------------------------- */
00626 /* klu_scale */
00627 /* -------------------------------------------------------------------------- */
00628 
00629 int amesos_klu_scale    /* return TRUE if successful, FALSE otherwise */
00630 (
00631     /* inputs, not modified */
00632     int scale,    /* <0: none, no error check; 0: none, 1: sum, 2: max */
00633     int n,
00634     int Ap [ ],   /* size n+1, column pointers */
00635     int Ai [ ],   /* size nz, row indices */
00636     double Ax [ ],
00637     /* outputs, not defined on input */
00638     double Rs [ ],
00639     /* workspace, not defined on input or output */
00640     int W [ ],    /* size n, can be NULL */
00641     klu_common *Common
00642 ) ;
00643 
00644 int amesos_klu_z_scale    /* return TRUE if successful, FALSE otherwise */
00645 (
00646     /* inputs, not modified */
00647     int scale,    /* <0: none, no error check; 0: none, 1: sum, 2: max */
00648     int n,
00649     int Ap [ ],   /* size n+1, column pointers */
00650     int Ai [ ],   /* size nz, row indices */
00651     double Ax [ ],
00652     /* outputs, not defined on input */
00653     double Rs [ ],
00654     /* workspace, not defined on input or output */
00655     int W [ ],    /* size n, can be NULL */
00656     klu_common *Common
00657 ) ;
00658 
00659 UF_long amesos_klu_l_scale (UF_long, UF_long, UF_long *, UF_long *, double *,
00660     double *, UF_long *, klu_l_common *) ;
00661 
00662 UF_long amesos_klu_zl_scale (UF_long, UF_long, UF_long *, UF_long *, double *,
00663     double *, UF_long *, klu_l_common *) ;
00664 
00665 
00666 /* -------------------------------------------------------------------------- */
00667 /* klu_extract  */
00668 /* -------------------------------------------------------------------------- */
00669 
00670 int amesos_klu_extract      /* returns TRUE if successful, FALSE otherwise */
00671 (
00672     /* inputs: */
00673     klu_numeric *Numeric,
00674     klu_symbolic *Symbolic,
00675 
00676     /* outputs, either allocated on input, or ignored otherwise */
00677 
00678     /* L */
00679     int *Lp,      /* size n+1 */
00680     int *Li,      /* size Numeric->lnz */
00681     double *Lx,     /* size Numeric->lnz */
00682 
00683     /* U */
00684     int *Up,      /* size n+1 */
00685     int *Ui,      /* size Numeric->unz */
00686     double *Ux,     /* size Numeric->unz */
00687 
00688     /* F */
00689     int *Fp,      /* size n+1 */
00690     int *Fi,      /* size Numeric->nzoff */
00691     double *Fx,     /* size Numeric->nzoff */
00692 
00693     /* P, row permutation */
00694     int *P,     /* size n */
00695 
00696     /* Q, column permutation */
00697     int *Q,     /* size n */
00698 
00699     /* Rs, scale factors */
00700     double *Rs,     /* size n */
00701 
00702     /* R, block boundaries */
00703     int *R,     /* size Symbolic->nblocks+1 (nblocks is at most n) */
00704 
00705     klu_common *Common
00706 ) ;
00707 
00708 
00709 int amesos_klu_z_extract      /* returns TRUE if successful, FALSE otherwise */
00710 (
00711     /* inputs: */
00712     klu_numeric *Numeric,
00713     klu_symbolic *Symbolic,
00714 
00715     /* outputs, all of which must be allocated on input */
00716 
00717     /* L */
00718     int *Lp,      /* size n+1 */
00719     int *Li,      /* size nnz(L) */
00720     double *Lx,     /* size nnz(L) */
00721     double *Lz,     /* size nnz(L) for the complex case, ignored if real */
00722 
00723     /* U */
00724     int *Up,      /* size n+1 */
00725     int *Ui,      /* size nnz(U) */
00726     double *Ux,     /* size nnz(U) */
00727     double *Uz,     /* size nnz(U) for the complex case, ignored if real */
00728 
00729     /* F */
00730     int *Fp,      /* size n+1 */
00731     int *Fi,      /* size nnz(F) */
00732     double *Fx,     /* size nnz(F) */
00733     double *Fz,     /* size nnz(F) for the complex case, ignored if real */
00734 
00735     /* P, row permutation */
00736     int *P,     /* size n */
00737 
00738     /* Q, column permutation */
00739     int *Q,     /* size n */
00740 
00741     /* Rs, scale factors */
00742     double *Rs,     /* size n */
00743 
00744     /* R, block boundaries */
00745     int *R,     /* size Symbolic->nblocks+1 (nblocks is at most n) */
00746 
00747     klu_common *Common
00748 ) ;
00749 
00750 UF_long amesos_klu_l_extract (klu_l_numeric *, klu_l_symbolic *,
00751     UF_long *, UF_long *, double *,
00752     UF_long *, UF_long *, double *,
00753     UF_long *, UF_long *, double *,
00754     UF_long *, UF_long *, double *, UF_long *, klu_l_common *) ;
00755 
00756 UF_long amesos_klu_zl_extract (klu_l_numeric *, klu_l_symbolic *,
00757     UF_long *, UF_long *, double *, double *,
00758     UF_long *, UF_long *, double *, double *,
00759     UF_long *, UF_long *, double *, double *,
00760     UF_long *, UF_long *, double *, UF_long *, klu_l_common *) ;
00761 
00762 
00763 /* -------------------------------------------------------------------------- */
00764 /* KLU memory management routines */
00765 /* -------------------------------------------------------------------------- */
00766 
00767 void *amesos_klu_malloc /* returns pointer to the newly malloc'd block */
00768 (
00769     /* ---- input ---- */
00770     size_t n,   /* number of items */
00771     size_t size,  /* size of each item */
00772     /* --------------- */
00773     klu_common *Common
00774 ) ;
00775 
00776 void *amesos_klu_free   /* always returns NULL */
00777 (
00778     /* ---- in/out --- */
00779     void *p,    /* block of memory to free */
00780     size_t n,   /* number of items */
00781     size_t size,  /* size of each item */
00782     /* --------------- */
00783     klu_common *Common
00784 ) ;
00785 
00786 void *amesos_klu_realloc  /* returns pointer to reallocated block */
00787 (
00788     /* ---- input ---- */
00789     size_t nnew,  /* requested # of items in reallocated block */
00790     size_t nold,  /* current size of block, in # of items */
00791     size_t size,  /* size of each item */
00792     /* ---- in/out --- */
00793     void *p,    /* block of memory to realloc */
00794     /* --------------- */
00795     klu_common *Common
00796 ) ;
00797 
00798 void *amesos_klu_l_malloc (size_t, size_t, klu_l_common *) ;
00799 void *amesos_klu_l_free (void *, size_t, size_t, klu_l_common *) ;
00800 void *amesos_klu_l_realloc (size_t, size_t, size_t, void *, klu_l_common *) ;
00801 
00802 
00803 /* ========================================================================== */
00804 /* === KLU version ========================================================== */
00805 /* ========================================================================== */
00806 
00807 /* All versions of KLU include these definitions.
00808  * As an example, to test if the version you are using is 1.2 or later:
00809  *
00810  *  if (KLU_VERSION >= KLU_VERSION_CODE (1,2)) ...
00811  *
00812  * This also works during compile-time:
00813  *
00814  *  #if (KLU >= KLU_VERSION_CODE (1,2))
00815  *      printf ("This is version 1.2 or later\n") ;
00816  *  #else
00817  *      printf ("This is an early version\n") ;
00818  *  #endif
00819  */
00820 
00821 #define KLU_DATE "May 31, 2007"
00822 #define KLU_VERSION_CODE(main,sub) ((main) * 1000 + (sub))
00823 #define KLU_MAIN_VERSION 1
00824 #define KLU_SUB_VERSION 0
00825 #define KLU_SUBSUB_VERSION 0
00826 #define KLU_VERSION KLU_VERSION_CODE(KLU_MAIN_VERSION,KLU_SUB_VERSION)
00827 
00828 #ifdef __cplusplus
00829 }
00830 #endif
00831 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines