17 for(CPPL_INT
i=0;
i<
m;
i++){
rows[
i].resize(0); }
18 for(CPPL_INT j=0; j<
n; j++){
cols[j].resize(0); }
29 std::cerr <<
"Only square matrix can be a identity matrix." << std::endl
30 <<
"The matrix size was " <<
m <<
"x" <<
n <<
"." << std::endl;
36 for(CPPL_INT
i=0;
i<
m;
i++){
37 put(
i,
i, comple(1.,0.));
46 const std::vector<zcomponent>::iterator data_end =
data.end();
47 for(std::vector<zcomponent>::iterator it=
data.begin(); it!=data_end; it++){
86 if( _m<0 || _n<0 || _c<0 ){
88 std::cerr <<
"Matrix sizes and the length of arrays must be positive integers. " << std::endl
89 <<
"Your input was (" << _m <<
"," << _n <<
"," << _c <<
"," << _l <<
")." << std::endl;
99 for(CPPL_INT
i=0;
i<
m;
i++){
104 for(CPPL_INT
i=0;
i<
n;
i++){
115 {CPPL_VERBOSE_REPORT;
117 if(
m+dm<0 ||
n+dn<0 ){
119 std::cerr <<
"The new matrix size must be larger than zero. " << std::endl
120 <<
"Your input was (" << dm <<
", " << dn <<
")." << std::endl;
126 if(dm==0 && dn==0){
return; }
135 const std::vector<zcomponent>::reverse_iterator data_rend =
data.rend();
136 for(std::vector<zcomponent>::reverse_iterator it=
data.rbegin(); it!=data_rend; it++){
137 if( it->i>=
m ){
del( CPPL_INT(data_rend-it-1) ); }
140 for(CPPL_INT
i=0;
i<-dm;
i++){
146 for(CPPL_INT
i=0;
i<dm;
i++){
147 rows.push_back( std::vector<CPPL_INT>(0) );
154 const std::vector<zcomponent>::reverse_iterator data_rend =
data.rend();
155 for(std::vector<zcomponent>::reverse_iterator it=
data.rbegin(); it!=data_rend; it++){
156 if( it->j>=
n ){
del( CPPL_INT(data_rend-it-1) ); }
158 for(CPPL_INT j=0; j<-dn; j++){
164 for(CPPL_INT j=0; j<dn; j++){
165 cols.push_back( std::vector<CPPL_INT>(0) );
173 {CPPL_VERBOSE_REPORT;
175 if( i<0 || j<0 ||
m<=i ||
n<=j ){
177 std::cerr <<
"The required component is out of the matrix size." << std::endl
178 <<
"Your input is (" << i <<
"," << j <<
"), whereas the matrix size is " <<
m <<
"x" <<
n <<
"." << std::endl;
183 const std::vector<CPPL_INT>::const_iterator rows_i_end =
rows[
i].end();
184 for(std::vector<CPPL_INT>::const_iterator p=
rows[i].begin(); p!=rows_i_end; p++){
185 if(
data[*p].j==j ){
return 1; }
194 {CPPL_VERBOSE_REPORT;
196 if( i<0 || j<0 ||
m<=i ||
n<=j ){
198 std::cerr <<
"The required component is out of the matrix size." << std::endl
199 <<
"Your input is (" << i <<
"," << j <<
"), whereas the matrix size is " <<
m <<
"x" <<
n <<
"." << std::endl;
204 const std::vector<CPPL_INT>::iterator rows_i_end =
rows[
i].end();
205 for(std::vector<CPPL_INT>::iterator p=
rows[i].begin(); p!=rows_i_end; p++){
206 if(
data[*p].j==j ){
return *p; }
215 {CPPL_VERBOSE_REPORT;
216 const std::vector<zcomponent>::reverse_iterator data_rend =
data.rend();
217 for(std::vector<zcomponent>::reverse_iterator it=
data.rbegin(); it!=data_rend; it++){
218 if( fabs(it->v.real())<eps && fabs(it->v.imag())<eps ){
del( CPPL_INT(data_rend-it-1) ); }
225 {CPPL_VERBOSE_REPORT;
228 const std::vector<zcomponent>::const_iterator data_end =
data.end();
229 for(std::vector<zcomponent>::const_iterator it=
data.begin(); it!=data_end; it++){
230 if( it->i>=
m || it->j>=
n ){
232 std::cerr <<
"A component, (" << it->i <<
", " << it->j <<
"), is out of matrix size." << std::endl;
242 std::cerr <<
"# [NOTE] zgsmatrix::checkup(): This sparse matrix is fine." << std::endl;
252 {CPPL_VERBOSE_REPORT;
256 std::cerr <<
"Input row number must be between 0 and " << m <<
"." << std::endl
257 <<
"Your input was " << _m <<
"." << std::endl;
264 const std::vector<CPPL_INT>::const_iterator rows__m_end =
rows[_m].end();
265 for(std::vector<CPPL_INT>::const_iterator p=
rows[_m].begin(); p!=rows__m_end; p++){
275 {CPPL_VERBOSE_REPORT;
279 std::cerr <<
"Input row number must be between 0 and " << n <<
"." << std::endl
280 <<
"Your input was " << _n <<
"." << std::endl;
287 const std::vector<CPPL_INT>::const_iterator cols__n_end =
cols[_n].end();
288 for(std::vector<CPPL_INT>::const_iterator p=
cols[_n].begin(); p!=cols__n_end; p++){
302 {CPPL_VERBOSE_REPORT;
313 {CPPL_VERBOSE_REPORT;
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
Complex Double-precision General Sparse Matrix Class.
friend _zgsmatrix _(zgsmatrix &)
zgsmatrix & del(const CPPL_INT, const CPPL_INT)
bool isListed(const CPPL_INT &, const CPPL_INT &)
_zcovector col(const CPPL_INT &) const
zgsmatrix & resize(const CPPL_INT &, const CPPL_INT &, const CPPL_INT=0, const CPPL_INT=0)
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT n
matrix column size
void stretch(const CPPL_INT &, const CPPL_INT &)
(DO NOT USE) Smart-temporary Real Double-precision General Sparse Matrix Class
zgsmatrix & put(const CPPL_INT &, const CPPL_INT &, const comple &)
void copy(const zgsmatrix &)
void shallow_copy(const _zgsmatrix &)
_zrovector row(const CPPL_INT &) const
std::vector< std::vector< CPPL_INT > > rows
array of vector to store the entry information of component for each row
std::vector< zcomponent > data
matrix data
Complex Double-precision Row Vector Class.
(DO NOT USE) Smart-temporary Complex Double-precision Row Vector Class
void swap(zgsmatrix &A, zgsmatrix &B)
void diet(const double=DBL_MIN)
CPPL_INT m
matrix row size
CPPL_INT number(const CPPL_INT &, const CPPL_INT &)
std::vector< std::vector< CPPL_INT > > cols
array of vector to store the entry information of component for each column
CPPL_INT m
matrix row size
Complex Double-precision Column Vector Class.
(DO NOT USE) Smart-temporary Complex Double-precision Column Vector Class
CPPL_INT n
matrix column size
_zgsmatrix _(zgsmatrix &mat)
std::vector< zcomponent > data
matrix data