00001 #ifndef vnl_generalized_eigensystem_h_ 00002 #define vnl_generalized_eigensystem_h_ 00003 00004 //: 00005 // \file 00006 // \brief Solves the generalized eigenproblem Ax=La 00007 // \author Andrew W. Fitzgibbon, Oxford RRG, 29 Aug 96 00008 // 00009 // Modifications 00010 // dac (Manchester) 28/03/2001: tidied up documentation 00011 // 00012 00013 #include <vnl/vnl_diag_matrix.h> 00014 00015 //: Solves the generalized eigenproblem Ax=La 00016 // Solves the generalized eigenproblem of @{ $A x = \lambda B x$ @}, 00017 // with $A$ symmetric and $B$ positive definite. 00018 // See Golub and van Loan, Section 8.7. 00019 00020 class vnl_generalized_eigensystem { 00021 public: 00022 // Public data members because they're unique. 00023 int n; 00024 00025 //: @{ Solve real generalized eigensystem $A x = \lambda B x$ for 00026 // $\lambda$ and $x$, where $A$ symmetric, $B$ positive definite. 00027 // Initializes storage for the matrix $V = [ x_0 x_1 .. x_n ]$ and 00028 // the vnl_diag_matrix $D = [ \lambda_0 \lambda_1 ... \lambda_n ]$. 00029 // The eigenvalues are sorted into increasing order (of value, not 00030 // absolute value). 00031 // \par 00032 // Uses vnl_cholesky decomposition $C^\top C = B$, to convert to 00033 // $C^{-\top} A C^{-1} x = \lambda x$ and then uses the 00034 // Symmetric eigensystem code. It will print a verbose warning 00035 // if $B$ is not positive definite. 00036 // @} 00037 vnl_generalized_eigensystem(const vnl_matrix<double>& A, 00038 const vnl_matrix<double>& B); 00039 00040 //: Public eigenvectors. After construction, this contains the matrix of 00041 // eigenvectors. 00042 vnl_matrix<double> V; 00043 00044 //: Public eigenvalues. After construction, this contains the diagonal 00045 // matrix of eigenvalues, stored as a vector. 00046 vnl_diag_matrix<double> D; 00047 }; 00048 00049 #endif // vnl_generalized_eigensystem_h_