CPPLapack
 All Classes Files Functions Variables Friends Pages
zgbmatrix-constructor.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! zgbmatrix constructor */
4 {CPPL_VERBOSE_REPORT;
5  //////// initialize ////////
6  m =0;
7  n =0;
8  kl =0;
9  ku =0;
10  array =NULL;
11  darray =NULL;
12 }
13 
14 ///////////////////////////////////////////////////////////////////////////////
15 ///////////////////////////////////////////////////////////////////////////////
16 ///////////////////////////////////////////////////////////////////////////////
17 
18 //=============================================================================
19 /*! zgbmatrix copy constructor */
20 inline zgbmatrix::zgbmatrix(const zgbmatrix& mat)
21 {CPPL_VERBOSE_REPORT;
22  //////// initialize ////////
23  m =mat.m;
24  n =mat.n;
25  kl =mat.kl;
26  ku =mat.ku;
27  array =new comple[(kl+ku+1)*n];
28  darray =new comple*[n];
29  for(int i=0; i<n; i++){
30  darray[i] =&array[i*(kl+ku+1)];
31  }
32 
33  //////// copy ////////
34  CPPL_INT size =(kl+ku+1)*n;
35  CPPL_INT inc =1;
36  zcopy_(&size, mat.array, &inc, array, &inc);
37 }
38 
39 //=============================================================================
40 /*! zgbmatrix constructor to cast _zgbmatrix */
41 inline zgbmatrix::zgbmatrix(const _zgbmatrix& mat)
42 {CPPL_VERBOSE_REPORT;
43  m =mat.m;
44  n =mat.n;
45  kl =mat.kl;
46  ku =mat.ku;
47  array =mat.array;
48  darray =mat.darray;
49 
50  mat.nullify();
51 }
52 
53 ///////////////////////////////////////////////////////////////////////////////
54 ///////////////////////////////////////////////////////////////////////////////
55 ///////////////////////////////////////////////////////////////////////////////
56 
57 //=============================================================================
58 /*! zgbmatrix constructor with size specification */
59 inline zgbmatrix::zgbmatrix(const CPPL_INT& _m, const CPPL_INT& _n,
60  const CPPL_INT& _kl, const CPPL_INT& _ku)
61 {CPPL_VERBOSE_REPORT;
62 #ifdef CPPL_DEBUG
63  if( _m<0 || _n<0 || _kl<0 || _ku<0 || _m<_kl || _n<_ku ){
64  ERROR_REPORT;
65  std::cerr << "It is impossible to make a matrix you ordered. " << std::endl
66  << "Your input was (" << _m << "," << _n << ","<< _ku << "," << _kl << ")." << std::endl;
67  exit(1);
68  }
69 #endif//CPPL_DEBUG
70 
71  //////// initialize ////////
72  m =_m;
73  n =_n;
74  kl =_kl;
75  ku =_ku;
76  array =new comple[(kl+ku+1)*n];
77  darray =new comple*[n];
78  for(int i=0; i<n; i++){
79  darray[i] =&array[i*(kl+ku+1)];
80  }
81 }
82 
83 //=============================================================================
84 /*! zgbmatrix constructor with filename */
85 inline zgbmatrix::zgbmatrix(const char* filename)
86 {CPPL_VERBOSE_REPORT;
87  array =NULL;
88  darray =NULL;
89 
90  //// read ////
91  read(filename);
92 }
93 
94 ///////////////////////////////////////////////////////////////////////////////
95 ///////////////////////////////////////////////////////////////////////////////
96 ///////////////////////////////////////////////////////////////////////////////
97 
98 //=============================================================================
99 /*! zgbmatrix destructor */
101 {CPPL_VERBOSE_REPORT;
102  //////// delete array ////////
103  delete [] array;
104  delete [] darray;
105 }
CPPL_INT ku
upper band width
Definition: _zgbmatrix.hpp:12
void read(const char *)
friend _zgematrix i(const zgbmatrix &)
CPPL_INT kl
lower band width
Definition: _zgbmatrix.hpp:11
comple ** darray
array of pointers of column head addresses
Definition: zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: zgbmatrix.hpp:10
CPPL_INT ku
upper band width
Definition: zgbmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: zgbmatrix.hpp:9
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3
(DO NOT USE) Smart-temporary Complex Double-precision General Band Matrix Class
Definition: _zgbmatrix.hpp:3
CPPL_INT kl
lower band width
Definition: zgbmatrix.hpp:11
CPPL_INT m
matrix row size
Definition: _zgbmatrix.hpp:9
comple * array
1D array to store matrix data
Definition: _zgbmatrix.hpp:13
void nullify() const
comple ** darray
array of pointers of column head addresses
Definition: _zgbmatrix.hpp:14
CPPL_INT n
matrix column size
Definition: _zgbmatrix.hpp:10
comple * array
1D array to store matrix data
Definition: zgbmatrix.hpp:13