Go to the documentation of this file.00001
00002
00003 inline double& _dsymatrix::operator()(const long& i, const long& j) const
00004 {VERBOSE_REPORT;
00005 #ifdef CPPL_DEBUG
00006 if( i<0 || j<0 || n<=i || n<=j ){
00007 ERROR_REPORT;
00008 std::cerr << "The required component is out of the matrix size." << std::endl
00009 << "Your input was (" << i << "," << j << ")." << std::endl;
00010 exit(1);
00011 }
00012 #endif//CPPL_DEBUG
00013
00014 if( i >= j ){
00015
00016 return darray[j][i];
00017 } else {
00018
00019 return darray[i][j];
00020 }
00021 }
00022
00023
00024
00025
00026
00027
00028 inline std::ostream& operator<<(std::ostream& s, const _dsymatrix& mat)
00029 {VERBOSE_REPORT;
00030 for(long i=0; i<mat.n; i++){
00031 for(long j=0; j<mat.n; j++){
00032 if( i >= j ){
00033 s << " " << mat(i,j) << " ";
00034 } else {
00035 s << "{" << mat(i,j) << "} ";
00036 }
00037 }
00038 s << std::endl;
00039 }
00040
00041 mat.destroy();
00042 return s;
00043 }
00044
00045
00046
00047
00048
00049
00050 inline void _dsymatrix::write(const char* filename) const
00051 {VERBOSE_REPORT;
00052 std::ofstream ofs(filename, std::ios::trunc);
00053 ofs.setf(std::cout.flags());
00054 ofs.precision(std::cout.precision());
00055 ofs.width(std::cout.width());
00056 ofs.fill(std::cout.fill());
00057
00058 ofs << "#dsymatrix" << " " << n << std::endl;
00059 for(long i=0; i<n; i++){
00060 for(long j=0; j<=i; j++ ){
00061 ofs << operator()(i,j) << " ";
00062 }
00063 ofs << std::endl;
00064 }
00065
00066 ofs.close();
00067 destroy();
00068 }