|
SLIP
1.4
|
Numerical Polynomial class. This container statisfies the RandomAccessContainer concepts of the STL The coefficients of the polynomial
are ordered as follows : (a0,a1,...,an)
More...
#include <Polynomial.hpp>
Public Types | |
| typedef T | value_type |
| typedef Polynomial< T > | self |
| typedef const Polynomial< T > | const_self |
| typedef value_type * | pointer |
| typedef const value_type * | const_pointer |
| typedef value_type & | reference |
| typedef const value_type & | const_reference |
| typedef ptrdiff_t | difference_type |
| typedef std::size_t | size_type |
| typedef pointer | iterator |
| typedef const_pointer | const_iterator |
| typedef std::reverse_iterator < iterator > | reverse_iterator |
| typedef std::reverse_iterator < const_iterator > | const_reverse_iterator |
| typedef std::random_access_iterator_tag | iterator_category |
Public Member Functions | |
| std::string | name () const |
| Returns the name of the class. More... | |
| size_type | size () const |
| Returns the number of elements in the Polynomial. More... | |
| size_type | degree () const |
| Returns the degree of the Polynomial. More... | |
| size_type | order () const |
| Returns the order of the Polynomial. More... | |
| size_type | max_size () const |
| Returns the maximal size (number of elements) in the Polynomial. More... | |
| bool | empty () const |
| Returns true if the Polynomial is empty. (Thus size() == 0) More... | |
| void | swap (self &M) |
| Swaps data with another Polynomial. More... | |
| template<typename T> | |
| Polynomial (const typename Polynomial< T >::size_type n) | |
| template<typename T> | |
| Polynomial (const typename Polynomial< T >::size_type n, const T &val) | |
| template<typename T> | |
| Polynomial (const typename Polynomial< T >::size_type n, const T *val) | |
Constructors & Destructors | |
| Polynomial () | |
| Constructs a Polynomial. More... | |
| Polynomial (const size_type n) | |
| Constructs a Polynomial. More... | |
| Polynomial (const size_type n, const T &val) | |
| Constructs a Polynomial initialized by the scalar value val. More... | |
| Polynomial (const size_type n, const T *val) | |
| Constructs a Polynomial initialized by an array val. More... | |
| template<typename InputIterator > | |
| Polynomial (InputIterator first, InputIterator last) | |
| Contructs a Polynomial from a range. More... | |
| Polynomial (const self &rhs) | |
| Constructs a copy of the Polynomial rhs. More... | |
| ~Polynomial () | |
| Destructor of the Polynomial. More... | |
iterators | |
| iterator | begin () |
| Returns a read/write iterator that points to the first element in the Polynomial. Iteration is done in ordinary element order. More... | |
| const_iterator | begin () const |
| Returns a read-only (constant) iterator that points to the first element in the Polynomial. Iteration is done in ordinary element order. More... | |
| iterator | end () |
| Returns a read/write iterator that points one past the last element in the Polynomial. Iteration is done in ordinary element order. More... | |
| const_iterator | end () const |
| Returns a read-only (constant) iterator that points one past the last element in the Polynomial. Iteration is done in ordinary element order. More... | |
| reverse_iterator | rbegin () |
| Returns a read/write reverse iterator that points to the last element in the Polynomial. Iteration is done in reverse element order. More... | |
| const_reverse_iterator | rbegin () const |
| Returns a read-only (constant) reverse iterator that points to the last element in the Polynomial. Iteration is done in reverse element order. More... | |
| reverse_iterator | rend () |
| Returns a read/write reverse iterator that points to one before the first element in the Polynomial. Iteration is done in reverse element order. More... | |
| const_reverse_iterator | rend () const |
| Returns a read-only (constant) reverse iterator that points to one before the first element in the Polynomial. Iteration is done in reverse element order. More... | |
Assignment operators and methods | |
| self & | operator= (const self &rhs) |
| Assign a Polynomial. More... | |
| self & | operator= (const T &val) |
| Assigns all the element of the Polynomial by val. More... | |
| void | fill (const T &value) |
| Fills the container range [begin(),begin()+size()) with copies of value. More... | |
| void | fill (const T *value) |
| Fills the container range [begin(),begin()+size()) with a copy of the value array. More... | |
| template<typename InputIterator > | |
| void | fill (InputIterator first, InputIterator last) |
| Fills the container range [begin(),begin()+size()) with a copy of the range [first,last) More... | |
Element access operators | |
| reference | operator[] (const size_type i) |
| Subscript access to the data contained in the Polynomial. More... | |
| const_reference | operator[] (const size_type i) const |
| Subscript access to the data contained in the Polynomial. More... | |
| reference | operator() (const size_type i) |
| Subscript access to the data contained in the Polynomial. More... | |
| const_reference | operator() (const size_type i) const |
| Subscript access to the data contained in the Polynomial. More... | |
Arithmetic operators | |
| self & | operator+= (const T &val) |
| Add val to each element of the Polynomial. More... | |
| self & | operator-= (const T &val) |
| self & | operator*= (const T &val) |
| self & | operator/= (const T &val) |
| self | operator- () const |
| self & | operator+= (const self &rhs) |
| self & | operator-= (const self &rhs) |
| self & | operator*= (const self &rhs) |
Mathematic operators | |
| self & | derivative () |
| Returns the derivative the polynomial. More... | |
| self & | integral () |
| Returns the integral of the polynomial. The constant of integrationis set to zero. More... | |
| double | fit (iterator xi_first, iterator xi_last, iterator yi_first, const std::size_t order) |
| Return a polynomial P(X) of degree order that minimizes sum_i (P(x(i)) - y(i))^2 to best fit the data in the least squares sense. More... | |
| slip::Matrix< T > | companion () const |
| Computes the companion matrix corresponding to polynomial coefficients. More... | |
| slip::Vector< std::complex< T > > | roots () const |
| Computes the roots of the polynomial. More... | |
| T | evaluate (const T &x) const |
| Returns the evaluation of the polynomial at x. More... | |
| template<typename InputIterator , typename OutputIterator > | |
| void | multi_evaluate (InputIterator first, InputIterator last, OutputIterator result) const |
| Returns the evaluation of the polynomial at each element of the range [first,last). More... | |
Friends | |
| class | boost::serialization::access |
i/o operators | |
| std::ostream & | operator<< (std::ostream &out, const self &v) |
| Write the Polynomial to the ouput stream. More... | |
Comparison operators | |
| bool | operator== (const Polynomial< T > &x, const Polynomial< T > &y) |
| Polynomial equality comparison. More... | |
| bool | operator!= (const Polynomial< T > &x, const Polynomial< T > &y) |
| Polynomial inequality comparison. More... | |
| bool | operator< (const Polynomial< T > &x, const Polynomial< T > &y) |
| Less than comparison operator (Polynomial ordering relation) More... | |
| bool | operator> (const Polynomial< T > &x, const Polynomial< T > &y) |
| More than comparison operator. More... | |
| bool | operator<= (const Polynomial< T > &x, const Polynomial< T > &y) |
| Less than equal comparison operator. More... | |
| bool | operator>= (const Polynomial< T > &x, const Polynomial< T > &y) |
| More than equal comparison operator. More... | |
Related Functions | |
(Note that these are not member functions.) | |
| template<typename T > | |
| Polynomial< T > | operator+ (const Polynomial< T > &V1, const Polynomial< T > &V2) |
| pointwise addition of two Polynomial More... | |
| template<typename T > | |
| Polynomial< T > | operator+ (const Polynomial< T > &V, const T &val) |
| addition of a scalar to each element of a Polynomial More... | |
| template<typename T > | |
| Polynomial< T > | operator+ (const T &val, const Polynomial< T > &V) |
| addition of a scalar to each element of a Polynomial More... | |
| template<typename T > | |
| Polynomial< T > | operator- (const Polynomial< T > &V1, const Polynomial< T > &V2) |
| pointwise substraction of two Polynomial More... | |
| template<typename T > | |
| Polynomial< T > | operator- (const Polynomial< T > &V, const T &val) |
| substraction of a scalar to each element of a Polynomial More... | |
| template<typename T > | |
| Polynomial< T > | operator- (const T &val, const Polynomial< T > &V) |
| substraction of a scalar to each element of a Polynomial More... | |
| template<typename T > | |
| Polynomial< T > | operator* (const Polynomial< T > &V1, const Polynomial< T > &V2) |
| pointwise multiplication of two Polynomial More... | |
| template<typename T > | |
| Polynomial< T > | operator* (const Polynomial< T > &V, const T &val) |
| multiplication of a scalar to each element of a Polynomial More... | |
| template<typename T > | |
| Polynomial< T > | operator* (const T &val, const Polynomial< T > &V) |
| multiplication of a scalar to each element of a Polynomial More... | |
| template<typename T > | |
| Polynomial< T > | operator/ (const Polynomial< T > &V, const T &val) |
| division of a scalar to each element of a Polynomial More... | |
Numerical Polynomial class. This container statisfies the RandomAccessContainer concepts of the STL The coefficients of the polynomial
are ordered as follows : (a0,a1,...,an)
| T | Type of object in the Polynomial |
Definition at line 104 of file Polynomial.hpp.
| typedef const_pointer slip::Polynomial< T >::const_iterator |
Definition at line 166 of file Polynomial.hpp.
| typedef const value_type* slip::Polynomial< T >::const_pointer |
Definition at line 158 of file Polynomial.hpp.
| typedef const value_type& slip::Polynomial< T >::const_reference |
Definition at line 160 of file Polynomial.hpp.
| typedef std::reverse_iterator<const_iterator> slip::Polynomial< T >::const_reverse_iterator |
Definition at line 169 of file Polynomial.hpp.
| typedef const Polynomial<T> slip::Polynomial< T >::const_self |
Definition at line 155 of file Polynomial.hpp.
| typedef ptrdiff_t slip::Polynomial< T >::difference_type |
Definition at line 162 of file Polynomial.hpp.
| typedef pointer slip::Polynomial< T >::iterator |
Definition at line 165 of file Polynomial.hpp.
| typedef std::random_access_iterator_tag slip::Polynomial< T >::iterator_category |
Definition at line 173 of file Polynomial.hpp.
| typedef value_type* slip::Polynomial< T >::pointer |
Definition at line 157 of file Polynomial.hpp.
| typedef value_type& slip::Polynomial< T >::reference |
Definition at line 159 of file Polynomial.hpp.
| typedef std::reverse_iterator<iterator> slip::Polynomial< T >::reverse_iterator |
Definition at line 168 of file Polynomial.hpp.
| typedef Polynomial<T> slip::Polynomial< T >::self |
Definition at line 154 of file Polynomial.hpp.
| typedef std::size_t slip::Polynomial< T >::size_type |
Definition at line 163 of file Polynomial.hpp.
| typedef T slip::Polynomial< T >::value_type |
Definition at line 153 of file Polynomial.hpp.
|
inline |
Constructs a Polynomial.
Definition at line 836 of file Polynomial.hpp.
| slip::Polynomial< T >::Polynomial | ( | const size_type | n | ) |
Constructs a Polynomial.
| n | number of element in the Polynomial |
| slip::Polynomial< T >::Polynomial | ( | const size_type | n, |
| const T & | val | ||
| ) |
Constructs a Polynomial initialized by the scalar value val.
| n | number of element in the Polynomial |
| val | initialization value of the elements |
| slip::Polynomial< T >::Polynomial | ( | const size_type | n, |
| const T * | val | ||
| ) |
Constructs a Polynomial initialized by an array val.
| n | number of element in the Polynomial |
| val | initialization array value of the elements |
|
inline |
Contructs a Polynomial from a range.
| first | An input iterator. |
| last | An input iterator. |
Definition at line 217 of file Polynomial.hpp.
|
inline |
Constructs a copy of the Polynomial rhs.
Definition at line 864 of file Polynomial.hpp.
|
inline |
Destructor of the Polynomial.
Definition at line 882 of file Polynomial.hpp.
|
inline |
Definition at line 842 of file Polynomial.hpp.
|
inline |
Definition at line 848 of file Polynomial.hpp.
|
inline |
Definition at line 855 of file Polynomial.hpp.
|
inline |
Returns a read/write iterator that points to the first element in the Polynomial. Iteration is done in ordinary element order.
Definition at line 898 of file Polynomial.hpp.
|
inline |
Returns a read-only (constant) iterator that points to the first element in the Polynomial. Iteration is done in ordinary element order.
Definition at line 912 of file Polynomial.hpp.
|
inline |
Computes the companion matrix corresponding to polynomial coefficients.
Definition at line 1065 of file Polynomial.hpp.
|
inline |
Returns the degree of the Polynomial.
Definition at line 1122 of file Polynomial.hpp.
|
inline |
Returns the derivative the polynomial.
Definition at line 1005 of file Polynomial.hpp.
|
inline |
Returns true if the Polynomial is empty. (Thus size() == 0)
Definition at line 1145 of file Polynomial.hpp.
|
inline |
Returns a read/write iterator that points one past the last element in the Polynomial. Iteration is done in ordinary element order.
Definition at line 905 of file Polynomial.hpp.
|
inline |
Returns a read-only (constant) iterator that points one past the last element in the Polynomial. Iteration is done in ordinary element order.
Definition at line 919 of file Polynomial.hpp.
|
inline |
Returns the evaluation of the polynomial at x.
| x | Location to be evaluated. |
Definition at line 1104 of file Polynomial.hpp.
|
inline |
Fills the container range [begin(),begin()+size()) with copies of value.
| value | A reference-to-const of arbitrary type. |
Definition at line 349 of file Polynomial.hpp.
|
inline |
Fills the container range [begin(),begin()+size()) with a copy of the value array.
| value | A pointer of arbitrary type. |
Definition at line 368 of file Polynomial.hpp.
|
inline |
Fills the container range [begin(),begin()+size()) with a copy of the range [first,last)
| first | An input iterator. |
| last | An input iterator. |
Definition at line 383 of file Polynomial.hpp.
|
inline |
Return a polynomial P(X) of degree order that minimizes sum_i (P(x(i)) - y(i))^2 to best fit the data in the least squares sense.
| xi_first | const_iterator on the xi first value |
| xi_last | const_iterator on the xi past-the-end value |
| yi_first | const_iterator on the yi first value |
| order | Order or degree of the polynomial that fit the data. |
Definition at line 1044 of file Polynomial.hpp.
|
inline |
Returns the integral of the polynomial. The constant of integrationis set to zero.
Definition at line 1029 of file Polynomial.hpp.
|
inline |
Returns the maximal size (number of elements) in the Polynomial.
Definition at line 1138 of file Polynomial.hpp.
|
inline |
Returns the evaluation of the polynomial at each element of the range [first,last).
| first | InputIterator. |
| last | InputIterator. |
| result | OutputIterator. |
Definition at line 621 of file Polynomial.hpp.
|
inline |
Returns the name of the class.
Definition at line 1113 of file Polynomial.hpp.
| reference slip::Polynomial< T >::operator() | ( | const size_type | i | ) |
Subscript access to the data contained in the Polynomial.
| i | The index of the row for which the data should be accessed. |
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.
| const_reference slip::Polynomial< T >::operator() | ( | const size_type | i | ) | const |
Subscript access to the data contained in the Polynomial.
| i | The index of the row for which the data should be accessed. |
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.
|
inline |
Definition at line 1177 of file Polynomial.hpp.
|
inline |
Definition at line 1252 of file Polynomial.hpp.
|
inline |
Add val to each element of the Polynomial.
| val | value |
Definition at line 1157 of file Polynomial.hpp.
|
inline |
Definition at line 1205 of file Polynomial.hpp.
|
inline |
Definition at line 1196 of file Polynomial.hpp.
|
inline |
Definition at line 1167 of file Polynomial.hpp.
|
inline |
Definition at line 1228 of file Polynomial.hpp.
|
inline |
Definition at line 1186 of file Polynomial.hpp.
|
inline |
Assign a Polynomial.
Assign elements of Polynomial in rhs
| rhs | Polynomial to get the values from. |
Definition at line 870 of file Polynomial.hpp.
|
inline |
Assigns all the element of the Polynomial by val.
| val | affectation value |
Definition at line 889 of file Polynomial.hpp.
| reference slip::Polynomial< T >::operator[] | ( | const size_type | i | ) |
Subscript access to the data contained in the Polynomial.
| i | The index of the row for which the data should be accessed. |
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.
| const_reference slip::Polynomial< T >::operator[] | ( | const size_type | i | ) | const |
Subscript access to the data contained in the Polynomial.
| i | The index of the row for which the data should be accessed. |
This operator allows for easy, array-style, data access. Note that data access with this operator is unchecked and out_of_range lookups are not defined.
|
inline |
Returns the order of the Polynomial.
Definition at line 1131 of file Polynomial.hpp.
|
inline |
Returns a read/write reverse iterator that points to the last element in the Polynomial. Iteration is done in reverse element order.
Definition at line 927 of file Polynomial.hpp.
|
inline |
Returns a read-only (constant) reverse iterator that points to the last element in the Polynomial. Iteration is done in reverse element order.
Definition at line 941 of file Polynomial.hpp.
|
inline |
Returns a read/write reverse iterator that points to one before the first element in the Polynomial. Iteration is done in reverse element order.
Definition at line 934 of file Polynomial.hpp.
|
inline |
Returns a read-only (constant) reverse iterator that points to one before the first element in the Polynomial. Iteration is done in reverse element order.
Definition at line 948 of file Polynomial.hpp.
|
inline |
Computes the roots of the polynomial.
Definition at line 1093 of file Polynomial.hpp.
|
inline |
Returns the number of elements in the Polynomial.
Definition at line 1117 of file Polynomial.hpp.
|
inline |
Swaps data with another Polynomial.
| M | A Polynomial of the same element type |
Definition at line 1149 of file Polynomial.hpp.
|
friend |
Definition at line 698 of file Polynomial.hpp.
|
friend |
Polynomial inequality comparison.
| x | A Polynomial |
| y | A Polynomial of the same type of x |
Definition at line 1430 of file Polynomial.hpp.
|
related |
pointwise multiplication of two Polynomial
| V1 | The first Polynomial |
| V2 | The second Polynomial |
Definition at line 1368 of file Polynomial.hpp.
|
related |
multiplication of a scalar to each element of a Polynomial
| V | The Polynomial |
| val | The scalar |
Definition at line 1390 of file Polynomial.hpp.
|
related |
multiplication of a scalar to each element of a Polynomial
| val | The scalar |
| V | The Polynomial |
Definition at line 1400 of file Polynomial.hpp.
|
related |
pointwise addition of two Polynomial
| V1 | The first Polynomial |
| V2 | The second Polynomial |
Definition at line 1312 of file Polynomial.hpp.
|
related |
addition of a scalar to each element of a Polynomial
| V | The Polynomial |
| val | The scalar |
Definition at line 1322 of file Polynomial.hpp.
|
related |
addition of a scalar to each element of a Polynomial
| val | The scalar |
| V | The Polynomial |
Definition at line 1332 of file Polynomial.hpp.
|
related |
pointwise substraction of two Polynomial
| V1 | The first Polynomial |
| V2 | The second Polynomial |
Definition at line 1340 of file Polynomial.hpp.
|
related |
substraction of a scalar to each element of a Polynomial
| V | The Polynomial |
| val | The scalar |
Definition at line 1350 of file Polynomial.hpp.
|
related |
substraction of a scalar to each element of a Polynomial
| val | The scalar |
| V | The Polynomial |
Definition at line 1360 of file Polynomial.hpp.
|
related |
division of a scalar to each element of a Polynomial
| V | The Polynomial |
| val | The scalar |
Definition at line 1410 of file Polynomial.hpp.
|
friend |
Less than comparison operator (Polynomial ordering relation)
| x | A Polynomial |
| y | A Polynomial of the same type of x |
Definition at line 1440 of file Polynomial.hpp.
|
friend |
Write the Polynomial to the ouput stream.
| out | output std:ostream |
| v | Polynomial to write to the output stream |
Definition at line 956 of file Polynomial.hpp.
|
friend |
Less than equal comparison operator.
| x | A Polynomial |
| y | A Polynomial of the same type of x |
Definition at line 1456 of file Polynomial.hpp.
|
friend |
Polynomial equality comparison.
| x | A Polynomial |
| y | A Polynomial of the same type of x |
Definition at line 1422 of file Polynomial.hpp.
|
friend |
More than comparison operator.
| x | A Polynomial |
| y | A Polynomial of the same type of x |
Definition at line 1448 of file Polynomial.hpp.
|
friend |
More than equal comparison operator.
| x | A Polynomial |
| y | A Polynomial of the same type of x |
Definition at line 1464 of file Polynomial.hpp.
1.8.6