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 <<
"," <<
n <<
")." << std::endl;
15 const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j));
17 const std::vector<CPPL_INT>::iterator line_ii_end =
line[ii].end();
18 for(std::vector<CPPL_INT>::iterator p=
line[ii].begin(); p!=line_ii_end; p++){
19 if(
data[*p].i==ii &&
data[*p].j==jj){
return data[*p].v; }
33 for(CPPL_INT
i=0;
i<mat.
n;
i++){
34 for(CPPL_INT j=0; j<mat.
n; j++){
36 std::vector<CPPL_INT>::iterator q;
37 const std::vector<CPPL_INT>::iterator mat_line_i_end =mat.
line[
i].end();
38 for(q=mat.
line[
i].begin(); q!=mat_line_i_end; q++){
39 if(mat.
data[*q].j==j){
break; }
41 if(q!=mat_line_i_end){ s <<
" " << mat.
data[*q].v <<
" "; }
45 std::vector<CPPL_INT>::iterator q;
46 const std::vector<CPPL_INT>::iterator mat_line_i_end =mat.
line[
i].end();
47 for(q=mat.
line[
i].begin(); q!=mat_line_i_end; q++){
48 if(mat.
data[*q].j==j){
break; }
50 if(q!=mat_line_i_end){ s <<
"{" << mat.
data[*q].v <<
"}"; }
68 std::ofstream ofs(filename, std::ios::trunc);
69 ofs.setf(std::cout.flags());
70 ofs.precision(std::cout.precision());
71 ofs.width(std::cout.width());
72 ofs.fill(std::cout.fill());
74 ofs <<
"#dssmatrix " <<
n <<
" " <<
data.size() << std::endl;
76 const std::vector<dcomponent>::const_iterator data_end =
data.end();
77 for(std::vector<dcomponent>::const_iterator it=
data.begin(); it!=data_end; it++){
78 ofs << it->i <<
" " << it->j <<
" " << it->v << std::endl;
std::vector< dcomponent > data
matrix data
(DO NOT USE) Smart-temporary Real Double-precision Symmetric Sparse Matrix Class
_dgematrix i(const _dgbmatrix &mat)
void write(const char *) const
std::ostream & operator<<(std::ostream &s, const _dssmatrix &mat)
CPPL_INT n
matrix column size
std::vector< std::vector< CPPL_INT > > line
vector of vector to store the entry information of component for each row and column ...
double operator()(const CPPL_INT &, const CPPL_INT &) const