Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
klu2_free_symbolic.hpp
1 /* ========================================================================== */
2 /* === KLU_free_symbolic ==================================================== */
3 /* ========================================================================== */
4 // @HEADER
5 // *****************************************************************************
6 // KLU2: A Direct Linear Solver package
7 //
8 // Copyright 2011 NTESS and the KLU2 contributors.
9 // SPDX-License-Identifier: LGPL-2.1-or-later
10 // *****************************************************************************
11 // @HEADER
12 
13 /* Free the KLU Symbolic object. */
14 
15 #ifndef KLU2_FREE_SYMBOLIC_HPP
16 #define KLU2_FREE_SYMBOLIC_HPP
17 
18 #include "klu2_internal.h"
19 #include "klu2_memory.hpp"
20 
21 template <typename Entry, typename Int>
22 Int KLU_free_symbolic
23 (
24  KLU_symbolic<Entry, Int> **SymbolicHandle,
25  KLU_common<Entry, Int> *Common
26 )
27 {
28  KLU_symbolic<Entry, Int> *Symbolic ;
29  Int n ;
30  if (Common == NULL)
31  {
32  return (FALSE) ;
33  }
34  if (SymbolicHandle == NULL || *SymbolicHandle == NULL)
35  {
36  return (TRUE) ;
37  }
38  Symbolic = *SymbolicHandle ;
39  n = Symbolic->n ;
40  KLU_free (Symbolic->P, n, sizeof (Int), Common) ;
41  KLU_free (Symbolic->Q, n, sizeof (Int), Common) ;
42  KLU_free (Symbolic->R, n+1, sizeof (Int), Common) ;
43  KLU_free (Symbolic->Lnz, n, sizeof (double), Common) ; /* TODO: Entry ?? */
44  KLU_free (Symbolic, 1, sizeof (KLU_symbolic<Entry, Int>), Common) ;
45  *SymbolicHandle = NULL ;
46  return (TRUE) ;
47 }
48 
49 #endif