00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00031 class coefficients : public map<string,mdp_real> {
00032 public:
00033 bool has_key(string s) {
00034 if(this->find(s)==this->end()) return false;
00035 return true;
00036 }
00037 };
00038
00039 void dagger(coefficients &coeff) {
00040 if(!coeff.has_key("sign")) coeff["sign"]=-1;
00041 else coeff["sign"]=-coeff["sign"];
00042 }
00043
00044 ostream& operator<< (ostream& os, const coefficients& coeff ) {
00045 begin_function("print_coefficients");
00046 coefficients::const_iterator iter;
00047 for (iter=coeff.begin(); iter != coeff.end(); iter++) {
00048 cout << "<coefficient name=\"" << iter->first << "\">" << iter->second
00049 << "</coefficient>" << '\n';
00050 }
00051 end_function("print_coefficients");
00052 return os;
00053 }