<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.5"/> <title>Eigen: EigenSolver< _MatrixType > Class Template Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> $(document).ready(initResizable); $(window).load(resizeHeight); </script> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="search/search.js"></script> <script type="text/javascript"> $(document).ready(function() { searchBox.OnSelectItem(0); }); </script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> <link href="eigendoxy.css" rel="stylesheet" type="text/css"> <!-- --> <script type="text/javascript" src="eigen_navtree_hacks.js"></script> <!-- <script type="text/javascript"> --> <!-- </script> --> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <!-- <a name="top"></a> --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectlogo"><img alt="Logo" src="Eigen_Silly_Professor_64x64.png"/></td> <td style="padding-left: 0.5em;"> <div id="projectname"><a href="http://eigen.tuxfamily.org">Eigen</a>  <span id="projectnumber">3.2.0</span> </div> </td> <td> <div id="MSearchBox" class="MSearchBoxInactive"> <span class="left"> <img id="MSearchSelect" src="search/mag_sel.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> </span><span class="right"> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </span> </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> $(document).ready(function(){initNavTree('classEigen_1_1EigenSolver.html','');}); </script> <div id="doc-content"> <!-- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark"> </span>Pages</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="javascript:void(0)" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <div class="header"> <div class="summary"> <a href="classEigen_1_1EigenSolver-members.html">List of all members</a> | <a href="#pub-types">Public Types</a> | <a href="#pub-methods">Public Member Functions</a> </div> <div class="headertitle"> <div class="title">EigenSolver< _MatrixType > Class Template Reference<div class="ingroups"><a class="el" href="group__Eigenvalues__Module.html">Eigenvalues module</a></div></div> </div> </div><!--header--> <div class="contents"> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><h3>template<typename _MatrixType><br/> class Eigen::EigenSolver< _MatrixType ></h3> <p>Computes eigenvalues and eigenvectors of general matrices. </p> <p>This is defined in the Eigenvalues module.</p> <div class="fragment"><div class="line"><span class="preprocessor">#include <Eigen/Eigenvalues></span> </div> </div><!-- fragment --><dl class="tparams"><dt>Template Parameters</dt><dd> <table class="tparams"> <tr><td class="paramname">_MatrixType</td><td>the type of the matrix of which we are computing the eigendecomposition; this is expected to be an instantiation of the <a class="el" href="classEigen_1_1Matrix.html" title="The matrix class, also used for vectors and row-vectors. ">Matrix</a> class template. Currently, only real matrices are supported.</td></tr> </table> </dd> </dl> <p>The eigenvalues and eigenvectors of a matrix <img class="formulaInl" alt="$ A $" src="form_1.png"/> are scalars <img class="formulaInl" alt="$ \lambda $" src="form_38.png"/> and vectors <img class="formulaInl" alt="$ v $" src="form_13.png"/> such that <img class="formulaInl" alt="$ Av = \lambda v $" src="form_39.png"/>. If <img class="formulaInl" alt="$ D $" src="form_10.png"/> is a diagonal matrix with the eigenvalues on the diagonal, and <img class="formulaInl" alt="$ V $" src="form_40.png"/> is a matrix with the eigenvectors as its columns, then <img class="formulaInl" alt="$ A V = V D $" src="form_41.png"/>. The matrix <img class="formulaInl" alt="$ V $" src="form_40.png"/> is almost always invertible, in which case we have <img class="formulaInl" alt="$ A = V D V^{-1} $" src="form_42.png"/>. This is called the eigendecomposition.</p> <p>The eigenvalues and eigenvectors of a matrix may be complex, even when the matrix is real. However, we can choose real matrices <img class="formulaInl" alt="$ V $" src="form_40.png"/> and <img class="formulaInl" alt="$ D $" src="form_10.png"/> satisfying <img class="formulaInl" alt="$ A V = V D $" src="form_41.png"/>, just like the eigendecomposition, if the matrix <img class="formulaInl" alt="$ D $" src="form_10.png"/> is not required to be diagonal, but if it is allowed to have blocks of the form </p> <p class="formulaDsp"> <img class="formulaDsp" alt="\[ \begin{bmatrix} u & v \\ -v & u \end{bmatrix} \]" src="form_49.png"/> </p> <p> (where <img class="formulaInl" alt="$ u $" src="form_50.png"/> and <img class="formulaInl" alt="$ v $" src="form_13.png"/> are real numbers) on the diagonal. These blocks correspond to complex eigenvalue pairs <img class="formulaInl" alt="$ u \pm iv $" src="form_51.png"/>. We call this variant of the eigendecomposition the pseudo-eigendecomposition.</p> <p>Call the function <a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8" title="Computes eigendecomposition of given matrix. ">compute()</a> to compute the eigenvalues and eigenvectors of a given matrix. Alternatively, you can use the <a class="el" href="classEigen_1_1EigenSolver.html#a8c287af80cfd71517094b75dcad2a31b" title="Constructor; computes eigendecomposition of given matrix. ">EigenSolver(const MatrixType&, bool)</a> constructor which computes the eigenvalues and eigenvectors at construction time. Once the eigenvalue and eigenvectors are computed, they can be retrieved with the <a class="el" href="classEigen_1_1EigenSolver.html#a1165fd63a951c6afaf239174d22e9945" title="Returns the eigenvalues of given matrix. ">eigenvalues()</a> and <a class="el" href="classEigen_1_1EigenSolver.html#a3236af3afbc89241aaed4fc868aa8435" title="Returns the eigenvectors of given matrix. ">eigenvectors()</a> functions. The <a class="el" href="classEigen_1_1EigenSolver.html#a4140972e2b45343d1ef1793c2824159c" title="Returns the block-diagonal matrix in the pseudo-eigendecomposition. ">pseudoEigenvalueMatrix()</a> and <a class="el" href="classEigen_1_1EigenSolver.html#a3b6c3b38f50c2372de195ff955a4e02d" title="Returns the pseudo-eigenvectors of given matrix. ">pseudoEigenvectors()</a> methods allow the construction of the pseudo-eigendecomposition.</p> <p>The documentation for <a class="el" href="classEigen_1_1EigenSolver.html#a8c287af80cfd71517094b75dcad2a31b" title="Constructor; computes eigendecomposition of given matrix. ">EigenSolver(const MatrixType&, bool)</a> contains an example of the typical use of this class.</p> <dl class="section note"><dt>Note</dt><dd>The implementation is adapted from <a href="http://math.nist.gov/javanumerics/jama/">JAMA</a> (public domain). Their code is based on EISPACK.</dd></dl> <dl class="section see"><dt>See Also</dt><dd><a class="el" href="classEigen_1_1MatrixBase.html#a0ffa061371b1bd1b9f14ecef94b4502e" title="Computes the eigenvalues of a matrix. ">MatrixBase::eigenvalues()</a>, class <a class="el" href="classEigen_1_1ComplexEigenSolver.html" title="Computes eigenvalues and eigenvectors of general complex matrices. ">ComplexEigenSolver</a>, class <a class="el" href="classEigen_1_1SelfAdjointEigenSolver.html" title="Computes eigenvalues and eigenvectors of selfadjoint matrices. ">SelfAdjointEigenSolver</a> </dd></dl> </div><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a> Public Types</h2></td></tr> <tr class="memitem:a1b9bc0a45616064df3a6168395e3cfcc"><td class="memItemLeft" align="right" valign="top">typedef std::complex< RealScalar > </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a1b9bc0a45616064df3a6168395e3cfcc">ComplexScalar</a></td></tr> <tr class="memdesc:a1b9bc0a45616064df3a6168395e3cfcc"><td class="mdescLeft"> </td><td class="mdescRight">Complex scalar type for <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf" title="Synonym for the template parameter _MatrixType. ">MatrixType</a>. <a href="#a1b9bc0a45616064df3a6168395e3cfcc">More...</a><br/></td></tr> <tr class="separator:a1b9bc0a45616064df3a6168395e3cfcc"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a62dc35c9c355abf830869b1bad883c74"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="classEigen_1_1Matrix.html">Matrix</a>< <a class="el" href="classEigen_1_1EigenSolver.html#a1b9bc0a45616064df3a6168395e3cfcc">ComplexScalar</a>, <br class="typebreak"/> ColsAtCompileTime, 1, Options <br class="typebreak"/> &~<a class="el" href="group__enums.html#gga0c5bde183ecefe103f70b49ad9740bcda1e16fa1b92ed7a058cd4ce7a9a0db044">RowMajor</a>, <br class="typebreak"/> MaxColsAtCompileTime, 1 > </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a62dc35c9c355abf830869b1bad883c74">EigenvalueType</a></td></tr> <tr class="memdesc:a62dc35c9c355abf830869b1bad883c74"><td class="mdescLeft"> </td><td class="mdescRight">Type for vector of eigenvalues as returned by <a class="el" href="classEigen_1_1EigenSolver.html#a1165fd63a951c6afaf239174d22e9945" title="Returns the eigenvalues of given matrix. ">eigenvalues()</a>. <a href="#a62dc35c9c355abf830869b1bad883c74">More...</a><br/></td></tr> <tr class="separator:a62dc35c9c355abf830869b1bad883c74"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a50d070013a795db5621119f2b4a3d781"><td class="memItemLeft" align="right" valign="top">typedef <a class="el" href="classEigen_1_1Matrix.html">Matrix</a>< <a class="el" href="classEigen_1_1EigenSolver.html#a1b9bc0a45616064df3a6168395e3cfcc">ComplexScalar</a>, <br class="typebreak"/> RowsAtCompileTime, <br class="typebreak"/> ColsAtCompileTime, Options, <br class="typebreak"/> MaxRowsAtCompileTime, <br class="typebreak"/> MaxColsAtCompileTime > </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a50d070013a795db5621119f2b4a3d781">EigenvectorsType</a></td></tr> <tr class="memdesc:a50d070013a795db5621119f2b4a3d781"><td class="mdescLeft"> </td><td class="mdescRight">Type for matrix of eigenvectors as returned by <a class="el" href="classEigen_1_1EigenSolver.html#a3236af3afbc89241aaed4fc868aa8435" title="Returns the eigenvectors of given matrix. ">eigenvectors()</a>. <a href="#a50d070013a795db5621119f2b4a3d781">More...</a><br/></td></tr> <tr class="separator:a50d070013a795db5621119f2b4a3d781"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aeb6c0eb89cc982629305f6c7e0791caf"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aeb6c0eb89cc982629305f6c7e0791caf"></a> typedef _MatrixType </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a></td></tr> <tr class="memdesc:aeb6c0eb89cc982629305f6c7e0791caf"><td class="mdescLeft"> </td><td class="mdescRight">Synonym for the template parameter <code>_MatrixType</code>. <br/></td></tr> <tr class="separator:aeb6c0eb89cc982629305f6c7e0791caf"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a3f6fc00047c205ee590f676934aab28f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3f6fc00047c205ee590f676934aab28f"></a> typedef MatrixType::Scalar </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a3f6fc00047c205ee590f676934aab28f">Scalar</a></td></tr> <tr class="memdesc:a3f6fc00047c205ee590f676934aab28f"><td class="mdescLeft"> </td><td class="mdescRight">Scalar type for matrices of type <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf" title="Synonym for the template parameter _MatrixType. ">MatrixType</a>. <br/></td></tr> <tr class="separator:a3f6fc00047c205ee590f676934aab28f"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:a0e257dae8f1774fdda178482caa65be8"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classEigen_1_1EigenSolver.html">EigenSolver</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8">compute</a> (const <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a> &matrix, bool computeEigenvectors=true)</td></tr> <tr class="memdesc:a0e257dae8f1774fdda178482caa65be8"><td class="mdescLeft"> </td><td class="mdescRight">Computes eigendecomposition of given matrix. <a href="#a0e257dae8f1774fdda178482caa65be8">More...</a><br/></td></tr> <tr class="separator:a0e257dae8f1774fdda178482caa65be8"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a838424bc2f923e06e7690965bf6d7769"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a838424bc2f923e06e7690965bf6d7769">EigenSolver</a> ()</td></tr> <tr class="memdesc:a838424bc2f923e06e7690965bf6d7769"><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <a href="#a838424bc2f923e06e7690965bf6d7769">More...</a><br/></td></tr> <tr class="separator:a838424bc2f923e06e7690965bf6d7769"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:af3bf2ce4a17b33b9e298170677f2f0c0"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#af3bf2ce4a17b33b9e298170677f2f0c0">EigenSolver</a> (Index size)</td></tr> <tr class="memdesc:af3bf2ce4a17b33b9e298170677f2f0c0"><td class="mdescLeft"> </td><td class="mdescRight">Default constructor with memory preallocation. <a href="#af3bf2ce4a17b33b9e298170677f2f0c0">More...</a><br/></td></tr> <tr class="separator:af3bf2ce4a17b33b9e298170677f2f0c0"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a8c287af80cfd71517094b75dcad2a31b"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a8c287af80cfd71517094b75dcad2a31b">EigenSolver</a> (const <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a> &matrix, bool computeEigenvectors=true)</td></tr> <tr class="memdesc:a8c287af80cfd71517094b75dcad2a31b"><td class="mdescLeft"> </td><td class="mdescRight">Constructor; computes eigendecomposition of given matrix. <a href="#a8c287af80cfd71517094b75dcad2a31b">More...</a><br/></td></tr> <tr class="separator:a8c287af80cfd71517094b75dcad2a31b"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1165fd63a951c6afaf239174d22e9945"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classEigen_1_1EigenSolver.html#a62dc35c9c355abf830869b1bad883c74">EigenvalueType</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a1165fd63a951c6afaf239174d22e9945">eigenvalues</a> () const </td></tr> <tr class="memdesc:a1165fd63a951c6afaf239174d22e9945"><td class="mdescLeft"> </td><td class="mdescRight">Returns the eigenvalues of given matrix. <a href="#a1165fd63a951c6afaf239174d22e9945">More...</a><br/></td></tr> <tr class="separator:a1165fd63a951c6afaf239174d22e9945"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a3236af3afbc89241aaed4fc868aa8435"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classEigen_1_1EigenSolver.html#a50d070013a795db5621119f2b4a3d781">EigenvectorsType</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a3236af3afbc89241aaed4fc868aa8435">eigenvectors</a> () const </td></tr> <tr class="memdesc:a3236af3afbc89241aaed4fc868aa8435"><td class="mdescLeft"> </td><td class="mdescRight">Returns the eigenvectors of given matrix. <a href="#a3236af3afbc89241aaed4fc868aa8435">More...</a><br/></td></tr> <tr class="separator:a3236af3afbc89241aaed4fc868aa8435"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ab6f0a63ea1d26cef5e748207043eb43e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab6f0a63ea1d26cef5e748207043eb43e"></a> Index </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#ab6f0a63ea1d26cef5e748207043eb43e">getMaxIterations</a> ()</td></tr> <tr class="memdesc:ab6f0a63ea1d26cef5e748207043eb43e"><td class="mdescLeft"> </td><td class="mdescRight">Returns the maximum number of iterations. <br/></td></tr> <tr class="separator:ab6f0a63ea1d26cef5e748207043eb43e"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a4140972e2b45343d1ef1793c2824159c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a4140972e2b45343d1ef1793c2824159c">pseudoEigenvalueMatrix</a> () const </td></tr> <tr class="memdesc:a4140972e2b45343d1ef1793c2824159c"><td class="mdescLeft"> </td><td class="mdescRight">Returns the block-diagonal matrix in the pseudo-eigendecomposition. <a href="#a4140972e2b45343d1ef1793c2824159c">More...</a><br/></td></tr> <tr class="separator:a4140972e2b45343d1ef1793c2824159c"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a3b6c3b38f50c2372de195ff955a4e02d"><td class="memItemLeft" align="right" valign="top">const <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#a3b6c3b38f50c2372de195ff955a4e02d">pseudoEigenvectors</a> () const </td></tr> <tr class="memdesc:a3b6c3b38f50c2372de195ff955a4e02d"><td class="mdescLeft"> </td><td class="mdescRight">Returns the pseudo-eigenvectors of given matrix. <a href="#a3b6c3b38f50c2372de195ff955a4e02d">More...</a><br/></td></tr> <tr class="separator:a3b6c3b38f50c2372de195ff955a4e02d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ab70fdf436af2c43b7174e2981f618fb3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab70fdf436af2c43b7174e2981f618fb3"></a> <a class="el" href="classEigen_1_1EigenSolver.html">EigenSolver</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classEigen_1_1EigenSolver.html#ab70fdf436af2c43b7174e2981f618fb3">setMaxIterations</a> (Index maxIters)</td></tr> <tr class="memdesc:ab70fdf436af2c43b7174e2981f618fb3"><td class="mdescLeft"> </td><td class="mdescRight">Sets the maximum number of iterations allowed. <br/></td></tr> <tr class="separator:ab70fdf436af2c43b7174e2981f618fb3"><td class="memSeparator" colspan="2"> </td></tr> </table> <h2 class="groupheader">Member Typedef Documentation</h2> <a class="anchor" id="a1b9bc0a45616064df3a6168395e3cfcc"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef std::complex<RealScalar> <a class="el" href="classEigen_1_1EigenSolver.html#a1b9bc0a45616064df3a6168395e3cfcc">ComplexScalar</a></td> </tr> </table> </div><div class="memdoc"> <p>Complex scalar type for <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf" title="Synonym for the template parameter _MatrixType. ">MatrixType</a>. </p> <p>This is <code>std::complex<Scalar></code> if <a class="el" href="classEigen_1_1EigenSolver.html#a3f6fc00047c205ee590f676934aab28f" title="Scalar type for matrices of type MatrixType. ">Scalar</a> is real (e.g., <code>float</code> or <code>double</code>) and just <code>Scalar</code> if <a class="el" href="classEigen_1_1EigenSolver.html#a3f6fc00047c205ee590f676934aab28f" title="Scalar type for matrices of type MatrixType. ">Scalar</a> is complex. </p> </div> </div> <a class="anchor" id="a62dc35c9c355abf830869b1bad883c74"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef <a class="el" href="classEigen_1_1Matrix.html">Matrix</a><<a class="el" href="classEigen_1_1EigenSolver.html#a1b9bc0a45616064df3a6168395e3cfcc">ComplexScalar</a>, ColsAtCompileTime, 1, Options & ~<a class="el" href="group__enums.html#gga0c5bde183ecefe103f70b49ad9740bcda1e16fa1b92ed7a058cd4ce7a9a0db044">RowMajor</a>, MaxColsAtCompileTime, 1> <a class="el" href="classEigen_1_1EigenSolver.html#a62dc35c9c355abf830869b1bad883c74">EigenvalueType</a></td> </tr> </table> </div><div class="memdoc"> <p>Type for vector of eigenvalues as returned by <a class="el" href="classEigen_1_1EigenSolver.html#a1165fd63a951c6afaf239174d22e9945" title="Returns the eigenvalues of given matrix. ">eigenvalues()</a>. </p> <p>This is a column vector with entries of type <a class="el" href="classEigen_1_1EigenSolver.html#a1b9bc0a45616064df3a6168395e3cfcc" title="Complex scalar type for MatrixType. ">ComplexScalar</a>. The length of the vector is the size of <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf" title="Synonym for the template parameter _MatrixType. ">MatrixType</a>. </p> </div> </div> <a class="anchor" id="a50d070013a795db5621119f2b4a3d781"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">typedef <a class="el" href="classEigen_1_1Matrix.html">Matrix</a><<a class="el" href="classEigen_1_1EigenSolver.html#a1b9bc0a45616064df3a6168395e3cfcc">ComplexScalar</a>, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime> <a class="el" href="classEigen_1_1EigenSolver.html#a50d070013a795db5621119f2b4a3d781">EigenvectorsType</a></td> </tr> </table> </div><div class="memdoc"> <p>Type for matrix of eigenvectors as returned by <a class="el" href="classEigen_1_1EigenSolver.html#a3236af3afbc89241aaed4fc868aa8435" title="Returns the eigenvectors of given matrix. ">eigenvectors()</a>. </p> <p>This is a square matrix with entries of type <a class="el" href="classEigen_1_1EigenSolver.html#a1b9bc0a45616064df3a6168395e3cfcc" title="Complex scalar type for MatrixType. ">ComplexScalar</a>. The size is the same as the size of <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf" title="Synonym for the template parameter _MatrixType. ">MatrixType</a>. </p> </div> </div> <h2 class="groupheader">Constructor & Destructor Documentation</h2> <a class="anchor" id="a838424bc2f923e06e7690965bf6d7769"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classEigen_1_1EigenSolver.html">EigenSolver</a> </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Default constructor. </p> <p>The default constructor is useful in cases in which the user intends to perform decompositions via <a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8" title="Computes eigendecomposition of given matrix. ">EigenSolver::compute(const MatrixType&, bool)</a>.</p> <dl class="section see"><dt>See Also</dt><dd><a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8" title="Computes eigendecomposition of given matrix. ">compute()</a> for an example. </dd></dl> </div> </div> <a class="anchor" id="af3bf2ce4a17b33b9e298170677f2f0c0"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classEigen_1_1EigenSolver.html">EigenSolver</a> </td> <td>(</td> <td class="paramtype">Index </td> <td class="paramname"><em>size</em></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Default constructor with memory preallocation. </p> <p>Like the default constructor but with preallocation of the internal data according to the specified problem <em>size</em>. </p> <dl class="section see"><dt>See Also</dt><dd><a class="el" href="classEigen_1_1EigenSolver.html#a838424bc2f923e06e7690965bf6d7769" title="Default constructor. ">EigenSolver()</a> </dd></dl> </div> </div> <a class="anchor" id="a8c287af80cfd71517094b75dcad2a31b"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classEigen_1_1EigenSolver.html">EigenSolver</a> </td> <td>(</td> <td class="paramtype">const <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a> & </td> <td class="paramname"><em>matrix</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>computeEigenvectors</em> = <code>true</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Constructor; computes eigendecomposition of given matrix. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">matrix</td><td>Square matrix whose eigendecomposition is to be computed. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">computeEigenvectors</td><td>If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed.</td></tr> </table> </dd> </dl> <p>This constructor calls <a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8" title="Computes eigendecomposition of given matrix. ">compute()</a> to compute the eigenvalues and eigenvectors.</p> <p>Example: </p> <div class="fragment"><div class="line">MatrixXd A = <a class="code" href="classEigen_1_1DenseBase.html#a8e759dafdd9ecc446d397b7f5435f60a">MatrixXd::Random</a>(6,6);</div> <div class="line">cout << <span class="stringliteral">"Here is a random 6x6 matrix, A:"</span> << endl << A << endl << endl;</div> <div class="line"></div> <div class="line">EigenSolver<MatrixXd> es(A);</div> <div class="line">cout << <span class="stringliteral">"The eigenvalues of A are:"</span> << endl << es.eigenvalues() << endl;</div> <div class="line">cout << <span class="stringliteral">"The matrix of eigenvectors, V, is:"</span> << endl << es.eigenvectors() << endl << endl;</div> <div class="line"></div> <div class="line">complex<double> lambda = es.eigenvalues()[0];</div> <div class="line">cout << <span class="stringliteral">"Consider the first eigenvalue, lambda = "</span> << lambda << endl;</div> <div class="line"><a class="code" href="group__matrixtypedefs.html#ga3f53566af4e94dd734a669ffcf67560b">VectorXcd</a> v = es.eigenvectors().col(0);</div> <div class="line">cout << <span class="stringliteral">"If v is the corresponding eigenvector, then lambda * v = "</span> << endl << lambda * v << endl;</div> <div class="line">cout << <span class="stringliteral">"... and A * v = "</span> << endl << A.cast<complex<double> >() * v << endl << endl;</div> <div class="line"></div> <div class="line"><a class="code" href="group__matrixtypedefs.html#gaf1d15c8c24df228ee4869535dcbfa288">MatrixXcd</a> D = es.eigenvalues().asDiagonal();</div> <div class="line"><a class="code" href="group__matrixtypedefs.html#gaf1d15c8c24df228ee4869535dcbfa288">MatrixXcd</a> V = es.eigenvectors();</div> <div class="line">cout << <span class="stringliteral">"Finally, V * D * V^(-1) = "</span> << endl << V * D * V.inverse() << endl;</div> </div><!-- fragment --><p> Output: </p> <pre class="fragment">Here is a random 6x6 matrix, A: 0.68 -0.33 -0.27 -0.717 -0.687 0.0259 -0.211 0.536 0.0268 0.214 -0.198 0.678 0.566 -0.444 0.904 -0.967 -0.74 0.225 0.597 0.108 0.832 -0.514 -0.782 -0.408 0.823 -0.0452 0.271 -0.726 0.998 0.275 -0.605 0.258 0.435 0.608 -0.563 0.0486 The eigenvalues of A are: (0.049,1.06) (0.049,-1.06) (0.967,0) (0.353,0) (0.618,0.129) (0.618,-0.129) The matrix of eigenvectors, V, is: (-0.292,-0.454) (-0.292,0.454) (-0.0607,0) (-0.733,0) (0.59,-0.122) (0.59,0.122) (0.134,-0.104) (0.134,0.104) (-0.799,0) (0.136,0) (0.335,0.368) (0.335,-0.368) (-0.422,-0.18) (-0.422,0.18) (0.192,0) (0.0563,0) (-0.335,-0.143) (-0.335,0.143) (-0.589,0.0274) (-0.589,-0.0274) (-0.0788,0) (-0.627,0) (0.322,-0.156) (0.322,0.156) (-0.248,0.132) (-0.248,-0.132) (0.401,0) (0.218,0) (-0.335,-0.076) (-0.335,0.076) (0.105,0.18) (0.105,-0.18) (-0.392,0) (-0.00564,0) (-0.0324,0.103) (-0.0324,-0.103) Consider the first eigenvalue, lambda = (0.049,1.06) If v is the corresponding eigenvector, then lambda * v = (0.466,-0.331) (0.117,0.137) (0.17,-0.456) (-0.0578,-0.622) (-0.152,-0.256) (-0.186,0.12) ... and A * v = (0.466,-0.331) (0.117,0.137) (0.17,-0.456) (-0.0578,-0.622) (-0.152,-0.256) (-0.186,0.12) Finally, V * D * V^(-1) = (0.68,1.9e-16) (-0.33,4.82e-17) (-0.27,-2.37e-16) (-0.717,1.6e-16) (-0.687,-2.2e-16) (0.0259,2.72e-16) (-0.211,2.22e-16) (0.536,4.16e-17) (0.0268,-2.98e-16) (0.214,0) (-0.198,6.66e-16) (0.678,6.66e-16) (0.566,1.22e-15) (-0.444,1.11e-16) (0.904,-4.61e-16) (-0.967,-3.61e-16) (-0.74,7.22e-16) (0.225,8.88e-16) (0.597,1.6e-15) (0.108,1.84e-16) (0.832,-5.6e-16) (-0.514,-4.44e-16) (-0.782,1.28e-15) (-0.408,9.44e-16) (0.823,-8.33e-16) (-0.0452,-2.71e-16) (0.271,5.53e-16) (-0.726,7.77e-16) (0.998,-2.33e-15) (0.275,-1.67e-15) (-0.605,1.03e-15) (0.258,1.91e-16) (0.435,-4.6e-16) (0.608,-6.38e-16) (-0.563,1.69e-15) (0.0486,1.25e-15) </pre><dl class="section see"><dt>See Also</dt><dd><a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8" title="Computes eigendecomposition of given matrix. ">compute()</a> </dd></dl> <p>References <a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8">EigenSolver< _MatrixType >::compute()</a>.</p> </div> </div> <h2 class="groupheader">Member Function Documentation</h2> <a class="anchor" id="a0e257dae8f1774fdda178482caa65be8"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classEigen_1_1EigenSolver.html">EigenSolver</a>< <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a> > & compute </td> <td>(</td> <td class="paramtype">const <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a> & </td> <td class="paramname"><em>matrix</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>computeEigenvectors</em> = <code>true</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div><div class="memdoc"> <p>Computes eigendecomposition of given matrix. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">matrix</td><td>Square matrix whose eigendecomposition is to be computed. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">computeEigenvectors</td><td>If true, both the eigenvectors and the eigenvalues are computed; if false, only the eigenvalues are computed. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>Reference to <code>*this</code> </dd></dl> <p>This function computes the eigenvalues of the real matrix <code>matrix</code>. The <a class="el" href="classEigen_1_1EigenSolver.html#a1165fd63a951c6afaf239174d22e9945" title="Returns the eigenvalues of given matrix. ">eigenvalues()</a> function can be used to retrieve them. If <code>computeEigenvectors</code> is true, then the eigenvectors are also computed and can be retrieved by calling <a class="el" href="classEigen_1_1EigenSolver.html#a3236af3afbc89241aaed4fc868aa8435" title="Returns the eigenvectors of given matrix. ">eigenvectors()</a>.</p> <p>The matrix is first reduced to real Schur form using the <a class="el" href="classEigen_1_1RealSchur.html" title="Performs a real Schur decomposition of a square matrix. ">RealSchur</a> class. The Schur decomposition is then used to compute the eigenvalues and eigenvectors.</p> <p>The cost of the computation is dominated by the cost of the Schur decomposition, which is very approximately <img class="formulaInl" alt="$ 25n^3 $" src="form_54.png"/> (where <img class="formulaInl" alt="$ n $" src="form_45.png"/> is the size of the matrix) if <code>computeEigenvectors</code> is true, and <img class="formulaInl" alt="$ 10n^3 $" src="form_55.png"/> if <code>computeEigenvectors</code> is false.</p> <p>This method reuses of the allocated data in the <a class="el" href="classEigen_1_1EigenSolver.html" title="Computes eigenvalues and eigenvectors of general matrices. ">EigenSolver</a> object.</p> <p>Example: </p> <div class="fragment"><div class="line">EigenSolver<MatrixXf> es;</div> <div class="line"><a class="code" href="group__matrixtypedefs.html#gabab09c32e96cfa9829a88400627af162">MatrixXf</a> A = <a class="code" href="classEigen_1_1DenseBase.html#a8e759dafdd9ecc446d397b7f5435f60a">MatrixXf::Random</a>(4,4);</div> <div class="line">es.compute(A, <span class="comment">/* computeEigenvectors = */</span> <span class="keyword">false</span>);</div> <div class="line">cout << <span class="stringliteral">"The eigenvalues of A are: "</span> << es.eigenvalues().transpose() << endl;</div> <div class="line">es.compute(A + <a class="code" href="classEigen_1_1MatrixBase.html#a0650b65c6ae6c3d19a138b72a6d68568">MatrixXf::Identity</a>(4,4), <span class="keyword">false</span>); <span class="comment">// re-use es to compute eigenvalues of A+I</span></div> <div class="line">cout << <span class="stringliteral">"The eigenvalues of A+I are: "</span> << es.eigenvalues().transpose() << endl;</div> </div><!-- fragment --><p> Output: </p> <pre class="fragment">The eigenvalues of A are: (0.755,0.528) (0.755,-0.528) (-0.323,0.0965) (-0.323,-0.0965) The eigenvalues of A+I are: (1.75,0.528) (1.75,-0.528) (0.677,0.0965) (0.677,-0.0965) </pre> <p>References <a class="el" href="group__enums.html#gga51bc1ac16f26ebe51eae1abb77bd037bafdfbdf3247bd36a1f17270d5cec74c9c">Eigen::Success</a>.</p> <p>Referenced by <a class="el" href="classEigen_1_1EigenSolver.html#a8c287af80cfd71517094b75dcad2a31b">EigenSolver< _MatrixType >::EigenSolver()</a>.</p> </div> </div> <a class="anchor" id="a1165fd63a951c6afaf239174d22e9945"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="classEigen_1_1EigenSolver.html#a62dc35c9c355abf830869b1bad883c74">EigenvalueType</a>& eigenvalues </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Returns the eigenvalues of given matrix. </p> <dl class="section return"><dt>Returns</dt><dd>A const reference to the column vector containing the eigenvalues.</dd></dl> <dl class="section pre"><dt>Precondition</dt><dd>Either the constructor <a class="el" href="classEigen_1_1EigenSolver.html#a8c287af80cfd71517094b75dcad2a31b" title="Constructor; computes eigendecomposition of given matrix. ">EigenSolver(const MatrixType&,bool)</a> or the member function <a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8" title="Computes eigendecomposition of given matrix. ">compute(const MatrixType&, bool)</a> has been called before.</dd></dl> <p>The eigenvalues are repeated according to their algebraic multiplicity, so there are as many eigenvalues as rows in the matrix. The eigenvalues are not sorted in any particular order.</p> <p>Example: </p> <div class="fragment"><div class="line">MatrixXd ones = <a class="code" href="classEigen_1_1DenseBase.html#a2278addf9a3c977d40322571a0df8ac9">MatrixXd::Ones</a>(3,3);</div> <div class="line">EigenSolver<MatrixXd> es(ones, <span class="keyword">false</span>);</div> <div class="line">cout << <span class="stringliteral">"The eigenvalues of the 3x3 matrix of ones are:"</span> </div> <div class="line"> << endl << es.eigenvalues() << endl;</div> </div><!-- fragment --><p> Output: </p> <pre class="fragment">The eigenvalues of the 3x3 matrix of ones are: (-5.31e-17,0) (3,0) (0,0) </pre><dl class="section see"><dt>See Also</dt><dd><a class="el" href="classEigen_1_1EigenSolver.html#a3236af3afbc89241aaed4fc868aa8435" title="Returns the eigenvectors of given matrix. ">eigenvectors()</a>, <a class="el" href="classEigen_1_1EigenSolver.html#a4140972e2b45343d1ef1793c2824159c" title="Returns the block-diagonal matrix in the pseudo-eigendecomposition. ">pseudoEigenvalueMatrix()</a>, <a class="el" href="classEigen_1_1MatrixBase.html#a0ffa061371b1bd1b9f14ecef94b4502e" title="Computes the eigenvalues of a matrix. ">MatrixBase::eigenvalues()</a> </dd></dl> </div> </div> <a class="anchor" id="a3236af3afbc89241aaed4fc868aa8435"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classEigen_1_1EigenSolver.html">EigenSolver</a>< <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a> >::<a class="el" href="classEigen_1_1EigenSolver.html#a50d070013a795db5621119f2b4a3d781">EigenvectorsType</a> eigenvectors </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div><div class="memdoc"> <p>Returns the eigenvectors of given matrix. </p> <dl class="section return"><dt>Returns</dt><dd>Matrix whose columns are the (possibly complex) eigenvectors.</dd></dl> <dl class="section pre"><dt>Precondition</dt><dd>Either the constructor <a class="el" href="classEigen_1_1EigenSolver.html#a8c287af80cfd71517094b75dcad2a31b" title="Constructor; computes eigendecomposition of given matrix. ">EigenSolver(const MatrixType&,bool)</a> or the member function <a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8" title="Computes eigendecomposition of given matrix. ">compute(const MatrixType&, bool)</a> has been called before, and <code>computeEigenvectors</code> was set to true (the default).</dd></dl> <p>Column <img class="formulaInl" alt="$ k $" src="form_43.png"/> of the returned matrix is an eigenvector corresponding to eigenvalue number <img class="formulaInl" alt="$ k $" src="form_43.png"/> as returned by <a class="el" href="classEigen_1_1EigenSolver.html#a1165fd63a951c6afaf239174d22e9945" title="Returns the eigenvalues of given matrix. ">eigenvalues()</a>. The eigenvectors are normalized to have (Euclidean) norm equal to one. The matrix returned by this function is the matrix <img class="formulaInl" alt="$ V $" src="form_40.png"/> in the eigendecomposition <img class="formulaInl" alt="$ A = V D V^{-1} $" src="form_42.png"/>, if it exists.</p> <p>Example: </p> <div class="fragment"><div class="line">MatrixXd ones = <a class="code" href="classEigen_1_1DenseBase.html#a2278addf9a3c977d40322571a0df8ac9">MatrixXd::Ones</a>(3,3);</div> <div class="line">EigenSolver<MatrixXd> es(ones);</div> <div class="line">cout << <span class="stringliteral">"The first eigenvector of the 3x3 matrix of ones is:"</span> </div> <div class="line"> << endl << es.eigenvectors().col(1) << endl;</div> </div><!-- fragment --><p> Output: </p> <pre class="fragment">The first eigenvector of the 3x3 matrix of ones is: (0.577,0) (0.577,0) (0.577,0) </pre><dl class="section see"><dt>See Also</dt><dd><a class="el" href="classEigen_1_1EigenSolver.html#a1165fd63a951c6afaf239174d22e9945" title="Returns the eigenvalues of given matrix. ">eigenvalues()</a>, <a class="el" href="classEigen_1_1EigenSolver.html#a3b6c3b38f50c2372de195ff955a4e02d" title="Returns the pseudo-eigenvectors of given matrix. ">pseudoEigenvectors()</a> </dd></dl> </div> </div> <a class="anchor" id="a4140972e2b45343d1ef1793c2824159c"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a> pseudoEigenvalueMatrix </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </div><div class="memdoc"> <p>Returns the block-diagonal matrix in the pseudo-eigendecomposition. </p> <dl class="section return"><dt>Returns</dt><dd>A block-diagonal matrix.</dd></dl> <dl class="section pre"><dt>Precondition</dt><dd>Either the constructor <a class="el" href="classEigen_1_1EigenSolver.html#a8c287af80cfd71517094b75dcad2a31b" title="Constructor; computes eigendecomposition of given matrix. ">EigenSolver(const MatrixType&,bool)</a> or the member function <a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8" title="Computes eigendecomposition of given matrix. ">compute(const MatrixType&, bool)</a> has been called before.</dd></dl> <p>The matrix <img class="formulaInl" alt="$ D $" src="form_10.png"/> returned by this function is real and block-diagonal. The blocks on the diagonal are either 1-by-1 or 2-by-2 blocks of the form <img class="formulaInl" alt="$ \begin{bmatrix} u & v \\ -v & u \end{bmatrix} $" src="form_53.png"/>. These blocks are not sorted in any particular order. The matrix <img class="formulaInl" alt="$ D $" src="form_10.png"/> and the matrix <img class="formulaInl" alt="$ V $" src="form_40.png"/> returned by <a class="el" href="classEigen_1_1EigenSolver.html#a3b6c3b38f50c2372de195ff955a4e02d" title="Returns the pseudo-eigenvectors of given matrix. ">pseudoEigenvectors()</a> satisfy <img class="formulaInl" alt="$ AV = VD $" src="form_52.png"/>.</p> <dl class="section see"><dt>See Also</dt><dd><a class="el" href="classEigen_1_1EigenSolver.html#a3b6c3b38f50c2372de195ff955a4e02d" title="Returns the pseudo-eigenvectors of given matrix. ">pseudoEigenvectors()</a> for an example, <a class="el" href="classEigen_1_1EigenSolver.html#a1165fd63a951c6afaf239174d22e9945" title="Returns the eigenvalues of given matrix. ">eigenvalues()</a> </dd></dl> </div> </div> <a class="anchor" id="a3b6c3b38f50c2372de195ff955a4e02d"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">const <a class="el" href="classEigen_1_1EigenSolver.html#aeb6c0eb89cc982629305f6c7e0791caf">MatrixType</a>& pseudoEigenvectors </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Returns the pseudo-eigenvectors of given matrix. </p> <dl class="section return"><dt>Returns</dt><dd>Const reference to matrix whose columns are the pseudo-eigenvectors.</dd></dl> <dl class="section pre"><dt>Precondition</dt><dd>Either the constructor <a class="el" href="classEigen_1_1EigenSolver.html#a8c287af80cfd71517094b75dcad2a31b" title="Constructor; computes eigendecomposition of given matrix. ">EigenSolver(const MatrixType&,bool)</a> or the member function <a class="el" href="classEigen_1_1EigenSolver.html#a0e257dae8f1774fdda178482caa65be8" title="Computes eigendecomposition of given matrix. ">compute(const MatrixType&, bool)</a> has been called before, and <code>computeEigenvectors</code> was set to true (the default).</dd></dl> <p>The real matrix <img class="formulaInl" alt="$ V $" src="form_40.png"/> returned by this function and the block-diagonal matrix <img class="formulaInl" alt="$ D $" src="form_10.png"/> returned by <a class="el" href="classEigen_1_1EigenSolver.html#a4140972e2b45343d1ef1793c2824159c" title="Returns the block-diagonal matrix in the pseudo-eigendecomposition. ">pseudoEigenvalueMatrix()</a> satisfy <img class="formulaInl" alt="$ AV = VD $" src="form_52.png"/>.</p> <p>Example: </p> <div class="fragment"><div class="line">MatrixXd A = <a class="code" href="classEigen_1_1DenseBase.html#a8e759dafdd9ecc446d397b7f5435f60a">MatrixXd::Random</a>(6,6);</div> <div class="line">cout << <span class="stringliteral">"Here is a random 6x6 matrix, A:"</span> << endl << A << endl << endl;</div> <div class="line"></div> <div class="line">EigenSolver<MatrixXd> es(A);</div> <div class="line">MatrixXd D = es.pseudoEigenvalueMatrix();</div> <div class="line">MatrixXd V = es.pseudoEigenvectors();</div> <div class="line">cout << <span class="stringliteral">"The pseudo-eigenvalue matrix D is:"</span> << endl << D << endl;</div> <div class="line">cout << <span class="stringliteral">"The pseudo-eigenvector matrix V is:"</span> << endl << V << endl;</div> <div class="line">cout << <span class="stringliteral">"Finally, V * D * V^(-1) = "</span> << endl << V * D * V.inverse() << endl;</div> </div><!-- fragment --><p> Output: </p> <pre class="fragment">Here is a random 6x6 matrix, A: 0.68 -0.33 -0.27 -0.717 -0.687 0.0259 -0.211 0.536 0.0268 0.214 -0.198 0.678 0.566 -0.444 0.904 -0.967 -0.74 0.225 0.597 0.108 0.832 -0.514 -0.782 -0.408 0.823 -0.0452 0.271 -0.726 0.998 0.275 -0.605 0.258 0.435 0.608 -0.563 0.0486 The pseudo-eigenvalue matrix D is: 0.049 1.06 0 0 0 0 -1.06 0.049 0 0 0 0 0 0 0.967 0 0 0 0 0 0 0.353 0 0 0 0 0 0 0.618 0.129 0 0 0 0 -0.129 0.618 The pseudo-eigenvector matrix V is: -0.571 -0.888 -0.066 -1.13 17.2 -3.54 0.263 -0.204 -0.869 0.21 9.73 10.7 -0.827 -0.352 0.209 0.0871 -9.75 -4.17 -1.15 0.0535 -0.0857 -0.971 9.36 -4.53 -0.485 0.258 0.436 0.337 -9.74 -2.21 0.206 0.353 -0.426 -0.00873 -0.942 2.98 Finally, V * D * V^(-1) = 0.68 -0.33 -0.27 -0.717 -0.687 0.0259 -0.211 0.536 0.0268 0.214 -0.198 0.678 0.566 -0.444 0.904 -0.967 -0.74 0.225 0.597 0.108 0.832 -0.514 -0.782 -0.408 0.823 -0.0452 0.271 -0.726 0.998 0.275 -0.605 0.258 0.435 0.608 -0.563 0.0486 </pre><dl class="section see"><dt>See Also</dt><dd><a class="el" href="classEigen_1_1EigenSolver.html#a4140972e2b45343d1ef1793c2824159c" title="Returns the block-diagonal matrix in the pseudo-eigendecomposition. ">pseudoEigenvalueMatrix()</a>, <a class="el" href="classEigen_1_1EigenSolver.html#a3236af3afbc89241aaed4fc868aa8435" title="Returns the eigenvectors of given matrix. ">eigenvectors()</a> </dd></dl> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="EigenSolver_8h_source.html">EigenSolver.h</a></li> </ul> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="namespaceEigen.html">Eigen</a></li><li class="navelem"><a class="el" href="classEigen_1_1EigenSolver.html">EigenSolver</a></li> <li class="footer">Generated on Mon Oct 28 2013 11:04:28 for Eigen by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.5 </li> </ul> </div> <!-- Piwik --> <!-- <script type="text/javascript"> var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.sylphide-consulting.com/piwik/" : "http://stats.sylphide-consulting.com/piwik/"); document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E")); </script><script type="text/javascript"> try { var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 20); piwikTracker.trackPageView(); piwikTracker.enableLinkTracking(); } catch( err ) {} </script><noscript><p><img src="http://stats.sylphide-consulting.com/piwik/piwik.php?idsite=20" style="border:0" alt="" /></p></noscript> --> <!-- End Piwik Tracking Code --> </body> </html>