15 for(CPPL_INT
i=0;
i<
n;
i++){
line[
i].resize(0); }
24 for(CPPL_INT
i=0;
i<
n;
i++){
25 put(
i,
i, comple(1.,0.));
34 const std::vector<zcomponent>::iterator data_end =
data.end();
35 for(std::vector<zcomponent>::iterator it=
data.begin(); it!=data_end; it++){
69 if( _n<0 || _c<0 || _l<0 ){
71 std::cerr <<
"Matrix sizes and the length of arrays must be positive integers. " << std::endl
72 <<
"Your input was (" << _n <<
"," << _c <<
"," << _l <<
")." << std::endl;
81 for(CPPL_INT
i=0;
i<
n;
i++){
98 std::cerr <<
"The new matrix size must be larger than zero." << std::endl
99 <<
"Your input was (" << dn <<
")." << std::endl;
108 const std::vector<zcomponent>::reverse_iterator data_rend =
data.rend();
109 for(std::vector<zcomponent>::reverse_iterator it=
data.rbegin(); it!=data_rend; it++){
110 if( it->i>=
n ){
del( CPPL_INT(data_rend-it-1) ); }
113 for(CPPL_INT
i=0;
i<-dn;
i++){
119 for(CPPL_INT
i=0;
i<dn;
i++){
120 line.push_back( std::vector<CPPL_INT>(0) );
128 {CPPL_VERBOSE_REPORT;
130 if( i<0 || j<0 ||
n<=i ||
n<=j ){
132 std::cerr <<
"The required component is out of the matrix size." << std::endl
133 <<
"Your input is (" << i <<
"," << j <<
"), whereas the matrix size is " <<
n <<
"x" <<
n <<
"." << std::endl;
138 const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j));
140 const std::vector<CPPL_INT>::const_iterator line_ii_end =
line[ii].end();
141 for(std::vector<CPPL_INT>::const_iterator p=
line[ii].begin(); p!=line_ii_end; p++){
142 if(
data[*p].j==jj){
return 1; }
151 {CPPL_VERBOSE_REPORT;
153 if( i<0 || j<0 ||
n<=i ||
n<=j ){
155 std::cerr <<
"The required component is out of the matrix size." << std::endl
156 <<
"Your input is (" << i <<
"," << j <<
"), whereas the matrix size is " <<
n <<
"x" <<
n <<
"." << std::endl;
161 const CPPL_INT ii(std::max(i,j)), jj(std::min(i,j));
163 const std::vector<CPPL_INT>::const_iterator line_ii_end =
line[ii].end();
164 for(std::vector<CPPL_INT>::const_iterator p=
line[ii].begin(); p!=line_ii_end; p++){
165 if(
data[*p].i==ii &&
data[*p].j==jj){
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;
192 const std::vector<CPPL_INT>::const_iterator line__m_end =
line[_m].end();
193 for(std::vector<CPPL_INT>::const_iterator p=
line[_m].begin(); p!=line__m_end; p++){
194 if(
data[*p].
i==_m ){
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;
220 const std::vector<CPPL_INT>::const_iterator line__n_end =
line[_n].end();
221 for(std::vector<CPPL_INT>::const_iterator p=
line[_n].begin(); p!=line__n_end; p++){
222 if(
data[*p].
i==_n ){
236 {CPPL_VERBOSE_REPORT;
237 const std::vector<zcomponent>::reverse_iterator data_rend =
data.rend();
238 for(std::vector<zcomponent>::reverse_iterator it=
data.rbegin(); it!=data_rend; it++){
239 if( fabs(it->v.real())<eps && fabs(it->v.imag())<eps ){
240 del( CPPL_INT(data_rend-it-1) );
252 {CPPL_VERBOSE_REPORT;
261 {CPPL_VERBOSE_REPORT;
279 {CPPL_VERBOSE_REPORT;
281 for(CPPL_INT
i=0;
i<
m;
i++){
282 if( std::fabs((*
this)(
i,
i).
imag()) > DBL_MIN ){
284 std::cerr <<
"Diagonal components of a Hermitian matrix have to be real numbers." << std::endl
285 <<
"(*this)(" <<
i <<
"," <<
i <<
") was a complex number, " << (*this)(
i,
i) <<
"." << std::endl;
291 std::cerr <<
"# [NOTE]@zhsmatrix::checkup(): This symmetric sparse matrix is fine." << std::endl;
bool isListed(const CPPL_INT &, const CPPL_INT &) const
std::vector< zcomponent > data
matrix data
_zcovector col(const CPPL_INT &) const
void copy(const zhsmatrix &)
zhsmatrix & put(const CPPL_INT &, const CPPL_INT &, const comple &)
friend _zhsmatrix _(zhsmatrix &)
_dgematrix i(const _dgbmatrix &mat)
CPPL_INT number(const CPPL_INT &, const CPPL_INT &) const
CPPL_INT n
matrix column size
_zcovector conj(const _zcovector &vec)
CPPL_INT n
matrix column size
void diet(const double=DBL_MIN)
std::vector< zcomponent > data
matrix data
Complex Double-precision Row Vector Class.
(DO NOT USE) Smart-temporary Complex Double-precision Row Vector Class
std::vector< std::vector< CPPL_INT > > line
vector of vector to store the entry information of component for each row and column ...
void stretch(const CPPL_INT &)
Complex Double-precision Hermitian Sparse Matrix Class.
std::vector< std::vector< CPPL_INT > > line
vector of vector to store the entry information of component for each row and column ...
dcovec3 imag(const dquater &q)
zhsmatrix & resize(const CPPL_INT &, const CPPL_INT=0, const CPPL_INT=0)
void swap(zhsmatrix &A, zhsmatrix &B)
void shallow_copy(const _zhsmatrix &)
Complex Double-precision Column Vector Class.
(DO NOT USE) Smart-temporary Complex Double-precision Column Vector Class
_zhsmatrix _(zhsmatrix &mat)
CPPL_INT const & m
matrix row size
(DO NOT USE) Smart-temporary Complex Double-precision Hermitian Sparse Matrix Class ...
zhsmatrix & del(const CPPL_INT, const CPPL_INT)
_zrovector row(const CPPL_INT &) const