📄 mf_eigensystem.hlp
字号:
{smcl}
{* 25mar2005}{...}
{cmd:help mata eigensystem()}
{hline}
{* index eigenvectors}{...}
{* index eigenvalues}{...}
{* index characteristic roots}{...}
{* index latent roots}{...}
{* index proper values}{...}
{* index right eigenvectors}{...}
{* index left eigenvectors}{...}
{* index eigensystem()}{...}
{* index eigenvalues()}{...}
{* index symeigensystem()}{...}
{* index symeigenvalues()}{...}
{* index lefteigensystem()}{...}
{* index _eigensystem()}{...}
{* index _eigenvalues()}{...}
{* index _symeigensystem()}{...}
{* index _symeigenvalues()}{...}
{* index _lefteigensystem()}{...}
{* index _eigen_la()}{...}
{* index _symeigen_la()}{...}
{* index LAPACK}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] eigensystem() -- Eigenvalues and eigenvectors}
{title:Syntax}
{p 8 40 2}
{it:void}{bind: }
{cmd:eigensystem(}{it:A}{cmd:,}
{it:X}{cmd:,}
{it:L}
[{cmd:,} {it:rcond}
[{cmd:,} {it:nobalance}]]{cmd:)}
{p 8 40 2}
{it:void}{bind: }
{cmd:lefteigensystem(}{it:A}{cmd:,} {it:X}{cmd:,}
{it:L}
[{cmd:,} {it:rcond}
[{cmd:,} {it:nobalance}]]{cmd:)}
{p 8 40 2}
{it:complex rowvector}{bind: }
{cmd:eigenvalues(}{it:A}{bind: }
[{cmd:,} {it:rcond}
[{cmd:,} {it:nobalance}]]{cmd:)}
{p 8 40 2}
{it:void}{bind: }
{cmd:symeigensystem(}{it:A}{cmd:,} {it:X}{cmd:,} {it:L}{cmd:)}
{p 8 40 2}
{it:real rowvector}{bind: }
{cmd:symeigenvalues(}{it:A}{cmd:)}
{p 8 40 2}
{it:void}{bind: }
{cmd:_eigensystem(}{it:A}{cmd:,}
{it:X}{cmd:,}
{it:L}
[{cmd:,} {it:rcond}
[{cmd:,} {it:nobalance}]]{cmd:)}
{p 8 40 2}
{it:void}{bind: }
{cmd:_lefteigensystem(}{it:A}{cmd:,} {it:X}{cmd:,}
{it:L}
[{cmd:,} {it:rcond}
[{cmd:,} {it:nobalance}]]{cmd:)}
{p 8 40 2}
{it:complex rowvector}{bind: }
{cmd:_eigenvalues(}{it:A}{bind: }
[{cmd:,} {it:rcond}
[{cmd:,}
{it:nobalance}]]{cmd:)}
{p 8 40 2}
{it:void}{bind: }
{cmd:_symeigensystem(}{it:A}{cmd:,} {it:X}{cmd:,} {it:L}{cmd:)}
{p 8 40 2}
{it:real rowvector}{bind: }
{cmd:_symeigenvalues(}{it:A}{cmd:)}
{p 4 4 2}
where inputs are
{it:A}: {it:numeric matrix}
{it:rcond}: {it:real scalar} (whether {it:rcond} desired)
{it:nobalance}: {it:real scalar} (whether to suppress balancing)
{p 4 4 2}
and outputs are
{it:X}: {it:numeric matrix} of eigenvectors
{it:L}: {it:numeric vector} of eigenvalues
{it:rcond}: {it:real vector} of reciprocal condition numbers
{p 4 4 2}
The columns of {it:X} will contain the eigenvectors except when using
{cmd:_lefteigensystem()}, in which case the rows of {it:X} contain the
eigenvectors.
{p 4 4 2}
The following routines are used in implementing the above routines:
{p 8 30 2}
{it:real scalar}
{cmd:_eigen_la(}{it:real scalar todo}{cmd:,}
{it:numeric matrix A}{cmd:,}
{it:X}{cmd:,}
{it:L}{cmd:,}
{it:real scalar rcond}{cmd:,}
{it:real scalar nobalance}{cmd:)}
{p 8 33 2}
{it:real scalar}
{cmd:_symeigen_la(}{it:real scalar todo}{cmd:,}
{it:numeric matrix A}{cmd:,}
{it:X}{cmd:,}
{it:L}{cmd:)}
{title:Description}
{p 4 4 2}
These routines calculate eigenvalues and eigenvectors of square matrix {it:A}.
{p 4 4 2}
{cmd:eigensystem(}{it:A}{cmd:,} {it:X}{cmd:,} {it:L}{cmd:,}
{it:rcond}{cmd:,} {it:nobalance}{cmd:)}
calculates eigenvalues and eigenvectors of a general, real or complex,
square matrix
{it:A}. Eigenvectors are returned in {it:X} and eigenvalues in {it:L}.
The remaining arguments are optional:
{p 8 12 2}
1. If {it:rcond} is not specified, then reciprocal condition numbers are
not returned in {it:rcond}.
{p 12 12 2}
If {it:rcond} is specified and contains a value other than 0 or
missing -- {it:rcond}=1 is suggested -- in {it:rcond} will be placed a
vector of the reciprocals of the condition numbers for the
eigenvalues. Each element of the new {it:rcond} measures the accuracy
to which the corresponding eigenvalue has been calculated; large
numbers (numbers close to 1) are better and small numbers (numbers
close to 0) indicate inaccuracy;
see {it:Eigenvalue condition} below.
{p 8 12 2}
2. If {it:nobalance} is not specified, balancing is
performed in order to obtain more accurate results.
{p 12 12 2}
If {it:nobalance} is specified and is not zero nor missing,
balancing is not used. Results are calculated more quickly, but
perhaps a little less accurately; see {it:Balancing} below.
{p 4 4 2}
{cmd:lefteigensystem(}{it:A}{cmd:,} {it:X}{cmd:,} {it:L}{cmd:,}
{it:rcond}{cmd:,} {it:nobalance}{cmd:)} mirrors
{cmd:eigensystem()}, the difference being that {cmd:lefteigensystem()}
solves for left eigenvectors solving
{it:X}{it:A}=diag({it:L})*{it:X}
instead of right eigenvectors solving
{it:A}{it:X}={it:X}*diag({it:L}).
{p 4 4 2}
{cmd:eigenvalues(}{it:A}{cmd:,} {it:rcond}{cmd:,} {it:nobalance}{cmd:)}
returns the eigenvalues of square matrix {it:A}; the eigenvectors are not
calculated. Arguments {it:rcond} and {it:nobalance} are optional.
{p 4 4 2}
{cmd:symeigensystem(}{it:A}{cmd:,} {it:X}{cmd:,} {it:L}{cmd:)}
and
{cmd:symeigenvalues(}{it:A}{cmd:)} mirror {cmd:eigensystem()} and
{cmd:eigenvalues()}, the difference being that {it:A} is assumed to be
symmetric (Hermitian). The eigenvalues returned are real. (Arguments
{it:rcond} and {it:nobalance} are not allowed; {it:rcond}, because
symmetric matrices are inherently well conditioned; {it:nobalance},
because it is unnecessary.)
{p 4 4 2}
The underscore routines mirror the routines of the same name without
underscores, the difference being that {it:A} is damaged during the
calculation and so the underscore routines use less memory.
{p 4 4 2}
{cmd:_eigen_la()} and {cmd:_symeigen_la()} are the interfaces into the
{bf:{help m1_lapack:[M-1] LAPACK}}
routines used to implement the above functions. Their direct use is not
recommended.
{title:Remarks}
{p 4 4 2}
Remarks are presented under the headings
{bf:Eigenvalues and eigenvectors}
{bf:Left eigenvectors}
{bf:Symmetric eigensystems}
{bf:Normalization and order}
{bf:Eigenvalue condition}
{bf:Balancing}
{bf:eigensystem() and eigenvalues()}
{bf:lefteigensystem()}
{bf:symeigensystem() and symeigenvalues()}
{title:Eigenvalues and eigenvectors}
{p 4 4 2}
A scalar {it:l} (usually denoted by {it:lambda}) is said to be an
eigenvalue of square matrix {it:A}: {it:n x n} if there is a nonzero column
vector {it:x}: {it:n x} 1 (called the eigenvector) such that
{it:A}{it:x} = {it:l}{it:x}{right:(1) }
{p 4 4 2}
(1) can also be written
({it:A} - {it:l}{it:I}){it:x} = 0
{p 4 4 2}
where {it:I} is the {it:n x n} identity matrix.
A nontrivial solution to this system of n linear homogeneous equations
exists if and only if
det({it:A} - {it:l}{it:I}) = 0{right:(2) }
{p 4 4 2}
This {it:n}th degree polynomial in {it:l} is called the characteristic
polynomial or characteristic equation of {it:A}, and the eigenvalues {it:l}
are its roots, also known as the characteristic roots.
{p 4 4 2}
There are, in fact, {it:n} solutions ({it:l_i}, {it:x_i}) that satisfy (1) --
although some can be repeated -- and we can compactly write the full set of
solutions as
{it:A}{it:X} = {it:X}*diag({it:L}){right:(3) }
{p 4 4 2}
where
{it:X} = ({it:x}_1, {it:x}_2, ...){...}
{col 60}({it:X}: {it:n x n})
{it:L} = ({it:l}_1, {it:l}_2, ...){...}
{col 60}({it:L}: 1 {it:x n})
{p 4 4 2}
For instance,
: {cmd:A = (1, 2 \ 9, 4)}
: {cmd:X = .}
: {cmd:L = .}
: {cmd:eigensystem(A, X, L)}
: {cmd:X}
{res} {txt} 1 2
{c TLC}{hline 29}{c TRC}
1 {c |} {res}-.316227766 -.554700196{txt} {c |}
2 {c |} {res}-.948683298 .832050294{txt} {c |}
{c BLC}{hline 29}{c BRC}
: {cmd:L}
{res} {txt} 1 2
{c TLC}{hline 11}{c TRC}
1 {c |} {res} 7 -2{txt} {c |}
{c BLC}{hline 11}{c BRC}
{p 4 4 2}
The first eigenvalue is 7, and the corresponding eigenvector is
(-.316 \ -.949).
The second eigenvalue is -2, and the corresponding eigenvector is
(-.555 \ .832).
{p 4 4 2}
In general, eigenvalues and vectors can be complex even if {it:A} is real.
{title:Left eigenvectors}
{p 4 4 2}
What we have defined above is properly known as the right-eigensystem
problem:
{it:A}{it:x} = {it:l}{it:x}{right:(1) }
{p 4 4 2}
In the above, {it:x} is a column vector. The left-eigensystem problem
is to find the row vector {it:x} satisfying
{it:x}{it:A} = {it:l}{it:x}{right:(1') }
{p 4 4 2}
The eigenvalue {it:l} is the same in (1) and (1'), but {it:x} can differ.
{p 4 4 2}
The {it:n} solutions ({it:l_i}, {it:x_i}) that satisfy (1')
can be compactly written,
{it:X}{it:A} = diag({it:L})*{it:X}{right:(3') }
{p 4 4 2}
where
{c TLC} {c TRC} {c TLC} {c TRC}
{c |} {it:x}_1 {c |} {c |} {it:l}_1 {c |}
{c |} {it:x}_2 {c |} {c |} {it:l}_2 {c |}
X = {c |} . {c |} L = {c |} . {c |}
{c |} . {c |} {c |} . {c |}
{c |} {it:x}_{it:n} {c |} {c |} {it:l}_{it:n} {c |}
{c BLC} {c BRC} {c BLC} {c BRC}
({it:n x n}) ({it:n x} 1)
{p 4 4 2}
For instance,
: {cmd:A = (1, 2 \ 9, 4)}
: {cmd:X = .}
: {cmd:L = .}
: {cmd:lefteigensystem(A, X, L)}
: {cmd:X}
{res} {txt} 1 2
{c TLC}{hline 29}{c TRC}
1 {c |} {res}-.832050294 -.554700196{txt} {c |}
2 {c |} {res}-.948683298 .316227766{txt} {c |}
{c BLC}{hline 29}{c BRC}
: {cmd:L}
{res} {txt} 1
{c TLC}{hline 6}{c TRC}
1 {c |} {res} 7{txt} {c |}
2 {c |} {res}-2{txt} {c |}
{c BLC}{hline 6}{c BRC}
{p 4 4 2}
The first eigenvalue is 7, and the corresponding eigenvector is
(-.832, -.555).
The second eigenvalue is -2, and the corresponding eigenvector is
(-.949, .316).
{p 4 4 2}
The eigenvalues are the same as in the previous example; the eigenvectors
are different.
{title:Symmetric eigensystems}
{p 4 4 2}
Below we use the term symmetric to encompass Hermitian matrices, even
when we do not emphasize the fact.
{p 4 4 2}
Eigensystems of symmetric matrices are conceptually no different from general
eigensystems, but symmetry introduces certain simplifications:
{p 8 12 2}
1. The eigenvalues associated with symmetric matrices are real,
whereas those associated with general matrices may be real
or complex.
{p 8 12 2}
2. The eigenvectors associated with symmetric matrices -- which
may be real or complex -- are orthogonal.
{p 8 12 2}
3. The left and right eigenvectors of symmetric matrices
are transposes of each other.
{p 8 12 2}
4. The eigenvalues and eigenvectors of symmetric matrices are
more easily, and more accurately, computed.
{p 4 4 2}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -