Greens-code
A modular quantum transport code
supermatrix_superLU.hpp
1 #ifndef SUPER_SUPER_LU_HPP
2 #define SUPER_SUPER_LU_HPP
3 
4 #include "supermatrix.hpp"
5 
6 #ifdef USE_SUPERLU_DIST
7 # include "superlu_zdefs.h"
8 #else
9 # include "slu_zdefs.h"
10 #endif
11 
12 /*-----------------*
13  * BAKED STRATEGY *
14  *-----------------*/
15 
17  std::unique_ptr<SuperMatrix> A;
18 
19  NCformat* Astore(){
20  return reinterpret_cast<NCformat*>(A->Store);};
21  NCformat const * Astore() const{
22  return reinterpret_cast<NCformat*>(A->Store);};
23 
24 public:
25 
27  std::unique_ptr<SuperMatrix> a);
29 
30  void Insert(row, column, complex){
31  fail("Insert not valid in Baked Phase!\n");};
32  void Add(row, column, complex);
33  complex Get(row, column) const;
34 
35  void Apply(const complex*,
36  complex*) const;
37  void Apply( complex*) const;
38  void Output(std::ostream& os) const;
39 
40  status my_status() const{return Baked;};
41 
42  std::unique_ptr<SuperMatrix> release(){ return A;};
43 };
44 
45 class super_Matrix_SetUp;
46 class matrix_factory{
47 public:
48  static std::unique_ptr<SuperMatrix> get(const super_Matrix_SetUp&);
49 };
50 
51 #ifdef USE_SUPERLU_DIST
52 
53 /*--------------------------*
54  * DIST FACTORIZED STRATEGY *
55  *--------------------------*/
56 
58 
59  std::unique_ptr<int> perm_c;
60  std::unique_ptr<int> perm_r;
61  std::unique_ptr<SuperMatrix> A;
62 
63 
64  superlu_options_t options;
65  LUstruct_t LU;
66  gridinfo_t grid;
67  ScalePermstruct_t ScalePermstruct;
68  double *berr;
69  doublecomplex *b;
70  int ldb;
71 
72 
73 public:
74  // the second parameter is the superlu supermatrix
75 
77  std::unique_ptr<SuperMatrix>);
79 
80  void Insert(row, column, complex){
81  fail("Insert not valid in Factorized dist Phase!\n");};
82  void Add(row, column, complex){
83  fail("Add not valid in Factorized dist Phase!\n");};
84  complex Get(row, column) const{
85  fail("Get not valid in Factorized dist Phase!\n"); return complex(0.,0.);};
86 
87  void Apply(const complex* phi,
88  complex* result) const;
89  void Apply( complex* result) const;
90  void Output(std::ostream& os) const {
91  fail("Output not valid in Factorized dist Phase!\n");};
92 
93  status my_status() const{return Factorized_dist;};
94 };
95 
96 #else
97 
98 /*----------------------*
99  * FACTORIZED STRATEGY *
100  *----------------------*/
101 
103 
104  std::unique_ptr<SuperMatrix> L;
105  std::unique_ptr<SuperMatrix> U;
106  std::unique_ptr<int> perm_c;
107  std::unique_ptr<int> perm_r;
108 
109  superlu_options_t options;
110  SuperLUStat_t stat;
111 
112 
113 public:
115  std::unique_ptr<SuperMatrix>);
117 
118  void Insert(row, column, complex){
119  fail("Insert not valid in Factorized Phase!\n");};
120  void Add(row, column, complex){
121  fail("Add not valid in Factorized Phase!\n");};
122  complex Get(row, column) const{
123  fail("Get not valid in Factorized Phase!\n"); return complex(0.,0.);};
124 
125  void Apply(const complex* phi,
126  complex* result) const;
127  void Apply( complex* result) const;
128  void Output(std::ostream& os) const {
129  fail("Output not valid in Factorized Phase!\n");};
130 
131  status my_status() const{return Factorized;};
132 };
133 
134 #endif
135 #endif
Definition: supermatrix_MUMPS.hpp:304
General interface to inversion of large, sparse Matrices.
Definition: supermatrix.hpp:106
Definition: supermatrix_MUMPS.hpp:247
Definition: supermatrix.hpp:209
Definition: supermatrix_MUMPS.hpp:200
Definition: supermatrix.hpp:23