Amesos2 - Direct Sparse Solver Interfaces  Version of the Day
basker_decl.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Basker: A Direct Linear Solver package
5 // Copyright 2011 Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, with Sandia Corporation, the
8 // U.S. Government retains certain rights in this software.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // USA
24 // Questions? Contact Mike A. Heroux (maherou@sandia.gov)
25 //
26 // ***********************************************************************
27 // @HEADER
28 
29 #ifndef BASKER_DECL_HPP
30 #define BASKER_DECL_HPP
31 
32 #include "basker_types.hpp"
33 
34 namespace BaskerClassicNS{
35 
36  template <class Int, class Entry>
37  class BaskerClassic
38  {
39 
40  public:
41  BaskerClassic();
42  BaskerClassic(Int nnzL, Int nnzU);
43  ~BaskerClassic();
44  int preorder(Int *row_perm, Int *col_perm);
45  int factor(Int nrow, Int ncol , Int nnz, Int *col_ptr, Int *row_idx, Entry *val);
46  int returnL(Int *dim, Int *nnz, Int **col_ptr, Int **row_idx, Entry **val);
47  int returnU(Int *dim, Int *nnz, Int **col_ptr, Int **row_idx, Entry **val);
48  int returnP(Int **p);
49  int solve( Entry* b, Entry* x);
50  int solveMultiple(Int nrhs, Entry *b, Entry *x);
51 
52  Int get_NnzL();
53  Int get_NnzU();
54  Int get_NnzLU();
55  //int solve();
56 
57  private:
58  int basker_dfs(
59  Int n,
60  Int j,
61  Int *Li,
62  Int *Lp,
63  Int *color,
64  Int *pattern, /* o/p */
65  Int *top, /* o/p */
66 
67  Int *tpinv,
68  Int *stack
69  );
70  void free_factor();
71  void free_perm_matrix();
72  int low_tri_solve_csc(Int n, Int* col_ptr, Int *row_idx, Entry *val, Entry *x, Entry *b);
73  int up_tri_solve_csc(Int n, Int* col_ptr, Int *row_idx, Entry *val, Entry *x, Entry *b);
74  int permute_row(Int *p, basker_matrix<Int,Entry> *B);
75  int permute_column(Int *p, basker_matrix<Int, Entry> *B);
76  int sort_factors();
77  Entry* entry_realloc(Entry *old, Int old_size, Int new_size);
78  Int* int_realloc(Int *old, Int old_size, Int new_size);
79  basker_matrix<Int, Entry> *A;
80  basker_matrix<Int, Entry> *L;
81  basker_matrix<Int, Entry> *U;
82  Int *in_perm;
83  Int *pinv;
84  Int actual_lnnz;
85  Int actual_unnz;
86  bool been_fact;
87  bool perm_flag;
88 
89  };
90 
91 }/*End namespace*/
92 #endif