Amesos Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
amesos_klu_free_numeric.c
Go to the documentation of this file.
1 /* ========================================================================== */
2 /* === KLU_free_numeric ===================================================== */
3 /* ========================================================================== */
4 
5 /* Free the KLU Numeric object. */
6 
7 #include "amesos_klu_internal.h"
8 
10 (
11  KLU_numeric **NumericHandle,
12  KLU_common *Common
13 )
14 {
15  KLU_numeric *Numeric ;
16  Unit **LUbx ;
17  size_t *LUsize ;
18  Int block, n, nzoff, nblocks ;
19 
20  if (Common == NULL)
21  {
22  return (FALSE) ;
23  }
24  if (NumericHandle == NULL || *NumericHandle == NULL)
25  {
26  return (TRUE) ;
27  }
28 
29  Numeric = *NumericHandle ;
30 
31  n = Numeric->n ;
32  nzoff = Numeric->nzoff ;
33  nblocks = Numeric->nblocks ;
34  LUsize = Numeric->LUsize ;
35 
36  LUbx = (Unit **) Numeric->LUbx ;
37  if (LUbx != NULL)
38  {
39  for (block = 0 ; block < nblocks ; block++)
40  {
41  KLU_free (LUbx [block], LUsize ? LUsize [block] : 0,
42  sizeof (Unit), Common) ;
43  }
44  }
45 
46  KLU_free (Numeric->Pnum, n, sizeof (Int), Common) ;
47  KLU_free (Numeric->Offp, n+1, sizeof (Int), Common) ;
48  KLU_free (Numeric->Offi, nzoff+1, sizeof (Int), Common) ;
49  KLU_free (Numeric->Offx, nzoff+1, sizeof (Entry), Common) ;
50 
51  KLU_free (Numeric->Lip, n, sizeof (Int), Common) ;
52  KLU_free (Numeric->Llen, n, sizeof (Int), Common) ;
53  KLU_free (Numeric->Uip, n, sizeof (Int), Common) ;
54  KLU_free (Numeric->Ulen, n, sizeof (Int), Common) ;
55 
56  KLU_free (Numeric->LUsize, nblocks, sizeof (size_t), Common) ;
57 
58  KLU_free (Numeric->LUbx, nblocks, sizeof (Unit *), Common) ;
59 
60  KLU_free (Numeric->Udiag, n, sizeof (Entry), Common) ;
61 
62  KLU_free (Numeric->Rs, n, sizeof (double), Common) ;
63  KLU_free (Numeric->Pinv, n, sizeof (Int), Common) ;
64 
65  KLU_free (Numeric->Work, Numeric->worksize, 1, Common) ;
66 
67  KLU_free (Numeric, 1, sizeof (KLU_numeric), Common) ;
68 
69  *NumericHandle = NULL ;
70  return (TRUE) ;
71 }
Int KLU_free_numeric(KLU_numeric **NumericHandle, KLU_common *Common)
#define Int
#define FALSE
double Unit
#define NULL
#define KLU_numeric
#define KLU_common
#define Entry
int n
#define TRUE
#define KLU_free