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 <<
"," <<
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; }
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 <<
"#dgsmatrix " <<
m <<
" " <<
n <<
" " <<
data.size() << std::endl;
63 const std::vector<dcomponent>::const_iterator data_end =
data.end();
64 for(std::vector<dcomponent>::const_iterator it=
data.begin(); it!=data_end; it++){
65 ofs << it->i <<
" " << it->j <<
" " << it->v << std::endl;
void write(const char *) const
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
CPPL_INT n
matrix column size
_dgematrix i(const _dgbmatrix &mat)
double operator()(const CPPL_INT &, const CPPL_INT &) const
(DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class
CPPL_INT m
matrix row size
std::ostream & operator<<(std::ostream &s, const _dgsmatrix &mat)
std::vector< dcomponent > data
matrix data