39 #ifndef KLU2_FREE_NUMERIC_HPP 
   40 #define KLU2_FREE_NUMERIC_HPP 
   42 #include "klu2_internal.h" 
   43 #include "klu2_memory.hpp" 
   45 template <
typename Entry, 
typename Int>
 
   48     KLU_numeric<Entry, Int> **NumericHandle,
 
   49     KLU_common<Entry, Int>  *Common
 
   52     KLU_numeric<Entry, Int> *Numeric ;
 
   55     Int block, n, nzoff, nblocks ;
 
   61     if (NumericHandle == NULL || *NumericHandle == NULL)
 
   66     Numeric = *NumericHandle ;
 
   69     nzoff = Numeric->nzoff ;
 
   70     nblocks = Numeric->nblocks ;
 
   71     LUsize = Numeric->LUsize ;
 
   73     LUbx = (Unit **) Numeric->LUbx ;
 
   76         for (block = 0 ; block < nblocks ; block++)
 
   78             KLU_free (LUbx [block], LUsize ? LUsize [block] : 0,
 
   79                 sizeof (Unit), Common) ;
 
   83     KLU_free (Numeric->Pnum, n, sizeof (Int), Common) ;
 
   84     KLU_free (Numeric->Offp, n+1, sizeof (Int), Common) ;
 
   85     KLU_free (Numeric->Offi, nzoff+1, sizeof (Int), Common) ;
 
   86     KLU_free (Numeric->Offx, nzoff+1, sizeof (Entry), Common) ;
 
   88     KLU_free (Numeric->Lip,  n, sizeof (Int), Common) ;
 
   89     KLU_free (Numeric->Llen, n, sizeof (Int), Common) ;
 
   90     KLU_free (Numeric->Uip,  n, sizeof (Int), Common) ;
 
   91     KLU_free (Numeric->Ulen, n, sizeof (Int), Common) ;
 
   93     KLU_free (Numeric->LUsize, nblocks, sizeof (
size_t), Common) ;
 
   95     KLU_free (Numeric->LUbx, nblocks, sizeof (Unit *), Common) ;
 
   97     KLU_free (Numeric->Udiag, n, sizeof (Entry), Common) ;
 
   99     KLU_free (Numeric->Rs,   n, sizeof (
double), Common) ;
 
  100     KLU_free (Numeric->Pinv, n, sizeof (Int), Common) ;
 
  102     KLU_free (Numeric->Work, Numeric->worksize, 1, Common) ;
 
  104     KLU_free (Numeric, 1, 
sizeof (KLU_numeric<Entry, Int>), Common) ;
 
  106     *NumericHandle = NULL ;