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