15 #ifndef KLU2_FREE_NUMERIC_HPP
16 #define KLU2_FREE_NUMERIC_HPP
18 #include "klu2_internal.h"
19 #include "klu2_memory.hpp"
21 template <
typename Entry,
typename Int>
24 KLU_numeric<Entry, Int> **NumericHandle,
25 KLU_common<Entry, Int> *Common
28 KLU_numeric<Entry, Int> *Numeric ;
31 Int block, n, nzoff, nblocks ;
37 if (NumericHandle == NULL || *NumericHandle == NULL)
42 Numeric = *NumericHandle ;
45 nzoff = Numeric->nzoff ;
46 nblocks = Numeric->nblocks ;
47 LUsize = Numeric->LUsize ;
49 LUbx = (Unit **) Numeric->LUbx ;
52 for (block = 0 ; block < nblocks ; block++)
54 KLU_free (LUbx [block], LUsize ? LUsize [block] : 0,
55 sizeof (Unit), Common) ;
59 KLU_free (Numeric->Pnum, n, sizeof (Int), Common) ;
60 KLU_free (Numeric->Offp, n+1, sizeof (Int), Common) ;
61 KLU_free (Numeric->Offi, nzoff+1, sizeof (Int), Common) ;
62 KLU_free (Numeric->Offx, nzoff+1, sizeof (Entry), Common) ;
64 KLU_free (Numeric->Lip, n, sizeof (Int), Common) ;
65 KLU_free (Numeric->Llen, n, sizeof (Int), Common) ;
66 KLU_free (Numeric->Uip, n, sizeof (Int), Common) ;
67 KLU_free (Numeric->Ulen, n, sizeof (Int), Common) ;
69 KLU_free (Numeric->LUsize, nblocks, sizeof (
size_t), Common) ;
71 KLU_free (Numeric->LUbx, nblocks, sizeof (Unit *), Common) ;
73 KLU_free (Numeric->Udiag, n, sizeof (Entry), Common) ;
75 KLU_free (Numeric->Rs, n, sizeof (
double), Common) ;
76 KLU_free (Numeric->Pinv, n, sizeof (Int), Common) ;
78 KLU_free (Numeric->Work, Numeric->worksize, 1, Common) ;
80 KLU_free (Numeric, 1,
sizeof (KLU_numeric<Entry, Int>), Common) ;
82 *NumericHandle = NULL ;