Line data Source code
1 1 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : /// \file 5 : /// Defines function find_generalized_eigenvalues. 6 : 7 : #pragma once 8 : 9 : /// \cond 10 : class DataVector; 11 : class Matrix; 12 : namespace gsl { 13 : template <typename T> 14 : class not_null; 15 : } // namespace gsl 16 : /// \endcond 17 : 18 : /*! 19 : * \ingroup NumericalAlgorithmsGroup 20 : * \brief Solve the generalized eigenvalue problem for two matrices. 21 : * 22 : * This function uses the lapack routine dggev 23 : * (http://www.netlib.org/lapack/explore-3.1.1-html/dggev.f.html) 24 : * to solve the 25 : * generalized eigenvalue problem \f$A v_a =\lambda_a B v_a \f$ 26 : * for the generalized eigenvalues \f$\lambda_a\f$ and corresponding 27 : * eigenvectors \f$v_a\f$. 28 : * `matrix_a` and `matrix_b` are each a `Matrix`; they correspond to square 29 : * matrices \f$A\f$ and \f$B\f$ that are the same dimension \f$N\f$. 30 : * `eigenvalues_real_part` is a `DataVector` of size \f$N\f$ that 31 : * will store the real parts of the eigenvalues, 32 : * `eigenvalues_imaginary_part` is a `DataVector` of size \f$N\f$ 33 : * that will store the imaginary parts of the eigenvalues. 34 : * Complex eigenvalues always form complex conjugate pairs, and 35 : * the \f$j\f$ and \f$j+1\f$ eigenvalues will have the forms 36 : * \f$a+ib\f$ and \f$a-ib\f$, respectively. The eigenvectors 37 : * are returned as the columns of a square `Matrix` of dimension \f$N\f$ 38 : * called `eigenvectors`. If eigenvalue \f$j\f$ is real, then column \f$j\f$ of 39 : * `eigenvectors` is 40 : * the corresponding eigenvector. If eigenvalue \f$j\f$ and \f$j+1\f$ are 41 : * complex-conjugate pairs, then the eigenvector for 42 : * eigenvalue \f$j\f$ is (column j) + \f$i\f$ (column j+1), and the 43 : * eigenvector for eigenvalue \f$j+1\f$ is (column j) - \f$i\f$ (column j+1). 44 : * 45 : */ 46 1 : void find_generalized_eigenvalues( 47 : gsl::not_null<DataVector*> eigenvalues_real_part, 48 : gsl::not_null<DataVector*> eigenvalues_imaginary_part, 49 : gsl::not_null<Matrix*> eigenvectors, Matrix matrix_a, Matrix matrix_b);