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 Basker{
35 
36  template <class Int, class Entry>
37  class Basker
38  {
39 
40  public:
41  Basker();
42  Basker(Int nnzL, Int nnzU);
43  ~Basker();
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  //int solve();
52 
53  private:
54  int basker_dfs(
55  Int n,
56  Int j,
57  Int *Li,
58  Int *Lp,
59  Int *color,
60  Int *pattern, /* o/p */
61  Int *top, /* o/p */
62 
63  Int *tpinv,
64  Int *stack
65  );
66  void free_factor();
67  void free_perm_matrix();
68  int low_tri_solve_csc(Int n, Int* col_ptr, Int *row_idx, Entry *val, Entry *x, Entry *b);
69  int up_tri_solve_csc(Int n, Int* col_ptr, Int *row_idx, Entry *val, Entry *x, Entry *b);
70  int permute_row(Int *p, basker_matrix<Int,Entry> *B);
71  int permute_column(Int *p, basker_matrix<Int, Entry> *B);
72  int sort_factors();
73  Entry* entry_realloc(Entry *old, Int old_size, Int new_size);
74  Int* int_realloc(Int *old, Int old_size, Int new_size);
75  basker_matrix<Int, Entry> *A;
76  basker_matrix<Int, Entry> *L;
77  basker_matrix<Int, Entry> *U;
78  Int *in_perm;
79  Int *pinv;
80  bool been_fact;
81  bool perm_flag;
82 
83  };
84 
85 }/*End namespace*/
86 #endif
Definition: basker.cpp:35