📄 mf_solve_tol.hlp
字号:
{smcl}
{* 28mar2005}{...}
{cmd:help mata solve_tol()}
{hline}
{* index solve_tol()}{...}
{* index tolerances}{...}
{* index solve AX=B}{...}
{* index inverse matrix}{...}
{* index _solvetolerance tt}{...}
{title:Title}
{p 4 8 2}
{bf:[M-5] solve_tol() -- Tolerance used by solvers and inverters}
{title:Syntax}
{p 8 12 2}
{it:real scalar}
{cmd:solve_tol(}{it:numeric matrix Z}{cmd:,}
{it:real scalar usertol}{cmd:)}
{title:Description}
{p 4 4 2}
{cmd:solve_tol(}{it:Z}{cmd:,} {it:usertol}{cmd:)}
returns the tolerance used by many
Mata solvers to solve {it:AX}={it:B} and by many Mata inverters to obtain
{it:A}^(-1).
{it:usertol} is the tolerance specified by the
user or is missing value if the user did not specify a tolerance.
{title:Remarks}
{p 4 4 2}
The tolerance used by many Mata solvers to solve {it:AX}={it:B} and
by many Mata inverters to obtain {it:A}^(-1) is
{it:eta} = {it:s} * trace(abs({it:Z}))/{it:n}{right:(1) }
{p 4 4 2}
where {it:s}=1e-13 or a value specified by the user, {it:n} is the
min(rows({it:Z}), cols({it:Z})), and {it:Z} is a matrix related to
{it:A}, usually by some form of decomposition, but could be {it:A}
itself (for instance, if {it:A} were triangular).
See, for instance,
{bf:{help mf_solvelower:[M-5] solvelower()}} and
{bf:{help mf_cholsolve:[M-5] cholsolve()}}.
{p 4 4 2}
When {it:usertol}>0 and {it:usertol}<{cmd:.} is specified,
{cmd:solvetol()} returns {it:eta} calculated with {it:s}={it:usertol}.
{p 4 4 2}
When {it:usertol}<=0 is specified,
{cmd:solvetol()} returns -{it:usertol}.
{p 4 4 2}
When {it:usertol}>={cmd:.} is specified,
{cmd:solvetol()} returns a default result, calculated as
{p 8 12 2}
1. If external real scalar {cmd:_solvetolerance} does not exist, as
is usually the case, the value of {it:eta} is returned using
{it:s}=1e-13.
{p 8 12 2}
2. If external real scalar {cmd:_solvetolerance} does exist,
{p 12 16 2}
a. If {cmd:_solvetolerance}>0, the value of {it:eta} is returned
using {it:s}={cmd:solvetolerance}.
{p 12 16 2}
b. If {cmd:_solvetolerance}<=0, -{cmd:_solvetolerance} is returned.
{title:Conformability}
{cmd:solve_tol(}{it:Z}{cmd:,} {it:usertol}{cmd:)}:
{it:Z}: {it:r x c}
{it:usertol}: 1 {it:x} 1
{it:result}: 1 {it:x} 1
{title:Diagnostics}
{p 4 4 2}
{cmd:solve_tol(}{it:Z}{cmd:,} {it:usertol}{cmd:)}
skips over missing values in {it:Z} in calculating (1); {it:n} is
defined as the number of nonmissing elements on the diagonal.
{title:Source code}
{p 4 4 2}
{view solve_tol.mata, adopath asis:solve_tol.mata}
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] solve_tol()}
{p 4 13 2}
Online: help for
{bf:{help m4_utility:[M-4] utility}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -