6 if( i<0 || j<0 ||
n<=i ||
n<=j ){
8 std::cerr <<
"The required component is out of the matrix size." << std::endl
9 <<
"Your input is (" << i <<
"," << j <<
"), whereas the matrix size is " <<
n <<
"x" <<
n <<
"." << std::endl;
15 const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j));
17 const std::vector<CPPL_INT>::const_iterator line_ii_end =
line[ii].end();
18 for(std::vector<CPPL_INT>::const_iterator p=
line[ii].begin(); p!=line_ii_end; p++){
20 if( i>j ){
return data[*p].v; }
26 return comple(0.0,0.0);
36 for(CPPL_INT
i=0;
i<mat.
n;
i++){
37 for(CPPL_INT j=0; j<mat.
n; j++){
39 std::vector<CPPL_INT>::iterator q;
40 const std::vector<CPPL_INT>::iterator mat_line_i_end =mat.
line[
i].end();
41 for(q=mat.
line[
i].begin(); q!=mat_line_i_end; q++){
42 if( mat.
data[*q].j==j ){
break; }
44 if(q!=mat_line_i_end){ s <<
" " << mat.
data[*q].v <<
" "; }
48 std::vector<CPPL_INT>::iterator q;
49 const std::vector<CPPL_INT>::iterator mat_line_i_end =mat.
line[
i].end();
50 for(q=mat.
line[
i].begin(); q!=mat_line_i_end; q++){
51 if( mat.
data[*q].j==j ){
break; }
53 if(q!=mat_line_i_end){ s <<
"{" << mat.
data[*q].v <<
"}"; }
71 std::ofstream ofs(filename, std::ios::trunc);
72 ofs.setf(std::cout.flags());
73 ofs.precision(std::cout.precision());
74 ofs.width(std::cout.width());
75 ofs.fill(std::cout.fill());
77 ofs <<
"#zhsmatrix " <<
n <<
" " <<
data.size() << std::endl;
79 const std::vector<zcomponent>::const_iterator data_end =
data.end();
80 for(std::vector<zcomponent>::const_iterator it=
data.begin(); it!=data_end; it++){
81 ofs << it->i <<
" " << it->j <<
" " << it->v << std::endl;
std::vector< zcomponent > data
matrix data
comple operator()(const CPPL_INT &, const CPPL_INT &) const
std::ostream & operator<<(std::ostream &s, const _zhsmatrix &mat)
_dgematrix i(const _dgbmatrix &mat)
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
void write(const char *) const
std::vector< std::vector< CPPL_INT > > line
vector of vector to store the entry information of component for each row and column ...
(DO NOT USE) Smart-temporary Complex Double-precision Hermitian Sparse Matrix Class ...