| 129 |  | */ | 
| 130 |  |  | 
| 131 |  | void setCoefficient(int exponent, const ElemType& coefficient) { | 
| 132 | < | polyPairMap_.insert(typename PolynomialPairMap::value_type(exponent, coefficient)); | 
| 132 | > | polyPairMap_[exponent] = coefficient; | 
| 133 |  | } | 
| 134 |  |  | 
| 135 |  | /** | 
| 149 |  | } | 
| 150 |  | } | 
| 151 |  |  | 
| 152 | – |  | 
| 152 |  | /** | 
| 153 |  | * Returns the coefficient associated with the given power for this Polynomial. | 
| 154 |  | * @return the coefficient associated with the given power for this Polynomial | 
| 225 |  | PolynomialType& operator *= (const PolynomialType& p) { | 
| 226 |  | typename Polynomial<ElemType>::const_iterator i; | 
| 227 |  | typename Polynomial<ElemType>::const_iterator j; | 
| 228 | < |  | 
| 229 | < | for (i = this->begin(); i !=this->end(); ++i) { | 
| 228 | > | Polynomial<ElemType> p2(*this); | 
| 229 | > |  | 
| 230 | > | polyPairMap_.clear();  // clear out old map | 
| 231 | > | for (i = p2.begin(); i !=p2.end(); ++i) { | 
| 232 |  | for (j = p.begin(); j !=p.end(); ++j) { | 
| 233 |  | this->addCoefficient( i->first + j->first, i->second * j->second); | 
| 234 |  | } | 
| 235 | + | } | 
| 236 | + | return *this; | 
| 237 | + | } | 
| 238 | + |  | 
| 239 | + | //PolynomialType& operator *= (const ElemType v) | 
| 240 | + | PolynomialType& operator *= (const ElemType v) { | 
| 241 | + | typename Polynomial<ElemType>::const_iterator i; | 
| 242 | + | //Polynomial<ElemType> result; | 
| 243 | + |  | 
| 244 | + | for (i = this->begin(); i != this->end(); ++i) { | 
| 245 | + | this->setCoefficient( i->first, i->second*v); | 
| 246 |  | } | 
| 247 |  |  | 
| 248 |  | return *this; | 
| 249 |  | } | 
| 250 |  |  | 
| 251 | + | PolynomialType& operator += (const ElemType v) { | 
| 252 | + | this->addCoefficient( 0, v); | 
| 253 | + | return *this; | 
| 254 | + | } | 
| 255 |  |  | 
| 256 |  | private: | 
| 257 |  |  | 
| 284 |  | Polynomial<ElemType> result; | 
| 285 |  |  | 
| 286 |  | for (i = p.begin(); i !=p.end(); ++i) { | 
| 287 | < | result.addCoefficient( i->first , i->second * v); | 
| 287 | > | result.setCoefficient( i->first , i->second * v); | 
| 288 |  | } | 
| 289 |  |  | 
| 290 |  | return result; | 
| 296 |  | Polynomial<ElemType> result; | 
| 297 |  |  | 
| 298 |  | for (i = p.begin(); i !=p.end(); ++i) { | 
| 299 | < | result.addCoefficient( i->first , i->second * v); | 
| 299 | > | result.setCoefficient( i->first , i->second * v); | 
| 300 |  | } | 
| 301 |  |  | 
| 302 |  | return result; |