1 #ifndef vnl_cpoly_roots_h_
2 #define vnl_cpoly_roots_h_
3 
4 //:
5 //  \file
6 //  \brief  finds roots of a univariate polynomial with complex coefficients
7 //  \author fsm
8 //
9 // \verbatim
10 // Modifications
11 //  dac (Manchester) March 28th 2001: Tidied documentation
12 // \endverbatim
13 
14 #include <complex>
15 #ifdef _MSC_VER
16 #  include <vcl_msvc_warnings.h>
17 #endif
18 #include <vnl/vnl_vector.h>
19 #include <vnl/algo/vnl_algo_export.h>
20 
21 //: Find all the roots of a univariate polynomial with complex coefficients.
22 //  Class to find all the roots of a univariate polynomial f
23 //  with complex coefficients. Currently works by computing the
24 //  eigenvalues of the companion matrix of f.
25 //
26 //  The input vector a of coefficients are given to the constructor.
27 //  The polynomial is f = t^N + a[0] t^{N-1} + ... + a[N-1]
28 //  The roots can then be found in the 'solns' member.
29 
30 class VNL_ALGO_EXPORT vnl_cpoly_roots
31 {
32 public:
33   vnl_cpoly_roots(vnl_vector<std::complex<double> > const & a);
34   vnl_cpoly_roots(vnl_vector<double> const & a_real,
35                   vnl_vector<double> const & a_imag);
36 
37   // the roots can be found in here :
38   vnl_vector<std::complex<double> > solns;
39 
40 private:
41   unsigned N; //degree
42   //: does the actual work
43   void compute(vnl_vector<std::complex<double> > const & a);
44 };
45 
46 #endif // vnl_cpoly_roots_h_
47