Imported Upstream version 1.49.0
[platform/upstream/boost.git] / libs / math / doc / sf_and_dist / polynomial.qbk
1 [section:polynomials Polynomials]
2
3 [h4 Synopsis]
4
5 ``
6 #include <boost/math/tools/polynomial.hpp>
7 ``
8
9    namespace boost{ namespace math{ namespace tools{
10
11    template <class T>
12    class polynomial
13    {
14    public:
15       // typedefs:
16       typedef typename std::vector<T>::value_type value_type;
17       typedef typename std::vector<T>::size_type  size_type;
18
19       // construct:
20       polynomial(){}
21       template <class U>
22       polynomial(const U* data, unsigned order);
23       template <class U>
24       polynomial(const U& point);
25       
26       // access:
27       size_type size()const;
28       size_type degree()const;
29       value_type& operator[](size_type i);
30       const value_type& operator[](size_type i)const;
31
32       // operators:
33       template <class U>
34       polynomial& operator +=(const U& value);
35       template <class U>
36       polynomial& operator -=(const U& value);
37       template <class U>
38       polynomial& operator *=(const U& value);
39       template <class U>
40       polynomial& operator +=(const polynomial<U>& value);
41       template <class U>
42       polynomial& operator -=(const polynomial<U>& value);
43       template <class U>
44       polynomial& operator *=(const polynomial<U>& value);
45    };
46
47    template <class T>
48    polynomial<T> operator + (const polynomial<T>& a, const polynomial<T>& b);
49    template <class T>
50    polynomial<T> operator - (const polynomial<T>& a, const polynomial<T>& b);
51    template <class T>
52    polynomial<T> operator * (const polynomial<T>& a, const polynomial<T>& b);
53    
54    template <class T, class U>
55    polynomial<T> operator + (const polynomial<T>& a, const U& b);
56    template <class T, class U>
57    polynomial<T> operator - (const polynomial<T>& a, const U& b);
58    template <class T, class U>
59    polynomial<T> operator * (const polynomial<T>& a, const U& b);
60    
61    template <class U, class T>
62    polynomial<T> operator + (const U& a, const polynomial<T>& b);
63    template <class U, class T>
64    polynomial<T> operator - (const U& a, const polynomial<T>& b);
65    template <class U, class T>
66    polynomial<T> operator * (const U& a, const polynomial<T>& b);
67    
68    template <class charT, class traits, class T>
69    std::basic_ostream<charT, traits>& operator << 
70       (std::basic_ostream<charT, traits>& os, const polynomial<T>& poly);
71
72    }}} // namespaces
73
74 [h4 Description]
75
76 This is a fairly trivial class for polynomial manipulation.
77
78 Implementation is currently of the "naive" variety, with O(N^2)
79 multiplication for example.  This class should not be used in
80 high-performance computing environments: it is intended for the
81 simple manipulation of small polynomials, typically generated
82 for special function approximation.
83
84 Advanced manipulations: the FFT, division, GCD, factorisation etc are
85 not currently provided.  Submissions for these are of course welcome :-)
86
87 [endsect][/section:polynomials Polynomials]
88
89 [/ 
90   Copyright 2006 John Maddock and Paul A. Bristow.
91   Distributed under the Boost Software License, Version 1.0.
92   (See accompanying file LICENSE_1_0.txt or copy at
93   http://www.boost.org/LICENSE_1_0.txt).
94 ]