44 #include "klu2_internal.h" 
   45 #include "klu2_memory.hpp" 
   53 template <
typename Entry, 
typename Int>
 
   54 static void sort (Int n, Int *Xip, Int *Xlen, Unit *LU, Int *Tp, Int *Tj,
 
   59     Int p, i, j, len, nz, tp, xlen, pend ;
 
   61     ASSERT (KLU_valid_LU (n, FALSE, Xip, Xlen, LU)) ;
 
   64     for (i = 0 ; i < n ; i++)
 
   68     for (j = 0 ; j < n ; j++)
 
   70         GET_POINTER (LU, Xip, Xlen, Xi, Xx, j, len) ;
 
   71         for (p = 0 ; p < len ; p++)
 
   79     for (i = 0 ; i < n ; i++)
 
   85     for (i = 0 ; i < n ; i++)
 
   91     for (j = 0 ; j < n ; j++)
 
   93         GET_POINTER (LU, Xip, Xlen, Xi, Xx, j, len) ;
 
   94         for (p = 0 ; p < len ; p++)
 
  103     for (j = 0 ; j < n ; j++)
 
  107     for (i = 0 ; i < n ; i++)
 
  110         for (p = Tp [i] ; p < pend ; p++)
 
  113             GET_POINTER (LU, Xip, Xlen, Xi, Xx, j, len) ;
 
  120     ASSERT (KLU_valid_LU (n, FALSE, Xip, Xlen, LU)) ;
 
  128 template <
typename Entry, 
typename Int>
 
  131     KLU_symbolic<Entry, Int> *Symbolic,
 
  132     KLU_numeric<Entry, Int> *Numeric,
 
  133     KLU_common<Entry, Int> *Common
 
  136     Int *R, *W, *Tp, *Ti, *Lip, *Uip, *Llen, *Ulen ;
 
  139     Int n, nk, nz, block, nblocks, maxblock, k1 ;
 
  146     Common->status = KLU_OK ;
 
  150     nblocks = Symbolic->nblocks ;
 
  151     maxblock = Symbolic->maxblock ;
 
  154     Llen = Numeric->Llen ;
 
  156     Ulen = Numeric->Ulen ;
 
  157     LUbx = (Unit **) Numeric->LUbx ;
 
  159     m1 = ((
size_t) maxblock) + 1 ;
 
  162     nz = MAX (Numeric->max_lnz_block, Numeric->max_unz_block) ;
 
  163     W  = (Int *) KLU_malloc (maxblock, 
sizeof (Int), Common) ;
 
  164     Tp = (Int *) KLU_malloc (m1, 
sizeof (Int), Common) ;
 
  165     Ti = (Int *) KLU_malloc (nz, 
sizeof (Int), Common) ;
 
  166     Tx = (Entry *) KLU_malloc (nz, 
sizeof (Entry), Common) ;
 
  168     PRINTF ((
"\n======================= Start sort:\n")) ;
 
  170     if (Common->status == KLU_OK)
 
  173         for (block = 0 ; block < nblocks ; block++)
 
  176             nk = R [block+1] - k1 ;
 
  179                 PRINTF ((
"\n-------------------block: %d nk %d\n", block, nk)) ;
 
  180                 sort (nk, Lip + k1, Llen + k1, LUbx [block], Tp, Ti, Tx, W) ;
 
  181                 sort (nk, Uip + k1, Ulen + k1, LUbx [block], Tp, Ti, Tx, W) ;
 
  186     PRINTF ((
"\n======================= sort done.\n")) ;
 
  189     KLU_free (W, maxblock, 
sizeof (Int), Common) ;
 
  190     KLU_free (Tp, m1, 
sizeof (Int), Common) ;
 
  191     KLU_free (Ti, nz, 
sizeof (Int), Common) ;
 
  192     KLU_free (Tx, nz, 
sizeof (Entry), Common) ;
 
  193     return (Common->status == KLU_OK) ;