SMG2S
Sparse Matrix Generator with Given Spectrum
initMat.hpp
1 /*
2 MIT License
3 Copyright (c) 2019 Xinzhe WU @ Maison de la Simulation, France
4 Copyright (c) 2019-2022, Xinzhe Wu @ Simulation and Data Laboratory Quantum
5  Materials, Forschungszentrum Juelich GmbH.
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 The above copyright notice and this permission notice shall be included in all
14 copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 SOFTWARE.
22 */
23 
24 #ifndef __INIT_MAT_H__
25 #define __INIT_MAT_H__
26 
31 
41 template<typename S>
42 struct initMat
43 {
47  S diag_l;
51  S diag_u;
55  double scale;
59  double sparsity;
60 
62 
67  diag_l = -3;
68  diag_u = -2;
69  scale = 1.0;
70  sparsity = 0.9;
71  };
72 
74 
80  initMat(S diagl, S diagu){
81  diag_l = diagl;
82  diag_u = diagu;
83  scale = 1.0;
84  sparsity = 0.9;
85  };
86 
88 
95  initMat(S diagl, S diagu, double Sparsity){
96  diag_l = diagl;
97  diag_u = diagu;
98  scale = 1.0;
99  sparsity = Sparsity;
100  };
101 
103 
111  initMat(S diagl, S diagu, double Scale, double Sparsity){
112  diag_l = diagl;
113  diag_u = diagu;
114  scale = Scale;
115  sparsity = Sparsity;
116  };
117 
119 
122  void show(){
123  std::cout << "Init Mat parameters:" << std::endl;
124  std::cout << " diag_l: " << diag_l << ", diag_u: " << diag_u << ", scale: " << scale << ", sparsity: " << sparsity << std::endl;
125  };
126 
127 };
128  // end of group4
130 
131 #endif
initMat::initMat
initMat(S diagl, S diagu, double Sparsity)
A constructor of struct `initMat`.
Definition: initMat.hpp:95
initMat::sparsity
double sparsity
Definition: initMat.hpp:59
initMat::diag_l
S diag_l
Definition: initMat.hpp:47
initMat::show
void show()
A member function of struct `initMat` to display all its variables.
Definition: initMat.hpp:122
initMat::scale
double scale
Definition: initMat.hpp:55
initMat
A struct which stores the information for the initial input matrix of SMG2S.
Definition: initMat.hpp:42
initMat::diag_u
S diag_u
Definition: initMat.hpp:51
initMat::initMat
initMat(S diagl, S diagu)
A constructor of struct `initMat`.
Definition: initMat.hpp:80
initMat::initMat
initMat(S diagl, S diagu, double Scale, double Sparsity)
A constructor of struct `initMat`.
Definition: initMat.hpp:111
initMat::initMat
initMat()
A constructor of struct `initMat`.
Definition: initMat.hpp:66