6 if( i<0 || j<0 ||
m<=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 " <<
m <<
"x" <<
n <<
"." << std::endl;
15 const std::vector<CPPL_INT>::iterator rows_i_end =
rows[
i].end();
16 for(std::vector<CPPL_INT>::iterator p=
rows[i].begin(); p!=rows_i_end; p++){
17 if(
data[*p].j==j ){
return data[*p].v; }
21 return comple(0.0,0.0);
31 for(CPPL_INT
i=0;
i<mat.
m;
i++){
32 for(CPPL_INT j=0; j<mat.
n; j++){
33 std::vector<CPPL_INT>::iterator q;
34 const std::vector<CPPL_INT>::iterator mat_rows_i_end =mat.
rows[
i].end();
35 for(q=mat.
rows[
i].begin(); q!=mat_rows_i_end; q++){
36 if( mat.
data[*q].j==j ){
break; }
38 if(q!=mat_rows_i_end){ s <<
" " << mat.
data[*q].v; }
55 std::ofstream ofs(filename, std::ios::trunc);
56 ofs.setf(std::cout.flags());
57 ofs.precision(std::cout.precision());
58 ofs.width(std::cout.width());
59 ofs.fill(std::cout.fill());
61 ofs <<
"#zgsmatrix " <<
m <<
" " <<
n <<
" " <<
data.size() << std::endl;
63 const std::vector<zcomponent>::const_iterator data_end =
data.end();
64 for(std::vector<zcomponent>::const_iterator it=
data.begin(); it!=data_end; it++){
65 ofs << it->i <<
" " << it->j <<
" " << it->v << std::endl;
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
std::ostream & operator<<(std::ostream &s, const _zgsmatrix &mat)
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
(DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class
comple operator()(const CPPL_INT &, const CPPL_INT &) const
CPPL_INT m
matrix row size
void write(const char *) const
std::vector< zcomponent > data
matrix data