📄 mf_pinv.hlp
字号:
{smcl}
{* 23mar2005}{...}
{cmd:help mata pinv()}
{hline}
{* index Moore-Penrose inverse}{...}
{* index generalized inverse}{...}
{* index pseudoinverse}{...}
{* index inverse matrix}{...}
{* index pinv()}{...}
{* index _pinv()}{...}
{title:Title}
{p 4 8 2}
{bf:[M-5] pinv() -- Moore-Penrose pseudoinverse}
{title:Syntax}
{p 8 12 2}
{it:numeric matrix}
{cmd:pinv(}{it:numeric matrix A}{cmd:)}
{p 8 12 2}
{it:numeric matrix}
{cmd:pinv(}{it:numeric matrix A}{cmd:,}
{it:rank}{cmd:)}
{p 8 12 2}
{it:numeric matrix}
{cmd:pinv(}{it:numeric matrix A}{cmd:,}
{it:rank}{cmd:,}
{it:real scalar tol}{cmd:)}
{p 8 12 2}
{it:real scalar}{bind: }
{cmd:_pinv(}{it:numeric matrix A}{cmd:)}
{p 8 12 2}
{it:real scalar}{bind: }
{cmd:_pinv(}{it:numeric matrix A}{cmd:,}
{it:real scalar tol}{cmd:)}
{p 4 4 2}
where the type of {it:rank} is irrelevant; the rank of {it:A} is returned
there.
{p 4 4 2}
To obtain a generalized inverse of a symmetric matrix using a different
normalization, see
{bf:{help mf_invsym:[M-5] invsym()}}.
{title:Description}
{p 4 4 2}
{cmd:pinv(}{it:A}{cmd:)}
returns the unique Moore-Penrose pseudoinverse of real or complex, symmetric
or nonsymmetric, square or nonsquare matrix {it:A}.
{p 4 4 2}
{cmd:pinv(}{it:A}{cmd:,} {it:rank}{cmd:)}
do the same thing, and it also returns in {it:rank} the rank of {it:A}.
{p 4 4 2}
{cmd:pinv(}{it:A}{cmd:,} {it:rank}{cmd:,} {it:tol}{cmd:)}
does the same thing, and it allows you to specify the tolerance used to
determine the rank of {it:A}, which is also used in the calculation of the
pseudoinverse.
See
{bf:{help mf_svsolve:[M-5] svsolve()}}
and
{bf:{help m1_tolerance:[M-1] tolerance}}
for information on the optional {it:tol} argument.
{p 4 4 2}
{cmd:_pinv(}{it:A}{cmd:)}
and
{cmd:_pinv(}{it:A}{cmd:,} {it:tol}{cmd:)}
does the same thing as {it:pinv()}, except that {it:A} is replaced with
its inverse and the rank is returned.
{title:Remarks}
{p 4 4 2}
The Moore-Penrose pseudoinverse is also known as the Moore-Penrose inverse and
as the generalized inverse. Whatever you call it, the pseudoinverse
{it:A*} of {it:A} satisfies four conditions
{it:A}({it:A*}){it:A} = {it:A}
({it:A*}){it:A}({it:A*}) = {it:A*}
({it:A}({it:A*}))' = {it:A}({it:A*})
(({it:A*}){it:A})' = ({it:A*}){it:A}
{p 4 4 2}
where the transpose operator {bf:'} is understood to mean the conjugate
transpose when {it:A} is complex. In addition, if {it:A} is of full rank,
then
{it:A*} = {it:A}^(-1)
{p 4 4 2}
{cmd:pinv(}{it:A}{cmd:)} is logically equivalent to
{cmd:svsolve(}{it:A}{cmd:,} {cmd:I(rows(}{it:A}{cmd:)))};
see {bf:{help mf_svsolve:[M-5] svsolve()}} for details and for use
of the optional {it:tol} argument.
{title:Conformability}
{cmd:pinv(}{it:A}{cmd:,} {it:rank}{cmd:,} {it:tol}{cmd:)}:
{it:input}:
{it:A}: {it:r x c}
{it:tol}: 1 {it:x} 1 (optional)
{it:output}:
{it:rank}: 1 {it:x} 1 (optional)
{it:result}: {it:c x r}
{cmd:_pinv(}{it:A}{cmd:,} {it:tol}{cmd:)}:
{it:input}:
{it:A}: {it:r x c}
{it:tol}: 1 {it:x} 1 (optional)
{it:output}:
{it:A}: {it:c x r}
{it:rank}: 1 {it:x} 1 (optional)
{it:result}: 1 {it:x} 1 (containing rank)
{title:Diagnostics}
{p 4 4 2}
The inverse returned by these functions is {cmd:real} if {it:A} is {cmd:real},
and is {cmd:complex} if {it:A} is {cmd:complex}.
{p 4 4 2}
{cmd:pinv(}{it:A}{cmd:,} {it:rank}{cmd:,} {it:tol}{cmd:)}
and
{cmd:_pinv(}{it:A}{cmd:,} {it:tol}{cmd:)}
return missing results
if {it:A} contains missing values.
{p 4 4 2}
{cmd:pinv()} and {cmd:_pinv()} also return missing values if the algorithm for
computing the SVD,
{bf:{help mf_svd:[M-5] svd()}},
fails to converge. This is a near zero-probability event.
In this case, {it:rank} also is returned as missing.
{p 4 4 2}
See
{bf:{help mf_svsolve:[M-5] svsolve()}}
and
{bf:{help m1_tolerance:[M-1] tolerance}}
for information on the optional {it:tol} argument.
{title:Source code}
{p 4 4 2}
{view pinv.mata, adopath asis:pinv.mata},
{view _pinv.mata, adopath asis:_pinv.mata},
{view rank_from_singular_values.mata, adopath asis:rank_from_singular_values.mata}
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] pinv()}
{p 4 13 2}
Online: help for
{bf:{help mf_invsym:[M-5] invsym()}},
{bf:{help mf_cholinv:[M-5] cholinv()}},
{bf:{help mf_luinv:[M-5] luinv()}},
{bf:{help mf_qrinv:[M-5] qrinv()}},
{bf:{help mf_svd:[M-5] svd()}},
{bf:{help mf_fullsvd:[M-5] fullsvd()}};
{bf:{help m4_matrix:[M-4] matrix}},
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -