1 //------------------------------------------------------------------------------ 2 // SLIP_LU/SLIP_create_default_options: set defaults 3 //------------------------------------------------------------------------------ 4 5 // SLIP_LU: (c) 2019-2020, Chris Lourenco, Jinhao Chen, Erick Moreno-Centeno, 6 // Timothy A. Davis, Texas A&M University. All Rights Reserved. See 7 // SLIP_LU/License for the license. 8 9 //------------------------------------------------------------------------------ 10 11 /* Purpose: Create and return SLIP_options pointer with default parameters 12 * upon successful allocation, which are defined in slip_internal.h 13 */ 14 15 #include "slip_internal.h" 16 SLIP_create_default_options(void)17SLIP_options* SLIP_create_default_options ( void ) 18 { 19 20 if (!slip_initialized ( )) return (NULL) ; 21 22 //-------------------------------------------------------------------------- 23 // allocate the option struct 24 //-------------------------------------------------------------------------- 25 26 SLIP_options* option = SLIP_malloc(sizeof(SLIP_options)) ; 27 if (!option) 28 { 29 // out of memory 30 return (NULL) ; 31 } 32 33 //-------------------------------------------------------------------------- 34 // set defaults 35 //-------------------------------------------------------------------------- 36 37 option->pivot = SLIP_DEFAULT_PIVOT ; 38 option->order = SLIP_DEFAULT_ORDER ; 39 option->print_level = SLIP_DEFAULT_PRINT_LEVEL ; 40 option->prec = SLIP_DEFAULT_PRECISION ; 41 option->tol = SLIP_DEFAULT_TOL ; 42 option->round = SLIP_DEFAULT_MPFR_ROUND ; 43 option->check = false ; 44 45 //-------------------------------------------------------------------------- 46 // return result 47 //-------------------------------------------------------------------------- 48 49 return option ; 50 } 51 52