6 std::cerr <<
"# [MARK] zgbmatrix::operator()(const long&, const long&)"
11 if( i<0 || j<0 || M<=i || N<=j || i-j>KL || j-i>KU ){
12 std::cerr <<
"[ERROR] zgbmatrix::operator()(long, long)" << std::endl
13 <<
"The required component is out of the matrix size."
15 <<
"Your input was (" << i <<
"," << j <<
")." << std::endl;
21 return Darray[j][KU-j+
i];
29 std::cerr <<
"# [MARK] zgbmatrix::operator()(const long&, const long&) const"
34 if( i<0 || j<0 || M<=i || N<=j || i-j>KL || j-i>KU ){
35 std::cerr <<
"[ERROR] zgbmatrix::operator()(long, long)" << std::endl
36 <<
"The required component is out of the matrix size."
38 <<
"Your input was (" << i <<
"," << j <<
")." << std::endl;
44 return Darray[j][KU-j+
i];
53 inline void zgbmatrix::set(
const long& i,
const long& j,
const std::complex<double>& v)
const
56 std::cerr <<
"# [MARK] zgbmatrix::set(const long&, const long&, const std::complex<double>&) const"
61 if( i<0 || j<0 || M<=i || N<=j || i-j>KL || j-i>KU ){
62 std::cerr <<
"[ERROR] zgbmatrix::set(long&, long&, std::complex<double>&)" << std::endl
63 <<
"The required component is out of the matrix size."
65 <<
"Your input was (" << i <<
"," << j <<
")." << std::endl;
79 inline std::ostream& operator<<(std::ostream& s,
const zgbmatrix& mat)
82 std::cerr <<
"# [MARK] operator<<(std::ostream&, const zgbmatrix&)"
86 for(
long i=0; i<mat.M; i++){
87 for(
long j=0; j<mat.N; j++){
88 if( i-j>mat.KL || j-i>mat.KU ){ s <<
" x"; }
89 else{ s <<
" " << mat(i,j); }
102 inline void zgbmatrix::write(
const char* filename)
const
105 std::cerr <<
"# [MARK] zgbmatrix::write(const char*) const"
109 std::ofstream s(filename, std::ios::trunc);
111 s <<
"zgbmatrix" <<
" "
112 << M <<
" " << N <<
" " << KL <<
" " << KU << std::endl;
113 for(
long i=0;
i<M;
i++){
114 for(
long j=max(0,
i-KL); j<min(N,
i+KU+1); j++){
124 inline void zgbmatrix::read(
const char* filename)
127 std::cerr <<
"# [MARK] zgbmatrix::read(const char*)"
131 std::ifstream s( filename );
133 std::cerr <<
"[ERROR] zgbmatrix::read(const char*) " << std::endl
134 <<
"The file \"" << filename <<
"\" can not be opened."
141 if(
id !=
"zgbmatrix" ){
142 std::cerr <<
"[ERROR] zgbmatrix::read(const char*) " << std::endl
143 <<
"The type name of the file \"" << filename
144 <<
"\" is not zgbmatrix." << std::endl
145 <<
"Its type name was " <<
id <<
" ." << std::endl;
149 s >> M >> N >> KL >> KU;
151 for(
long i=0;
i<M;
i++){
152 for(
long j=max(0,
i-KL); j<min(N,
i+KU+1); j++){
157 std::cerr <<
"[ERROR] zgbmatrix::read(const char*) " << std::endl
158 <<
"There is something is wrong with the file \""
159 << filename <<
" ." << std::endl
160 <<
"Most likely, there is not enough data components, "
161 <<
"or a linefeed code or space code is missing "
162 <<
"at the end of the last line." << std::endl;
std::complex< double > & operator()(const long &, const long &)
Definition: zgbmatrix-io.hpp:3
friend _zgematrix i(const zgbmatrix &)
Definition: zgbmatrix-calc.hpp:22
void set(const long &, const long &, const std::complex< double > &) const
Definition: zgbmatrix-io.hpp:53
void resize(const long &, const long &, const long &, const long &)
Definition: zgbmatrix-misc.hpp:132
Complex Double-precision General Band Matrix Class.
Definition: zgbmatrix.hpp:3