CPPLapack
 All Classes Files Functions Variables Friends Pages
dssmatrix-cast.hpp
Go to the documentation of this file.
1 //=============================================================================
2 /*! cast to _zhsmatrix */
4 {CPPL_VERBOSE_REPORT;
5  zhsmatrix newmat(n,CPPL_INT(data.size()));
6 
7  const std::vector<dcomponent>::const_iterator data_end =data.end();
8  for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){
9  newmat.put(it->i, it->j, comple(it->v,0.0));
10  }
11 
12  return _(newmat);
13 }
14 
15 ///////////////////////////////////////////////////////////////////////////////
16 ///////////////////////////////////////////////////////////////////////////////
17 ///////////////////////////////////////////////////////////////////////////////
18 
19 //=============================================================================
20 /*! convert to _dgematrix */
22 {CPPL_VERBOSE_REPORT;
23  dgematrix newmat(m,n);
24  newmat.zero();
25 
26  const std::vector<dcomponent>::const_iterator data_end =data.end();
27  for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){
28  newmat(it->i, it->j) =it->v;
29  newmat(it->j, it->i) =it->v;
30  }
31 
32  return _(newmat);
33 }
34 
35 //=============================================================================
36 /*! convert to _dsymatrix */
38 {CPPL_VERBOSE_REPORT;
39  dsymatrix newmat(n);
40  newmat.zero();
41 
42  const std::vector<dcomponent>::const_iterator data_end =data.end();
43  for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){
44  newmat(it->i, it->j) =it->v;
45  }
46 
47  return _(newmat);
48 }
49 
50 //=============================================================================
51 /*! convert to _dgsmatrix */
53 {CPPL_VERBOSE_REPORT;
54  dgsmatrix newmat( dgsmatrix(m,n,CPPL_INT(data.size()*2)) );
55  newmat.zero();
56 
57  const std::vector<dcomponent>::const_iterator data_end =data.end();
58  for(std::vector<dcomponent>::const_iterator it=data.begin(); it!=data_end; it++){
59  newmat.put(it->i, it->j, it->v);
60  if(it->i!=it->j){
61  newmat.put(it->j, it->i, it->v);
62  }
63  }
64 
65  return _(newmat);
66 }
std::vector< dcomponent > data
matrix data
Definition: dssmatrix.hpp:11
Real Double-precision General Sparse Matrix Class.
Definition: dgsmatrix.hpp:3
_dgsmatrix to_dgsmatrix() const
_dgematrix to_dgematrix() const
zhsmatrix & put(const CPPL_INT &, const CPPL_INT &, const comple &)
dsymatrix & zero()
_zhsmatrix to_zhsmatrix() const
dgematrix & zero()
Real Double-precision General Dence Matrix Class.
Definition: dgematrix.hpp:3
Real Double-precision Symmetric Matrix Class [l-type (UPLO=l) Strage].
Definition: dsymatrix.hpp:3
(DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class
Definition: _dgsmatrix.hpp:3
(DO NOT USE) Smart-temporary Real Double-precision General Dence Matrix Class
Definition: _dgematrix.hpp:3
dgsmatrix & zero()
Complex Double-precision Hermitian Sparse Matrix Class.
Definition: zhsmatrix.hpp:3
_dsymatrix to_dsymatrix() const
(DO NOT USE) Smart-temporary Real Double-precision Symmetric Matrix Class
Definition: _dsymatrix.hpp:3
friend _dssmatrix _(dssmatrix &)
CPPL_INT n
matrix column size
Definition: dssmatrix.hpp:10
CPPL_INT const & m
matrix row size
Definition: dssmatrix.hpp:9
(DO NOT USE) Smart-temporary Complex Double-precision Hermitian Sparse Matrix Class ...
Definition: _zhsmatrix.hpp:3