My Project
zgbmatrix-constructor.hpp
1 //============================================================================
4  : m(M), n(N), kl(KL), ku(KU), array(Array), darray(Darray)
5 {
6 #ifdef CPPL_VERBOSE
7  std::cerr << "# [MARK] zgbmatrix::zgbmatrix()"
8  << std::endl;
9 #endif//CPPL_VERBOSE
10 
12  M =0;
13  N =0;
14  KL =0;
15  KU =0;
16  Array =NULL;
17  Darray =NULL;
18 
19 #ifdef CPPL_DEBUG
20  std::cerr << "# [NOTE] zgbmatrix::zgbmatrix() "
21  << "A new 0x0:0,0 matrix at " << Array << " has been made."
22  << std::endl;
23 #endif//CPPL_DEBUG
24 }
25 
26 //============================================================================
28 inline zgbmatrix::zgbmatrix(const zgbmatrix& mat)
29  : m(M), n(N), kl(KL), ku(KU), array(Array), darray(Darray)
30 {
31 #ifdef CPPL_VERBOSE
32  std::cerr << "# [MARK] zgbmatrix::zgbmatrix(const zgbmatrix&)"
33  << std::endl;
34 #endif//CPPL_VERBOSE
35 
37  M =mat.M;
38  N =mat.N;
39  KL =mat.KL;
40  KU =mat.KU;
41  Array =new std::complex<double>[(KL+KU+1)*N];
42  Darray =new std::complex<double>*[N];
43  for(int i=0; i<N; i++){ Darray[i] =&Array[i*(KL+KU+1)]; }
44 
46  zcopy_((KL+KU+1)*N, mat.Array, 1, Array, 1);
47 
48 #ifdef CPPL_DEBUG
49  std::cerr << "# [NOTE] zgbmatrix::zgbmatrix(const zgbmatrix&) "
50  << "A new matrix at " << Array << " has been made." << std::endl;
51 #endif//CPPL_DEBUG
52 }
53 
54 //============================================================================
56 inline zgbmatrix::zgbmatrix(const _zgbmatrix& mat)
57  : m(M), n(N), kl(KL), ku(KU), array(Array), darray(Darray)
58 {
59 #ifdef CPPL_VERBOSE
60  std::cerr << "# [MARK] zgbmatrix::zgbmatrix(const _zgbmatrix&)"
61  << std::endl;
62 #endif//CPPL_VERBOSE
63 
64  M =mat.M;
65  N =mat.N;
66  KL =mat.KL;
67  KU =mat.KU;
68  Array =mat.Array;
69  Darray =mat.Darray;
70 
71 #ifdef CPPL_DEBUG
72  std::cerr << "# [NOTE] zgbmatrix::zgbmatrix(const zgbmatrix&) "
73  << "A new matrix at " << Array << " has been made." << std::endl;
74 #endif//CPPL_DEBUG
75 }
76 
77 //============================================================================
79 inline zgbmatrix::zgbmatrix(const long& _m, const long& _n,
80  const long& _kl, const long& _ku)
81  : m(M), n(N), kl(KL), ku(KU), array(Array), darray(Darray)
82 {
83 #ifdef CPPL_VERBOSE
84  std::cerr << "# [MARK] zgbmatrix::zgbmatrix(const long&, const long&, const long&, const long&)"
85  << std::endl;
86 #endif//CPPL_VERBOSE
87 
88 #ifdef CPPL_DEBUG
89  if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){
90  std::cerr << "[ERROR] zgbmatrix::zgbmatrix"
91  << "(const long, const long, const long const long)"
92  << std::endl
93  << "It is impossible to make a matrix you ordered. "
94  << std::endl
95  << "Your input was ("
96  << _m << "," << _n << ","<< _ku << "," << _kl << ")."
97  << std::endl;
98  exit(1);
99  }
100 #endif//CPPL_DEBUG
101 
103  M =_m;
104  N =_n;
105  KL =_kl;
106  KU =_ku;
107  Array =new std::complex<double>[(KL+KU+1)*N];
108  Darray =new std::complex<double>*[N];
109  for(int i=0; i<N; i++){ Darray[i] =&Array[i*(KL+KU+1)]; }
110 
111 #ifdef CPPL_DEBUG
112  std::cerr << "# [NOTE] zgbmatrix::zgbmatrix"
113  << "(const long&, const long&, const long&,const long&) "
114  << "A new matrix at " << Array << " has been made." << std::endl;
115 #endif//CPPL_DEBUG
116 }
117 
118 //============================================================================
120 inline zgbmatrix::zgbmatrix(const char* filename)
121  : m(M), n(N), kl(KL), ku(KU), array(Array), darray(Darray)
122 {
123 #ifdef CPPL_VERBOSE
124  std::cerr << "# [MARK] zgbmatrix::zgbmatrix(const char*)"
125  << std::endl;
126 #endif//CPPL_VERBOSE
127 
128  Array =NULL;
129  Darray =NULL;
130 
132  read(filename);
133 
134 #ifdef CPPL_DEBUG
135  std::cerr << "# [NOTE] zgbmatrix::zgbmatrix(const char*) "
136  << "A new matrix at " << Array << " has been made." << std::endl;
137 #endif//CPPL_DEBUG
138 }
139 
143 
144 //============================================================================
147 {
148 #ifdef CPPL_VERBOSE
149  std::cerr << "# [MARK] zgbmatrix::~zgbmatrix()"
150  << std::endl;
151 #endif//CPPL_VERBOSE
152 
153 #ifdef CPPL_DEBUG
154  std::cerr << "# [NOTE] zgbmatrix::~zgbmatrix() "
155  << "A matrix at " << Array
156  << " is going to be deleted." << std::endl;
157 #endif//CPPL_DEBUG
158 
160  delete [] Array;
161  delete [] Darray;
162 }
std::complex< double > * Array
1D Array to store matrix data
Definition: _zgbmatrix.hpp:11
friend _zgematrix i(const zgbmatrix &)
Definition: zgbmatrix-calc.hpp:22
long N
matrix column size
Definition: _zgbmatrix.hpp:8
long KU
upper band width
Definition: _zgbmatrix.hpp:10
zgbmatrix()
Definition: zgbmatrix-constructor.hpp:3
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
long M
matrix row size
Definition: _zgbmatrix.hpp:7
(DO NOT USE) Smart-temporary Complex Double-precision General Band Matrix Class
Definition: _zgbmatrix.hpp:3
std::complex< double > ** Darray
array of pointers of column head addresses
Definition: _zgbmatrix.hpp:12
long KL
lower band width
Definition: _zgbmatrix.hpp:9
~zgbmatrix()
Definition: zgbmatrix-constructor.hpp:146
std::complex< double > * Array
1D Array to store vector data
Definition: _zrovector.hpp:8