00001
00002
00003 inline CPPSL_double dgematrix::operator()(const long& i, const long& j)
00004 {
00005 #ifdef CPPSL_DEBUG
00006 if( i<0 || j<0 || M<=i || N<=j ){
00007 std::cerr << "[ERROR] dgematrix::operator()(const long&, const long&)"
00008 << std::endl
00009 << "The required component is out of the matrix size."
00010 << std::endl
00011 << "Your input was (" << i << "," << j << ")." << std::endl;
00012 exit(1);
00013 }
00014 #endif//CPPSL_DEBUG
00015
00016 return CPPSL_double( Array, i, j, Desc );
00017 }
00018
00019
00020
00021 inline double dgematrix::operator()(const long& i, const long& j) const
00022 {
00023 #ifdef CPPSL_DEBUG
00024 if( i<0 || j<0 || M<=i || N<=j ){
00025 std::cerr << "[ERROR] dgematrix::operator()(const long&, const long&) const"
00026 << std::endl
00027 << "The required component is out of the matrix size."
00028 << std::endl
00029 << "Your input was (" << i << "," << j << ")." << std::endl;
00030 exit(1);
00031 }
00032 #endif//CPPSL_DEBUG
00033
00034 double alpha;
00035 pdelget_('A', ' ', alpha, Array, i+1, j+1, Desc);
00036 return alpha;
00037 }
00038
00039
00040
00041
00042
00043
00044
00045 inline void dgematrix::set(const long& i, const long& j, const double& v) const
00046 {
00047 #ifdef CPPSL_DEBUG
00048 if( i<0 || j<0 || M<=i || N<=j ){
00049 std::cerr
00050 << "[ERROR] dgematrix::set(const long&, const long&, const double&)"
00051 << std::endl
00052 << "The required component is out of the matrix size." << std::endl
00053 << "Your input was (" << i << "," << j << ")." << std::endl;
00054 exit(1);
00055 }
00056 #endif//CPPSL_DEBUG
00057
00058 pdelset_(Array, i+1, j+1, Desc, v);
00059 }
00060
00061
00062
00063
00064
00065
00066
00067 inline std::ostream& operator<<(std::ostream& s, const dgematrix& mat)
00068 {
00069 for(long i=0; i<mat.M; i++){
00070 for(long j=0; j<mat.N; j++){
00071 s << " " << mat(i,j);
00072 }
00073 s << std::endl;
00074 }
00075 return s;
00076 }