vnl_complex_eigensystem.h
Go to the documentation of this file.
1 #ifndef vnl_complex_eigensystem_h_
2 #define vnl_complex_eigensystem_h_
3 //:
4 // \file
5 // \brief Calculates eigenvalues and eigenvectors of a square complex matrix
6 // \author fsm
7 //
8 // \verbatim
9 // Modifications
10 // dac (Manchester) 26/03/2001: tidied up documentation
11 // \endverbatim
12 
13 #include <complex>
14 #ifdef _MSC_VER
15 # include <vcl_msvc_warnings.h>
16 #endif
17 #include <vnl/vnl_vector.h>
18 #include <vnl/vnl_matrix.h>
19 
20 #include <vnl/algo/vnl_algo_export.h>
21 
22 //: Calculates eigenvalues and eigenvectors of a square complex matrix
23 //
24 // Class to compute and hold the eigenvalues and (optionally) eigenvectors
25 // of a square complex matrix, using the LAPACK routine zgeev.
26 //
27 // Default behaviour is to compute the eigenvalues and the right
28 // eigenvectors.
29 //
30 // The input NxN matrix A is passed into the constructor. The flags
31 // right,left request the calculation of right and left eigenvectors
32 // respectively. The compute eigenvalues are stored in the member 'W'.
33 //
34 // Computed right eigenvectors are stored in the **ROWS** of the
35 // member 'R' and computed left eigenvectors are stored in the **ROWS**
36 // of the member 'L'. When eigenvectors are not requested, the
37 // corresponding matrices L and R will be empty.
38 //
39 // The ith right eigenvector v satisfies A*v = W[i]*v \n
40 // The ith left eigenvector u satisfies u*A = W[i]*u (no conjugation)
41 
42 class VNL_ALGO_EXPORT vnl_complex_eigensystem
43 {
44  public:
45  // please do not add underscores to my members - they are publicly accessible
46  unsigned int const N;
50 
51  // constructors
53  vnl_matrix<double> const& A_imag,
54  bool right=true, bool left=false);
55 
56  vnl_complex_eigensystem(vnl_matrix<std::complex<double> > const& A,
57  bool right=true, bool left=false);
58 
59  // convenience methods
60  std::complex<double> eigen_value(unsigned i) const { return W[i]; }
62  const { return L.get_row(i); }
64  const { return R.get_row(i); }
65 
66  private:
67  void compute(vnl_matrix<std::complex<double> > const&,bool,bool);
68 };
69 
70 #endif // vnl_complex_eigensystem_h_
An ordinary mathematical matrix.
std::complex< double > eigen_value(unsigned i) const
vnl_matrix< std::complex< double > > R
vnl_vector< std::complex< double > > left_eigen_vector(unsigned i) const
vnl_matrix< std::complex< double > > L
An ordinary mathematical matrix.
Definition: vnl_adjugate.h:22
Mathematical vector class, templated by type of element.
Definition: vnl_fwd.h:16
vnl_vector< std::complex< double > > right_eigen_vector(unsigned i) const
vnl_vector< T > get_row(unsigned r) const
Get a vector equal to the given row.
Definition: vnl_matrix.hxx:962
Calculates eigenvalues and eigenvectors of a square complex matrix.
vnl_vector< std::complex< double > > W