00001
00003 inline std::complex<double>& _zgbmatrix::operator()(const long& i, const long& j) const
00004 {
00005 #ifdef CPPL_VERBOSE
00006 std::cerr << "# [MARK] _zgbmatrix::operator()(const long&, const long&) const"
00007 << std::endl;
00008 #endif//CPPL_VERBOSE
00009
00010 #ifdef CPPL_DEBUG
00011 if( i<0 || j<0 || M<=i || N<=j || i-j>KL || j-i>KU ){
00012 std::cerr << "[ERROR] _zgbmatrix::operator()(long, long)" << std::endl
00013 << "The required component is out of the matrix size."
00014 << std::endl
00015 << "Your input was (" << i << "," << j << ")." << std::endl;
00016 exit(1);
00017 }
00018 #endif//CPPL_DEBUG
00019
00020
00021 return Darray[j][KU-j+i];
00022 }
00023
00027
00028
00029 inline std::ostream& operator<<(std::ostream& s, const _zgbmatrix& mat)
00030 {
00031 #ifdef CPPL_VERBOSE
00032 std::cerr << "# [MARK] operator<<(std::ostream&, const _zgbmatrix&)"
00033 << std::endl;
00034 #endif//CPPL_VERBOSE
00035
00036 for(long i=0; i<mat.M; i++){
00037 for(long j=0; j<mat.N; j++){
00038 if( i-j>mat.KL || j-i>mat.KU ){ s << " x"; }
00039 else{ s << " " << mat(i,j); }
00040 }
00041 s << std::endl;
00042 }
00043
00044 mat.destroy();
00045 return s;
00046 }
00047
00051
00052
00053 inline void _zgbmatrix::write(const char* filename) const
00054 {
00055 #ifdef CPPL_VERBOSE
00056 std::cerr << "# [MARK] _zgbmatrix::write(const char*) const"
00057 << std::endl;
00058 #endif//CPPL_VERBOSE
00059
00060 std::ofstream s(filename, std::ios::trunc);
00061
00062 s << "zgbmatrix" << " "
00063 << M << " " << N << " " << KL << " " << KU << std::endl;
00064 for(long i=0; i<M; i++){
00065 for(long j=max(0,i-KL); j<min(N,i+KU+1); j++){
00066 s << operator()(i,j) << " ";
00067 }
00068 s << std::endl;
00069 }
00070
00071 s.close();
00072 destroy();
00073 }