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