00001 #ifndef vnl_cpoly_roots_h_ 00002 #define vnl_cpoly_roots_h_ 00003 00004 //: 00005 // \file 00006 // \brief finds roots of a univariate polynomial with complex coefficients 00007 // \author fsm@robots.ox.ac.uk 00008 // 00009 // Modifications 00010 // dac (Manchester) March 28th 2001: Tidied documentation 00011 // 00012 // 00013 00014 #include <vcl_complex.h> 00015 #include <vnl/vnl_vector.h> 00016 #include <vnl/vnl_matrix.h> 00017 00018 //: Find all the roots of a univariate polynomial with complex coefficients. 00019 // Class to find all the roots of a univariate polynomial f 00020 // with complex coefficients. Currently works by computing the 00021 // eigenvalues of the companion matrix of f. 00022 // 00023 // The input vector a of coefficients are given to the constructor. 00024 // The polynomial is f = t^N + a[0] t^{N-1} + ... + a[N-1] 00025 // The roots can then be found in the 'solns' member. 00026 // 00027 00028 class vnl_cpoly_roots { 00029 public: 00030 vnl_cpoly_roots(vnl_vector<vcl_complex<double> > const & a); 00031 vnl_cpoly_roots(vnl_vector<double> const & a_real, 00032 vnl_vector<double> const & a_imag); 00033 00034 // the roots can be found in here : 00035 vnl_vector<vcl_complex<double> > solns; 00036 00037 private: 00038 unsigned N; //degree 00039 //: does the actual work 00040 void compute(vnl_vector<vcl_complex<double> > const & a); 00041 }; 00042 00043 #endif // vnl_cpoly_roots_h_