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