Amesos Package Browser (Single Doxygen Collection) Development
amesos_cholmod_l_common.c
Go to the documentation of this file.
00001 /* ========================================================================== */
00002 /* === Core/cholmod_common ================================================== */
00003 /* ========================================================================== */
00004 
00005 /* -----------------------------------------------------------------------------
00006  * CHOLMOD/Core Module.  Copyright (C) 2005-2006,
00007  * Univ. of Florida.  Author: Timothy A. Davis
00008  * The CHOLMOD/Core Module is licensed under Version 2.1 of the GNU
00009  * Lesser General Public License.  See lesser.txt for a text of the license.
00010  * CHOLMOD is also available under other licenses; contact authors for details.
00011  * http://www.cise.ufl.edu/research/sparse
00012  * -------------------------------------------------------------------------- */
00013 
00014 /* Core utility routines for the cholmod_common object:
00015  *
00016  * Primary routines:
00017  * -----------------
00018  * cholmod_start    the first call to CHOLMOD
00019  * cholmod_finish   the last call to CHOLMOD
00020  *
00021  * Secondary routines:
00022  * -------------------
00023  * cholmod_defaults   restore (most) default control parameters
00024  * cholmod_allocate_work  allocate (or reallocate) workspace in Common
00025  * cholmod_free_work    free workspace in Common
00026  * cholmod_clear_flag   clear Common->Flag in workspace
00027  * cholmod_maxrank    column dimension of Common->Xwork workspace
00028  *
00029  * The Common object is unique.  It cannot be allocated or deallocated by
00030  * CHOLMOD, since it contains the definition of the memory management routines
00031  * used (pointers to malloc, free, realloc, and calloc, or their equivalent).
00032  * The Common object contains workspace that is used between calls to
00033  * CHOLMOD routines.  This workspace allocated by CHOLMOD as needed, by
00034  * cholmod_allocate_work and cholmod_free_work.
00035  */
00036 
00037 /* This file should make the long int version of CHOLMOD */
00038 #define DLONG 1
00039 
00040 #include "amesos_cholmod_internal.h"
00041 #include "amesos_cholmod_core.h"
00042 
00043 /* ========================================================================== */
00044 /* === cholmod_start ======================================================== */
00045 /* ========================================================================== */
00046 
00047 /* Initialize Common default parameters and statistics.  Sets workspace
00048  * pointers to NULL.
00049  *
00050  * This routine must be called just once, prior to calling any other CHOLMOD
00051  * routine.  Do not call this routine after any other CHOLMOD routine (except
00052  * cholmod_finish, to start a new CHOLMOD session), or a memory leak will
00053  * occur.
00054  *
00055  * workspace: none
00056  */
00057 
00058 int CHOLMOD(start)
00059 (
00060     cholmod_common *Common
00061 )
00062 {
00063     if (Common == NULL)
00064     {
00065   return (FALSE) ;
00066     }
00067 
00068     /* ---------------------------------------------------------------------- */
00069     /* user error handling routine */
00070     /* ---------------------------------------------------------------------- */
00071 
00072     Common->error_handler = NULL ;
00073 
00074     /* ---------------------------------------------------------------------- */
00075     /* integer and numerical types */
00076     /* ---------------------------------------------------------------------- */
00077 
00078     Common->itype = ITYPE ;
00079     Common->dtype = DTYPE ;
00080 
00081     /* ---------------------------------------------------------------------- */
00082     /* default control parameters */
00083     /* ---------------------------------------------------------------------- */
00084 
00085     CHOLMOD(defaults) (Common) ;
00086     Common->try_catch = FALSE ;
00087 
00088     /* ---------------------------------------------------------------------- */
00089     /* memory management routines */
00090     /* ---------------------------------------------------------------------- */
00091 
00092     /* The user can replace cholmod's memory management routines by redefining
00093      * these function pointers. */
00094 
00095 #ifndef NMALLOC
00096     /* stand-alone ANSI C program */
00097     Common->malloc_memory  = malloc ;
00098     Common->free_memory    = free ;
00099     Common->realloc_memory = realloc ;
00100     Common->calloc_memory  = calloc ;
00101 #else
00102     /* no memory manager defined at compile-time; MUST define one at run-time */
00103     Common->malloc_memory  = NULL ;
00104     Common->free_memory    = NULL ;
00105     Common->realloc_memory = NULL ;
00106     Common->calloc_memory  = NULL ;
00107 #endif
00108 
00109     /* ---------------------------------------------------------------------- */
00110     /* complex arithmetic routines */
00111     /* ---------------------------------------------------------------------- */
00112 
00113     Common->complex_divide = CHOLMOD(divcomplex) ;
00114     Common->hypotenuse = CHOLMOD(hypot) ;
00115 
00116     /* ---------------------------------------------------------------------- */
00117     /* print routine */
00118     /* ---------------------------------------------------------------------- */
00119 
00120 #ifndef NPRINT
00121     /* stand-alone ANSI C program */
00122     Common->print_function = printf ;
00123 #else
00124     /* printing disabled */
00125     Common->print_function = NULL ;
00126 #endif
00127 
00128     /* ---------------------------------------------------------------------- */
00129     /* workspace */
00130     /* ---------------------------------------------------------------------- */
00131 
00132     /* This code assumes the workspace held in Common is not initialized.  If
00133      * it is, then a memory leak will occur because the pointers are
00134      * overwritten with NULL. */
00135 
00136     Common->nrow = 0 ;
00137     Common->mark = EMPTY ;
00138     Common->xworksize = 0 ;
00139     Common->iworksize = 0 ;
00140     Common->Flag = NULL ;
00141     Common->Head = NULL ;
00142     Common->Iwork = NULL ;
00143     Common->Xwork = NULL ;
00144     Common->no_workspace_reallocate = FALSE ;
00145 
00146     /* ---------------------------------------------------------------------- */
00147     /* statistics */
00148     /* ---------------------------------------------------------------------- */
00149 
00150     /* fl and lnz are computed in cholmod_analyze and cholmod_rowcolcounts */
00151     Common->fl = EMPTY ;
00152     Common->lnz = EMPTY ;
00153 
00154     /* modfl is computed in cholmod_updown, cholmod_rowadd, and cholmod_rowdel*/
00155     Common->modfl = EMPTY ;
00156 
00157     /* all routines use status as their error-report code */
00158     Common->status = CHOLMOD_OK ;
00159 
00160     Common->malloc_count = 0 ;  /* # calls to malloc minus # calls to free */
00161     Common->memory_usage = 0 ;  /* peak memory usage (in bytes) */
00162     Common->memory_inuse = 0 ;  /* current memory in use (in bytes) */
00163 
00164     Common->nrealloc_col = 0 ;
00165     Common->nrealloc_factor = 0 ;
00166     Common->ndbounds_hit = 0 ;
00167     Common->rowfacfl = 0 ;
00168     Common->aatfl = EMPTY ;
00169 
00170     /* Common->called_nd is TRUE if cholmod_analyze called or NESDIS */
00171     Common->called_nd = FALSE ;
00172 
00173     DEBUG_INIT ("cholmod start") ;
00174     return (TRUE) ;
00175 }
00176 
00177 
00178 /* ========================================================================== */
00179 /* === cholmod_defaults ===================================================== */
00180 /* ========================================================================== */
00181 
00182 /* Set Common default parameters, except for the function pointers.
00183  *
00184  * workspace: none
00185  */
00186 
00187 int CHOLMOD(defaults)
00188 (
00189     cholmod_common *Common
00190 )
00191 {
00192     Int i ;
00193 
00194     RETURN_IF_NULL_COMMON (FALSE) ;
00195 
00196     /* ---------------------------------------------------------------------- */
00197     /* default control parameters */
00198     /* ---------------------------------------------------------------------- */
00199 
00200     Common->dbound = 0.0 ;
00201     Common->grow0 = 1.2 ;
00202     Common->grow1 = 1.2 ;
00203     Common->grow2 = 5 ;
00204     Common->maxrank = 8 ;
00205 
00206     Common->final_asis = TRUE ;
00207     Common->final_super = TRUE ;
00208     Common->final_ll = FALSE ;
00209     Common->final_pack = TRUE ;
00210     Common->final_monotonic = TRUE ;
00211     Common->final_resymbol = FALSE ;
00212 
00213     /* use simplicial factorization if flop/nnz(L) < 40, supernodal otherwise */
00214     Common->supernodal = CHOLMOD_AUTO ;
00215     Common->supernodal_switch = 40 ;
00216 
00217     Common->nrelax [0] = 4 ;
00218     Common->nrelax [1] = 16 ;
00219     Common->nrelax [2] = 48 ;
00220     Common->zrelax [0] = 0.8 ;
00221     Common->zrelax [1] = 0.1 ;
00222     Common->zrelax [2] = 0.05 ;
00223 
00224     Common->prefer_zomplex = FALSE ;
00225     Common->prefer_upper = TRUE ;
00226     Common->prefer_binary = FALSE ;
00227     Common->quick_return_if_not_posdef = FALSE ;
00228 
00229     /* METIS workarounds */
00230     Common->metis_memory = 0.0 ;    /* > 0 for memory guard (2 is reasonable) */
00231     Common->metis_nswitch = 3000 ;
00232     Common->metis_dswitch = 0.66 ;
00233 
00234     Common->print = 3 ;
00235     Common->precise = FALSE ;
00236 
00237     /* ---------------------------------------------------------------------- */
00238     /* default ordering methods */
00239     /* ---------------------------------------------------------------------- */
00240 
00241     /* Note that if the Partition module is not installed, the CHOLMOD_METIS
00242      * and CHOLMOD_NESDIS methods will not be available.  cholmod_analyze will
00243      * report the CHOLMOD_NOT_INSTALLED error, and safely skip over them.
00244      */
00245 
00246 #if (CHOLMOD_MAXMETHODS < 9)
00247 #error "CHOLMOD_MAXMETHODS must be 9 or more (defined in cholmod_core.h)."
00248 #endif
00249 
00250     /* default strategy: try given, AMD, and then METIS if AMD reports high
00251      * fill-in.  NESDIS can be used instead, if Common->default_nesdis is TRUE.
00252      */
00253     Common->nmethods = 0 ;    /* use default strategy */
00254     Common->default_nesdis = FALSE ;  /* use METIS in default strategy */
00255 
00256     Common->current = 0 ; /* current method being tried */
00257     Common->selected = 0 ;  /* the best method selected */
00258 
00259     /* first, fill each method with default parameters */
00260     for (i = 0 ; i <= CHOLMOD_MAXMETHODS ; i++)
00261     {
00262   /* CHOLMOD's default method is AMD for A or AA' */
00263   Common->method [i].ordering = CHOLMOD_AMD ;
00264 
00265   /* CHOLMOD nested dissection and minimum degree parameter */
00266   Common->method [i].prune_dense = 10.0 ; /* dense row/col control */
00267 
00268   /* min degree parameters (AMD, COLAMD, SYMAMD, CAMD, CCOLAMD, CSYMAMD)*/
00269   Common->method [i].prune_dense2 = -1 ;  /* COLAMD dense row control */
00270   Common->method [i].aggressive = TRUE ;  /* aggressive absorption */
00271   Common->method [i].order_for_lu = FALSE ;/* order for Cholesky not LU */
00272 
00273   /* CHOLMOD's nested dissection (METIS + constrained AMD) */
00274   Common->method [i].nd_small = 200 ; /* small graphs aren't cut */
00275   Common->method [i].nd_compress = TRUE ; /* compress graph & subgraphs */
00276   Common->method [i].nd_camd = 1 ;  /* use CAMD */
00277   Common->method [i].nd_components = FALSE ;  /* lump connected comp. */
00278   Common->method [i].nd_oksep = 1.0 ; /* sep ok if < oksep*n */
00279 
00280   /* statistics for each method are not yet computed */
00281   Common->method [i].fl = EMPTY ;
00282   Common->method [i].lnz = EMPTY ;
00283     }
00284 
00285     Common->postorder = TRUE ;  /* follow ordering with weighted postorder */
00286 
00287     /* Next, define some methods.  The first five use default parameters. */
00288     Common->method [0].ordering = CHOLMOD_GIVEN ;   /* skip if UserPerm NULL */
00289     Common->method [1].ordering = CHOLMOD_AMD ;
00290     Common->method [2].ordering = CHOLMOD_METIS ;
00291     Common->method [3].ordering = CHOLMOD_NESDIS ;
00292     Common->method [4].ordering = CHOLMOD_NATURAL ;
00293 
00294     /* CHOLMOD's nested dissection with large leaves of separator tree */
00295     Common->method [5].ordering = CHOLMOD_NESDIS ;
00296     Common->method [5].nd_small = 20000 ;
00297 
00298     /* CHOLMOD's nested dissection with tiny leaves, and no AMD ordering */
00299     Common->method [6].ordering = CHOLMOD_NESDIS ;
00300     Common->method [6].nd_small = 4 ;
00301     Common->method [6].nd_camd = 0 ;    /* no CSYMAMD or CAMD */
00302 
00303     /* CHOLMOD's nested dissection with no dense node removal */
00304     Common->method [7].ordering = CHOLMOD_NESDIS ;
00305     Common->method [7].prune_dense = -1. ;
00306 
00307     /* COLAMD for A*A', AMD for A */
00308     Common->method [8].ordering = CHOLMOD_COLAMD ;
00309 
00310     return (TRUE) ;
00311 }
00312 
00313 
00314 /* ========================================================================== */
00315 /* === cholmod_finish ======================================================= */
00316 /* ========================================================================== */
00317 
00318 /* The last call to CHOLMOD must be cholmod_finish.  You may call this routine
00319  * more than once, and can safely call any other CHOLMOD routine after calling
00320  * it (including cholmod_start).
00321  *
00322  * The statistics and parameter settings in Common are preserved.  The
00323  * workspace in Common is freed.  This routine is just another name for
00324  * cholmod_free_work.
00325  */
00326 
00327 int CHOLMOD(finish)
00328 (
00329     cholmod_common *Common
00330 )
00331 {
00332     return (CHOLMOD(free_work) (Common)) ;
00333 }
00334 
00335 
00336 /* ========================================================================== */
00337 /* === cholmod_allocate_work ================================================ */
00338 /* ========================================================================== */
00339 
00340 /* Allocate and initialize workspace for CHOLMOD routines, or increase the size
00341  * of already-allocated workspace.  If enough workspace is already allocated,
00342  * then nothing happens.
00343  *
00344  * workspace: Flag (nrow), Head (nrow+1), Iwork (iworksize), Xwork (xworksize)
00345  */
00346 
00347 int CHOLMOD(allocate_work)
00348 (
00349     /* ---- input ---- */
00350     size_t nrow,  /* # of rows in the matrix A */
00351     size_t iworksize, /* size of Iwork */
00352     size_t xworksize, /* size of Xwork */
00353     /* --------------- */
00354     cholmod_common *Common
00355 )
00356 {
00357     double *W ;
00358     Int *Head ;
00359     Int i ;
00360     size_t nrow1 ;
00361     int ok = TRUE ;
00362 
00363     /* ---------------------------------------------------------------------- */
00364     /* get inputs */
00365     /* ---------------------------------------------------------------------- */
00366 
00367     RETURN_IF_NULL_COMMON (FALSE) ;
00368     Common->status = CHOLMOD_OK ;
00369 
00370     /* ---------------------------------------------------------------------- */
00371     /* Allocate Flag (nrow) and Head (nrow+1) */
00372     /* ---------------------------------------------------------------------- */
00373 
00374     nrow = MAX (1, nrow) ;
00375 
00376     /* nrow1 = nrow + 1 */
00377     nrow1 = CHOLMOD(add_size_t) (nrow, 1, &ok) ;
00378     if (!ok)
00379     {
00380   /* nrow+1 causes size_t overflow ; problem is too large */
00381   Common->status = CHOLMOD_TOO_LARGE ;
00382   CHOLMOD(free_work) (Common) ;
00383   return (FALSE) ;
00384     }
00385 
00386     if (nrow > Common->nrow)
00387     {
00388 
00389   if (Common->no_workspace_reallocate)
00390   {
00391       /* CHOLMOD is not allowed to change the workspace here */
00392       Common->status = CHOLMOD_INVALID ;
00393       return (FALSE) ;
00394   }
00395 
00396   /* free the old workspace (if any) and allocate new space */
00397   Common->Flag = CHOLMOD(free) (Common->nrow,  sizeof (Int), Common->Flag,
00398     Common) ;
00399   Common->Head = CHOLMOD(free) (Common->nrow+1,sizeof (Int), Common->Head,
00400     Common) ;
00401   Common->Flag = CHOLMOD(malloc) (nrow,   sizeof (Int), Common) ;
00402   Common->Head = CHOLMOD(malloc) (nrow1, sizeof (Int), Common) ;
00403 
00404   /* record the new size of Flag and Head */
00405   Common->nrow = nrow ;
00406 
00407   if (Common->status < CHOLMOD_OK)
00408   {
00409       CHOLMOD(free_work) (Common) ;
00410       return (FALSE) ;
00411   }
00412 
00413   /* initialize Flag and Head */
00414   Common->mark = EMPTY ;
00415   CHOLMOD(clear_flag) (Common) ;
00416   Head = Common->Head ;
00417   for (i = 0 ; i <= (Int) (nrow) ; i++)
00418   {
00419       Head [i] = EMPTY ;
00420   }
00421     }
00422 
00423     /* ---------------------------------------------------------------------- */
00424     /* Allocate Iwork (iworksize) */
00425     /* ---------------------------------------------------------------------- */
00426 
00427     iworksize = MAX (1, iworksize) ;
00428     if (iworksize > Common->iworksize)
00429     {
00430 
00431   if (Common->no_workspace_reallocate)
00432   {
00433       /* CHOLMOD is not allowed to change the workspace here */
00434       Common->status = CHOLMOD_INVALID ;
00435       return (FALSE) ;
00436   }
00437 
00438   /* free the old workspace (if any) and allocate new space.
00439    * integer overflow safely detected in cholmod_malloc */
00440   CHOLMOD(free) (Common->iworksize, sizeof (Int), Common->Iwork, Common) ;
00441   Common->Iwork = CHOLMOD(malloc) (iworksize, sizeof (Int), Common) ;
00442 
00443   /* record the new size of Iwork */
00444   Common->iworksize = iworksize ;
00445 
00446   if (Common->status < CHOLMOD_OK)
00447   {
00448       CHOLMOD(free_work) (Common) ;
00449       return (FALSE) ;
00450   }
00451 
00452   /* note that Iwork does not need to be initialized */
00453     }
00454 
00455     /* ---------------------------------------------------------------------- */
00456     /* Allocate Xwork (xworksize) and set it to ((double) 0.) */
00457     /* ---------------------------------------------------------------------- */
00458 
00459     /* make sure xworksize is >= 1 */
00460     xworksize = MAX (1, xworksize) ;
00461     if (xworksize > Common->xworksize)
00462     {
00463 
00464   if (Common->no_workspace_reallocate)
00465   {
00466       /* CHOLMOD is not allowed to change the workspace here */
00467       Common->status = CHOLMOD_INVALID ;
00468       return (FALSE) ;
00469   }
00470 
00471   /* free the old workspace (if any) and allocate new space */
00472   CHOLMOD(free) (Common->xworksize, sizeof (double), Common->Xwork,
00473     Common) ;
00474   Common->Xwork = CHOLMOD(malloc) (xworksize, sizeof (double), Common) ;
00475 
00476   /* record the new size of Xwork */
00477   Common->xworksize = xworksize ;
00478 
00479   if (Common->status < CHOLMOD_OK)
00480   {
00481       CHOLMOD(free_work) (Common) ;
00482       return (FALSE) ;
00483   }
00484 
00485   /* initialize Xwork */
00486   W = Common->Xwork ;
00487   for (i = 0 ; i < (Int) xworksize ; i++)
00488   {
00489       W [i] = 0. ;
00490   }
00491     }
00492 
00493     return (TRUE) ;
00494 }
00495 
00496 
00497 /* ========================================================================== */
00498 /* === cholmod_free_work ==================================================== */
00499 /* ========================================================================== */
00500 
00501 /* Deallocate the CHOLMOD workspace.
00502  *
00503  * workspace: deallocates all workspace in Common
00504  */
00505 
00506 int CHOLMOD(free_work)
00507 (
00508     cholmod_common *Common
00509 )
00510 {
00511     RETURN_IF_NULL_COMMON (FALSE) ;
00512     Common->Flag  = CHOLMOD(free) (Common->nrow, sizeof (Int),
00513       Common->Flag, Common) ;
00514     Common->Head  = CHOLMOD(free) (Common->nrow+1, sizeof (Int),
00515       Common->Head, Common) ;
00516     Common->Iwork = CHOLMOD(free) (Common->iworksize, sizeof (Int),
00517       Common->Iwork, Common) ;
00518     Common->Xwork = CHOLMOD(free) (Common->xworksize, sizeof (double),
00519       Common->Xwork, Common) ;
00520     Common->nrow = 0 ;
00521     Common->iworksize = 0 ;
00522     Common->xworksize = 0 ;
00523     return (TRUE) ;
00524 }
00525 
00526 
00527 /* ========================================================================== */
00528 /* === cholmod_clear_flag =================================================== */
00529 /* ========================================================================== */
00530 
00531 /* Increment mark to ensure Flag [0..nrow-1] < mark.  If integer overflow
00532  * occurs, or mark was initially negative, reset the entire array.  This is
00533  * not an error condition, but an intended function of the Flag workspace.
00534  *
00535  * workspace: Flag (nrow).  Does not modify Flag if nrow is zero.
00536  */
00537 
00538 UF_long CHOLMOD(clear_flag)
00539 (
00540     cholmod_common *Common
00541 )
00542 {
00543     Int i, nrow, *Flag ;
00544 
00545     RETURN_IF_NULL_COMMON (-1) ;
00546 
00547     Common->mark++ ;
00548     if (Common->mark <= 0)
00549     {
00550   nrow = Common->nrow ;
00551   Flag = Common->Flag ;
00552   PRINT2 (("reset Flag: nrow "ID"\n", nrow)) ;
00553   PRINT2 (("reset Flag: mark %ld\n", Common->mark)) ;
00554   for (i = 0 ; i < nrow ; i++)
00555   {
00556       Flag [i] = EMPTY ;
00557   }
00558   Common->mark = 0 ;
00559     }
00560     return (Common->mark) ;
00561 }
00562 
00563 
00564 /* ========================================================================== */
00565 /* ==== cholmod_maxrank ===================================================== */
00566 /* ========================================================================== */
00567 
00568 /* Find a valid value of Common->maxrank.  Returns 0 if error, or 2, 4, or 8
00569  * if successful. */
00570 
00571 size_t CHOLMOD(maxrank) /* returns validated value of Common->maxrank */
00572 (
00573     /* ---- input ---- */
00574     size_t n,   /* A and L will have n rows */
00575     /* --------------- */
00576     cholmod_common *Common
00577 )
00578 {
00579     size_t maxrank ;
00580     RETURN_IF_NULL_COMMON (0) ;
00581     maxrank = Common->maxrank ;
00582     if (n > 0)
00583     {
00584   /* Ensure maxrank*n*sizeof(double) does not result in integer overflow.
00585    * If n is so large that 2*n*sizeof(double) results in integer overflow
00586    * (n = 268,435,455 if an Int is 32 bits), then maxrank will be 0 or 1,
00587    * but maxrank will be set to 2 below.  2*n will not result in integer
00588    * overflow, and CHOLMOD will run out of memory or safely detect integer
00589    * overflow elsewhere.
00590    */
00591   maxrank = MIN (maxrank, Size_max / (n * sizeof (double))) ;
00592     }
00593     if (maxrank <= 2)
00594     {
00595   maxrank = 2 ;
00596     }
00597     else if (maxrank <= 4)
00598     {
00599   maxrank = 4 ;
00600     }
00601     else
00602     {
00603   maxrank = 8 ;
00604     }
00605     return (maxrank) ;
00606 }
00607 
00608 
00609 /* ========================================================================== */
00610 /* === cholmod_dbound ======================================================= */
00611 /* ========================================================================== */
00612 
00613 /* Ensure the absolute value of a diagonal entry, D (j,j), is greater than
00614  * Common->dbound.  This routine is not meant for the user to call.  It is used
00615  * by the various LDL' factorization and update/downdate routines.  The
00616  * default value of Common->dbound is zero, and in that case this routine is not
00617  * called at all.  No change is made if D (j,j) is NaN.  CHOLMOD does not call
00618  * this routine if Common->dbound is NaN.
00619  */
00620 
00621 double CHOLMOD(dbound)  /* returns modified diagonal entry of D */
00622 (
00623     /* ---- input ---- */
00624     double dj,    /* diagonal entry of D, for LDL' factorization */
00625     /* --------------- */
00626     cholmod_common *Common
00627 )
00628 {
00629     double dbound ;
00630     RETURN_IF_NULL_COMMON (0) ;
00631     if (!IS_NAN (dj))
00632     {
00633   dbound = Common->dbound ;
00634   if (dj < 0)
00635   {
00636       if (dj > -dbound)
00637       {
00638     dj = -dbound ;
00639     Common->ndbounds_hit++ ;
00640     if (Common->status == CHOLMOD_OK)
00641     {
00642         ERROR (CHOLMOD_DSMALL, "diagonal below threshold") ;
00643     }
00644       }
00645   }
00646   else
00647   {
00648       if (dj < dbound)
00649       {
00650     dj = dbound ;
00651     Common->ndbounds_hit++ ;
00652     if (Common->status == CHOLMOD_OK)
00653     {
00654         ERROR (CHOLMOD_DSMALL, "diagonal below threshold") ;
00655     }
00656       }
00657   }
00658     }
00659     return (dj) ;
00660 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines