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(const string s) const {
00034 if(this->find(s)==this->end()) return false;
00035 return true;
00036 }
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 };
00052
00053 void dagger(coefficients &coeff) {
00054 if(!coeff.has_key("sign")) coeff["sign"]=-1;
00055 else coeff["sign"]=-coeff["sign"];
00056 }
00057
00058 ostream& operator<< (ostream& os, const coefficients& coeff ) {
00059 begin_function("print_coefficients");
00060 coefficients::const_iterator iter;
00061 for (iter=coeff.begin(); iter != coeff.end(); iter++) {
00062 cout << "<coefficient name=\"" << iter->first << "\">" << iter->second
00063 << "</coefficient>" << '\n';
00064 }
00065 end_function("print_coefficients");
00066 return os;
00067 }