CPPLapack
 All Classes Files Functions Variables Friends Pages
dgsmatrix-constructor.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! dgsmatrix 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 /*! dgsmatrix copy constructor */
19 inline dgsmatrix::dgsmatrix(const dgsmatrix& 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 /*! dgsmatrix constructor to cast _dgsmatrix */
31 inline dgsmatrix::dgsmatrix(const _dgsmatrix& 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 /*! dgsmatrix constructor with size specification */
52 inline dgsmatrix::dgsmatrix(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 /*! dgsmatrix constructor with filename */
74 inline dgsmatrix::dgsmatrix(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 /*! dgsmatrix destructor */
91 {CPPL_VERBOSE_REPORT;
92  data.clear();
93  rows.clear();
94  cols.clear();
95 }
Real Double-precision General Sparse Matrix Class.
Definition: dgsmatrix.hpp:3
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: _dgsmatrix.hpp:13
void copy(const dgsmatrix &)
std::vector< dcomponent > data
matrix data
Definition: dgsmatrix.hpp:11
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: _dgsmatrix.hpp:12
CPPL_INT n
matrix column size
Definition: _dgsmatrix.hpp:10
CPPL_INT n
matrix column size
Definition: dgsmatrix.hpp:10
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Definition: dgsmatrix.hpp:13
(DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class
Definition: _dgsmatrix.hpp:3
CPPL_INT m
matrix row size
Definition: _dgsmatrix.hpp:9
void nullify() const
std::vector< dcomponent > data
matrix data
Definition: _dgsmatrix.hpp:11
void read(const char *)
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
Definition: dgsmatrix.hpp:12
CPPL_INT m
matrix row size
Definition: dgsmatrix.hpp:9