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