1 /* ========================================================================== */
2 /* === UMF_valid_numeric ==================================================== */
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 /* Returns TRUE if the Numeric object is valid, FALSE otherwise. */
11 /* Does not check everything.  UMFPACK_report_numeric checks more. */
12 
13 #include "umf_internal.h"
14 #include "umf_valid_numeric.h"
15 
UMF_valid_numeric(NumericType * Numeric)16 GLOBAL Int UMF_valid_numeric
17 (
18     NumericType *Numeric
19 )
20 {
21     /* This routine does not check the contents of the individual arrays, so */
22     /* it can miss some errors.  All it checks for is the presence of the */
23     /* arrays, and the Numeric "valid" entry. */
24 
25     if (!Numeric)
26     {
27 	return (FALSE) ;
28     }
29 
30     if (Numeric->valid != NUMERIC_VALID)
31     {
32 	/* Numeric does not point to a NumericType object */
33 	return (FALSE) ;
34     }
35 
36     if (Numeric->n_row <= 0 || Numeric->n_col <= 0 || !Numeric->D ||
37 	!Numeric->Rperm || !Numeric->Cperm ||
38 	!Numeric->Lpos || !Numeric->Upos ||
39 	!Numeric->Lilen || !Numeric->Uilen || !Numeric->Lip || !Numeric->Uip ||
40 	!Numeric->Memory || (Numeric->ulen > 0 && !Numeric->Upattern))
41     {
42 	return (FALSE) ;
43     }
44 
45     return (TRUE) ;
46 }
47