1 /* ========================================================================== */
2 /* === KLU_defaults ========================================================= */
3 /* ========================================================================== */
4 
5 /* Sets default parameters for KLU */
6 
7 #include "klu_internal.h"
8 
KLU_defaults(KLU_common * Common)9 Int KLU_defaults
10 (
11     KLU_common *Common
12 )
13 {
14     if (Common == NULL)
15     {
16         return (FALSE) ;
17     }
18 
19     /* parameters */
20     Common->tol = 0.001 ;       /* pivot tolerance for diagonal */
21     Common->memgrow = 1.2;      /* realloc size ratio increase for LU factors */
22     Common->initmem_amd = 1.2 ; /* init. mem with AMD:  c*nnz(L) + n */
23     Common->initmem = 10 ;      /* init. mem otherwise: c*nnz(A) + n */
24     Common->btf = TRUE ;        /* use BTF pre-ordering, or not */
25     Common->maxwork = 0 ;       /* no limit to work done by btf_order */
26     Common->ordering = 0 ;      /* 0: AMD, 1: COLAMD, 2: user-provided P and Q,
27                                  * 3: user-provided function */
28     Common->scale = 2 ;         /* scale: -1: none, and do not check for errors
29                                  * in the input matrix in KLU_refactor.
30                                  * 0: none, but check for errors,
31                                  * 1: sum, 2: max */
32     Common->halt_if_singular = TRUE ;   /* quick halt if matrix is singular */
33 
34     /* user ordering function and optional argument */
35     Common->user_order = NULL ;
36     Common->user_data = NULL ;
37 
38     /* statistics */
39     Common->status = KLU_OK ;
40     Common->nrealloc = 0 ;
41     Common->structural_rank = EMPTY ;
42     Common->numerical_rank = EMPTY ;
43     Common->noffdiag = EMPTY ;
44     Common->flops = EMPTY ;
45     Common->rcond = EMPTY ;
46     Common->condest = EMPTY ;
47     Common->rgrowth = EMPTY ;
48     Common->work = 0 ;          /* work done by btf_order */
49 
50     Common->memusage = 0 ;
51     Common->mempeak = 0 ;
52 
53     return (TRUE) ;
54 }
55