1 /* ========================================================================== */
2 /* === UMFPACK_report_status ================================================ */
3 /* ========================================================================== */
4 
5 /* -------------------------------------------------------------------------- */
6 /* Copyright (c) 2005-2012 by Timothy A. Davis, http://www.suitesparse.com.   */
7 /* All Rights Reserved.  See ../Doc/License.txt for License.                  */
8 /* -------------------------------------------------------------------------- */
9 
10 /*
11     User-callable.  Prints the return value from other UMFPACK_* routines.
12     See umfpack_report_status.h for details.
13 */
14 
15 #include "umf_internal.h"
16 
UMFPACK_report_status(const double Control[UMFPACK_CONTROL],Int status)17 GLOBAL void UMFPACK_report_status
18 (
19     const double Control [UMFPACK_CONTROL],
20     Int status
21 )
22 {
23     Int prl ;
24 
25     /* ---------------------------------------------------------------------- */
26     /* get control settings and status to determine what to print */
27     /* ---------------------------------------------------------------------- */
28 
29     prl = GET_CONTROL (UMFPACK_PRL, UMFPACK_DEFAULT_PRL) ;
30 
31     if (prl < 1)
32     {
33 	/* no output generated if prl is less than 1 */
34 	return ;
35     }
36 
37     if (status == UMFPACK_OK && prl <= 1)
38     {
39 	/* no output generated if prl is 1 or less and no error occurred. */
40 	/* note that the default printing level is 1. */
41 	return ;
42     }
43 
44     /* ---------------------------------------------------------------------- */
45     /* print umfpack license, copyright, version, and status condition */
46     /* ---------------------------------------------------------------------- */
47 
48     PRINTF  (("\n")) ;
49     PRINTF4 (("%s\n", UMFPACK_COPYRIGHT)) ;
50     PRINTF6 (("%s", UMFPACK_LICENSE_PART1)) ;
51     PRINTF6 (("%s", UMFPACK_LICENSE_PART2)) ;
52     PRINTF6 (("%s", UMFPACK_LICENSE_PART3)) ;
53     PRINTF  (("UMFPACK V%d.%d.%d (%s): ", UMFPACK_MAIN_VERSION,
54 	UMFPACK_SUB_VERSION, UMFPACK_SUBSUB_VERSION, UMFPACK_DATE)) ;
55 
56     switch (status)
57     {
58 	case UMFPACK_OK:
59 	    PRINTF (("OK\n")) ;
60 	    break ;
61 
62 	case UMFPACK_WARNING_singular_matrix:
63 	    PRINTF (("WARNING: matrix is singular\n")) ;
64 	    break ;
65 
66 	case UMFPACK_ERROR_out_of_memory:
67 	    PRINTF (("ERROR: out of memory\n")) ;
68 	    break ;
69 
70 	case UMFPACK_ERROR_invalid_Numeric_object:
71 	    PRINTF (("ERROR: Numeric object is invalid\n")) ;
72 	    break ;
73 
74 	case UMFPACK_ERROR_invalid_Symbolic_object:
75 	    PRINTF (("ERROR: Symbolic object is invalid\n")) ;
76 	    break ;
77 
78 	case UMFPACK_ERROR_argument_missing:
79 	    PRINTF (("ERROR: required argument(s) missing\n")) ;
80 	    break ;
81 
82 	case UMFPACK_ERROR_n_nonpositive:
83 	    PRINTF (("ERROR: dimension (n_row or n_col) must be > 0\n")) ;
84 	    break ;
85 
86 	case UMFPACK_ERROR_invalid_matrix:
87 	    PRINTF (("ERROR: input matrix is invalid\n")) ;
88 	    break ;
89 
90 	case UMFPACK_ERROR_invalid_system:
91 	    PRINTF (("ERROR: system argument invalid\n")) ;
92 	    break ;
93 
94 	case UMFPACK_ERROR_invalid_permutation:
95 	    PRINTF (("ERROR: invalid permutation\n")) ;
96 	    break ;
97 
98 	case UMFPACK_ERROR_different_pattern:
99 	    PRINTF (("ERROR: pattern of matrix (Ap and/or Ai) has changed\n")) ;
100 	    break ;
101 
102         case UMFPACK_ERROR_ordering_failed:
103 	    PRINTF (("ERROR: ordering failed\n")) ;
104 	    break ;
105 
106 	case UMFPACK_ERROR_internal_error:
107 	    PRINTF (("INTERNAL ERROR!\n"
108 	    "Input arguments might be corrupted or aliased, or an internal\n"
109 	    "error has occurred.  Check your input arguments with the\n"
110 	    "umfpack_*_report_* routines before calling the umfpack_*\n"
111 	    "computational routines.  Recompile UMFPACK with debugging\n"
112 	    "enabled, and look for failed assertions.  If all else fails\n"
113 	    "please report this error to Tim Davis\n"
114             "(DrTimothyAldenDavis@gmail.com).\n"
115 	    )) ;
116 	    break ;
117 
118 	default:
119 	    PRINTF (("ERROR: Unrecognized error code: "ID"\n", status)) ;
120 
121     }
122     PRINTF  (("\n")) ;
123 }
124