📄 eigen.htm
字号:
<html>
<head>
<link rel=stylesheet href="styles.css" type="text/css">
<title>Eigen value and eigen vector</title>
</head>
<body>
<h6 align=right>
<a href="matutil.htm">Prev</a> |
<a href="manual.htm">Up</a> |
<a href="matfunc.htm">Next</a>
</h6>
<h2>Eigen value and eigen vector</h2>
<p>
The following methods are available to evaluate the eigen values and corresponding eigen vectors of a matrix.
</p>
<pre><code><a href="#e1">1</a>. bool eigen (valarray<T>& reival) const;
<a href="#e2">2</a>. bool eigen (valarray<T>& reival, matrix<T>& eivec) const;
<a href="#e3">3</a>. bool eigen (valarray<T>& reival, valarray<T>& ieival) const;
<a href="#e4">4</a>. bool eigen (valarray<T<& reival, valarray<T>& ieival, matrix<T>& eivec) const;
</code></pre>
<h4>Parameter</h4>
<p>
<dl>
<dt><i>reival</i></dt>
<dd>Reference to a <i>valarray</i> class object to receive the real eigen values of a matrix.</dd>
<dt><i>ieival</i></dt>
<dd>Reference to a <i>valarray</i> class object to receive the imaginary eigen values of a matrix.</dd>
<dt><i>eivec</i></dt>
<dd>Reference to a <i>matrix</i> class object to receive the eigen vectors of a matrix.</dd>
</dl>
</p>
<p>
<ol>
<li><a name="e1"></a>Finds the eigen values of a symmetric matrix. If successful, the eigen values are copied into the <i>valarray</i> class object <i>reival</i>, and this method returns <i>true</i>, otherwise, it returns <i>false</i>.</li><br><br>
<li><a name="e2"></a>Finds the eigen values and eigen vectors of a symmetric matrix. If successful, the eigen values are copied into the <i>valarray</i> class object <i>reival</i> and corresponding eigen vectors into matrix <i>eivec</i>, and this method returns <i>true</i>, otherwise, it returns <i>false</i>.</li><br><br>
<li><a name="e3"></a>Finds the eigen values of a general square matrix. If successful, the real eigen values are copied into <i>reival</i> and imaginary eigen values into <i>ieival</i>, and this method returns <i>true</i>, otherwise, it returns <i>false</i>.</li><br><br>
<li><a name="e4"></a>Finds the eigen values and eigen vectors of a general square matrix. If successful, the real eigen values are copied into <i>reival</i>, imaginary eigen values into <i>ieival</i>, and corresponding eigen vectors into <i>eivec</i>, and this method returns <i>true</i>, otherwise, it returns <i>false</i>.</li><br><br>
</ol>
</p>
<h5>Examples</h5>
<pre><code>typedef matrix<double> Matrix;
typedef valarray<double> Vector;
size_t n = 4;
Matrix a(n,n), ev(n,n);
Vector d(n), e(n);
bool ret;
a.rand();
a = a[gmslice(UTRIANG)];
a[gmslice(LTRIANG)] = ~a; // a is now a symmetric matrix
ret = a.eigen( d); // Finds the eigen values
ret = a.eigen( d, ev); // Finds both eigen values and eigen vectors
a.rand();
ret = a.eigen( d, e); // Finds real and imaginary eigen values
ret = a.eigen( d, e, ev); // Finds real and imaginary eigen values and eigen vectors
</code></pre>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -