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 2576 by tim, Mon Jan 30 22:25:27 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines