1 /* ========================================================================== */
2 /* === UMFPACK_get_lunz ===================================================== */
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.  Determines the number of nonzeros in L and U, and the size
12     of L and U.
13 */
14 
15 #include "umf_internal.h"
16 #include "umf_valid_numeric.h"
17 
UMFPACK_get_lunz(Int * lnz,Int * unz,Int * n_row,Int * n_col,Int * nz_udiag,void * NumericHandle)18 GLOBAL Int UMFPACK_get_lunz
19 (
20     Int *lnz,
21     Int *unz,
22     Int *n_row,
23     Int *n_col,
24     Int *nz_udiag,
25     void *NumericHandle
26 )
27 {
28     NumericType *Numeric ;
29 
30     Numeric = (NumericType *) NumericHandle ;
31 
32     if (!UMF_valid_numeric (Numeric))
33     {
34 	return (UMFPACK_ERROR_invalid_Numeric_object) ;
35     }
36     if (!lnz || !unz || !n_row || !n_col || !nz_udiag)
37     {
38 	return (UMFPACK_ERROR_argument_missing) ;
39     }
40 
41     *n_row = Numeric->n_row ;
42     *n_col = Numeric->n_col ;
43 
44     /* number of nz's in L below diagonal, plus the unit diagonal of L */
45     *lnz = Numeric->lnz + MIN (Numeric->n_row, Numeric->n_col) ;
46 
47     /* number of nz's in U above diagonal, plus nz's on diagaonal of U */
48     *unz = Numeric->unz + Numeric->nnzpiv ;
49 
50     /* number of nz's on the diagonal */
51     *nz_udiag = Numeric->nnzpiv ;
52 
53     return (UMFPACK_OK) ;
54 }
55