15 for(CPPL_INT
i=0;
i<
n;
i++){
line[
i].resize(0); }
24 for(CPPL_INT
i=0;
i<
n;
i++){
34 const std::vector<dcomponent>::iterator data_end =
data.end();
35 for(std::vector<dcomponent>::iterator it=
data.begin(); it!=data_end; it++){
69 if( _n<0 || _c<0 || _l<0 ){
71 std::cerr <<
"Matrix sizes, the length of arrays, and line size must be positive integers. " << std::endl
72 <<
"Your input was (" << _n <<
"," << _c <<
"," << _l <<
")." << std::endl;
81 for(CPPL_INT
i=0;
i<
n;
i++){
96 std::cerr <<
"The new matrix size must be larger than zero." << std::endl
97 <<
"Your input was (" << dn <<
")." << std::endl;
110 const std::vector<dcomponent>::reverse_iterator data_rend =
data.rend();
111 for(std::vector<dcomponent>::reverse_iterator it=
data.rbegin(); it!=data_rend; it++){
112 if( it->i>=
n ){
del( CPPL_INT(data_rend-it-1) ); }
115 for(CPPL_INT
i=0;
i<-dn;
i++){
121 for(CPPL_INT
i=0;
i<dn;
i++){
122 line.push_back( std::vector<CPPL_INT>(0) );
130 {CPPL_VERBOSE_REPORT;
132 if( i<0 || j<0 ||
n<=i ||
n<=j ){
134 std::cerr <<
"The required component is out of the matrix size." << std::endl
135 <<
"Your input is (" << i <<
"," << j <<
"), whereas the matrix size is " <<
n <<
"x" <<
n <<
"." << std::endl;
140 const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j));
142 const std::vector<CPPL_INT>::const_iterator line_ii_end =
line[ii].end();
143 for(std::vector<CPPL_INT>::const_iterator p=
line[ii].begin(); p!=line_ii_end; p++){
144 if(
data[*p].i==ii &&
data[*p].j==jj){
return 1; }
153 {CPPL_VERBOSE_REPORT;
155 if( i<0 || j<0 ||
n<=i ||
n<=j ){
157 std::cerr <<
"The required component is out of the matrix size." << std::endl
158 <<
"Your input is (" << i <<
"," << j <<
"), whereas the matrix size is " <<
n <<
"x" <<
n <<
"." << std::endl;
163 const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j));
165 const std::vector<CPPL_INT>::const_iterator line_ii_end =
line[ii].end();
166 for(std::vector<CPPL_INT>::const_iterator p=
line[ii].begin(); p!=line_ii_end; p++){
167 if(
data[*p].i==ii &&
data[*p].j==jj){
return *p; }
180 {CPPL_VERBOSE_REPORT;
184 std::cerr <<
"Input row number must be between 0 and " << m <<
"." << std::endl
185 <<
"Your input was " << _m <<
"." << std::endl;
193 const std::vector<CPPL_INT>::const_iterator line__m_end =
line[_m].end();
194 for(std::vector<CPPL_INT>::const_iterator p=
line[_m].begin(); p!=line__m_end; p++){
208 {CPPL_VERBOSE_REPORT;
212 std::cerr <<
"Input row number must be between 0 and " << n <<
"." << std::endl
213 <<
"Your input was " << _n <<
"." << std::endl;
221 const std::vector<CPPL_INT>::const_iterator line__n_end =
line[_n].end();
222 for(std::vector<CPPL_INT>::const_iterator p=
line[_n].begin(); p!=line__n_end; p++){
240 {CPPL_VERBOSE_REPORT;
241 const std::vector<dcomponent>::reverse_iterator data_rend =
data.rend();
242 for(std::vector<dcomponent>::reverse_iterator it=
data.rbegin(); it!=data_rend; it++){
243 if( fabs(it->v)<eps ){
del( CPPL_INT(data_rend-it-1) ); }
254 const std::vector<dcomponent>::iterator data_end =data.end();
255 for(std::vector<dcomponent>::iterator it=data.begin(); it!=data.end(); it++){
256 if(it->i==it->j){ dsize++; }
261 for(std::vector<dcomponent>::reverse_iterator it=data.rbegin(); it!=data.rend()-dsize; it++){
262 if(it->i==it->j){//is diag
263 CPPL_INT c(data.rend()-it-1);//current it's index
264 CPPL_INT i(data[dsize].i), j(data[dsize].j), k(it->i);
266 for(std::vector<CPPL_INT>::iterator p=line[k].begin(); p!=line[k].end(); p++){
267 if(CPPL_INT(data[*p].i)==k && CPPL_INT(data[*p].j)==k){ *p=dsize; }
270 for(std::vector<CPPL_INT>::iterator p=line[i].begin(); p!=line[i].end(); p++){
271 if(CPPL_INT(*p)==dsize){ *p=c; }
275 for(std::vector<CPPL_INT>::iterator p=line[j].begin(); p!=line[j].end(); p++){
276 if(CPPL_INT(*p)==dsize){ *p=c; }
283 std::swap(data[dsize],data[c]);
296 {CPPL_VERBOSE_REPORT;
311 {CPPL_VERBOSE_REPORT;
313 for(CPPL_INT
i=0;
i<
n;
i++){
line[
i].resize(0); }
317 const std::vector<dcomponent>::iterator data_end =
data.end();
318 for(std::vector<dcomponent>::iterator it=
data.begin(); it!=data_end; it++){
319 line[it->i].push_back(c);
320 if( (it->i) != (it->j) ){
321 line[it->j].push_back(c);
334 {CPPL_VERBOSE_REPORT;
336 const std::vector<dcomponent>::const_iterator data_end =
data.end();
337 for(std::vector<dcomponent>::const_iterator it=
data.begin(); it!=data_end; it++){
338 std::cerr <<
"array[" << it-
data.begin() <<
"] = (" << it->i <<
"," << it->j <<
") = " << it->v << std::endl;
340 std::cerr << std::endl;
342 for(CPPL_INT
i=0;
i<
n;
i++){
343 std::cerr <<
"line[" <<
i <<
"] =" << std::flush;
344 const size_t line_i_size =
line[
i].size();
345 for(
size_t k=0; k<line_i_size; k++){
346 std::cerr <<
" " <<
line[
i][k] << std::flush;
348 std::cerr << std::endl;
350 std::cerr << std::endl;
353 for(std::vector<dcomponent>::const_iterator it=
data.begin(); it!=data_end; it++){
357 std::cerr <<
"The indx of the " << it-
data.begin() <<
"th element is out of the matrix size." << std::endl
358 <<
"Its i index was " << it->i <<
"." << std::endl;
365 std::cerr <<
"The jndx of the " << it-
data.begin() <<
"th element is out of the matrix size." << std::endl
366 <<
"Its j index was " << it->j <<
"." << std::endl;
371 for(std::vector<dcomponent>::const_iterator IT=it+1; IT!=data_end; IT++){
372 if( it->i==IT->i && it->j==IT->j ){
374 std::cerr <<
"The (" << it->i <<
", " << it->j <<
") component is double-listed at the " << it-
data.begin() <<
"th and the" << IT-
data.begin() <<
"the elements."<< std::endl;
381 std::cerr <<
"# [NOTE]@dssmatrix::checkup(): This symmetric sparse matrix is fine." << std::endl;
391 {CPPL_VERBOSE_REPORT;
400 {CPPL_VERBOSE_REPORT;
std::vector< dcomponent > data
matrix data
_dssmatrix _(dssmatrix &mat)
_dcovector col(const CPPL_INT &) const
void copy(const dssmatrix &)
std::vector< std::vector< CPPL_INT > > line
vector of vector to store the entry information of component for each row and column ...
CPPL_INT number(const CPPL_INT &, const CPPL_INT &) const
dssmatrix & resize(const CPPL_INT &, const CPPL_INT=0, const CPPL_INT=0)
std::vector< dcomponent > data
matrix data
dssmatrix & del(const CPPL_INT, const CPPL_INT)
dssmatrix & put(const CPPL_INT &, const CPPL_INT &, const double &)
bool isListed(const CPPL_INT &, const CPPL_INT &) const
(DO NOT USE) Smart-temporary Real Double-precision Symmetric Sparse Matrix Class
_dgematrix i(const _dgbmatrix &mat)
void reorder(const bool=0)
static bool jlt(const dcomponent &, const dcomponent &)
static bool ilt(const dcomponent &, const dcomponent &)
void shallow_copy(const _dssmatrix &)
void diet(const double=DBL_MIN)
Real Double-precision Row Vector Class.
_drovector row(const CPPL_INT &) const
(DO NOT USE) Smart-temporary Real Double-precision Row Vector Class
CPPL_INT n
matrix column size
void swap(dssmatrix &A, dssmatrix &B)
Real Double-precision Column Vector Class.
friend _dssmatrix _(dssmatrix &)
Real Double-precision Symmetric Sparse Matrix Class.
CPPL_INT n
matrix column size
CPPL_INT const & m
matrix row size
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 Real Double-precision Column Vector Class
void stretch(const CPPL_INT &)