ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/math/Polynomial.hpp
(Generate patch)

Comparing trunk/OOPSE-4/src/math/Polynomial.hpp (file contents):
Revision 2448 by tim, Wed Nov 16 23:10:02 2005 UTC vs.
Revision 2577 by gezelter, Wed Feb 1 17:26:43 2006 UTC

# Line 204 | Line 204 | namespace oopse {
204          for (i =  p.begin(); i  != p.end(); ++i) {
205            this->addCoefficient(i->first, -i->second);
206          }        
207 +        return *this;
208      }
209  
210      PolynomialType& operator *= (const PolynomialType& p) {
# Line 245 | Line 246 | namespace oopse {
246      return p;
247    }
248  
249 +  template<typename ElemType>
250 +  Polynomial<ElemType> operator *(const Polynomial<ElemType>& p, const ElemType v) {
251 +    typename Polynomial<ElemType>::const_iterator i;
252 +    Polynomial<ElemType> result;
253 +    
254 +    for (i = p.begin(); i !=p.end(); ++i) {
255 +        result.addCoefficient( i->first , i->second * v);
256 +    }
257 +
258 +    return result;
259 +  }
260 +
261 +  template<typename ElemType>
262 +  Polynomial<ElemType> operator *( const ElemType v, const Polynomial<ElemType>& p) {
263 +    typename Polynomial<ElemType>::const_iterator i;
264 +    Polynomial<ElemType> result;
265 +    
266 +    for (i = p.begin(); i !=p.end(); ++i) {
267 +        result.addCoefficient( i->first , i->second * v);
268 +    }
269 +
270 +    return result;
271 +  }
272 +  
273    /**
274     * Generates and returns the sum of two given Polynomials.
275     * @param p1 the first polynomial

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines