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