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