📄 mf_edittoint.hlp
字号:
{smcl}
{* 11mar2005}{...}
{cmd:help mata edittoint()}
{hline}
{* index roundoff error}{...}
{* index edittoint()}{...}
{* index edittointtol()}{...}
{* index _edittoint()}{...}
{* index _edittointtol()}{...}
{title:Title}
{p 4 8 2}
{bf:[M-5] edittoint() -- Edit matrix for roundoff error (integers)}
{title:Syntax}
{p 8 8 2}
{it:numeric matrix}
{cmd:edittoint(}{it:numeric matrix Z}{cmd:,}
{it:real scalar amt}{cmd:)}
{p 8 8 2}
{it:void}{bind: }
{cmd:_edittoint(}{it:numeric matrix Z}{cmd:,}
{it:real scalar amt}{cmd:)}
{p 8 8 2}
{it:numeric matrix}
{cmd:edittointtol(}{it:numeric matrix Z}{cmd:,}
{it:real scalar tol}{cmd:)}
{p 8 8 2}
{it:void}{bind: }
{cmd:_edittointtol(}{it:numeric matrix Z}{cmd:,}
{it:real scalar tol}{cmd:)}
{title:Description}
{p 4 4 2}
These edit functions set elements of matrices to integers that are close
to integers.
{p 4 4 2}
{cmd:edittoint(}{it:Z}{cmd:,} {it:amt}{cmd:)} and
{cmd:_edittoint(}{it:Z}{cmd:,} {it:amt}{cmd:)} set
{it:Z_ij} = {cmd:round(}{it:Z_ij}{cmd:)} if |{it:Z_ij}-{cmd:round(}Z_ij{cmd:)}| <= |{it:tol}|
{p 4 4 2}
for {it:Z} real, and set
Re({it:Z_ij}) = {cmd:round(}Re(Z_ij){cmd:)} if |Re({it:Z_ij})-{cmd:round(}Re(Z_ij){cmd:)}| <= |{it:tol}|
Im({it:Z_ij}) = {cmd:round(}Im(Z_ij){cmd:)} if |Im({it:Z_ij})-{cmd:round(}Im(Z_ij){cmd:)}| <= |{it:tol}|
{p 4 4 2}
for {it:Z} complex, where, in both cases,
{it:tol} = {cmd:abs(}{it:amt}{cmd:)}{cmd:*epsilon(sum(abs(}{it:Z}{cmd:))/(rows(}{it:Z}{cmd:)*cols(}{it:Z}{cmd:)))}
{p 4 4 2}
{cmd:edittoint()} leaves {it:Z} unchanged and returns the edited matrix.
{cmd:_edittoint()} edits {it:Z} in place.
{p 4 4 2}
{cmd:edittointtol(}{it:Z}{cmd:,} {it:tol}{cmd:)} and
{cmd:_edittointtol(}{it:Z}{cmd:,} {it:tol}{cmd:)} do the same thing, except
that {it:tol} is specified directly.
{title:Remarks}
{p 4 4 2}
These functions mirror the {cmd:edittozero()} functions documented in
{bf:{help mf_edittozero:[M-5] edittozero()}}, except that, rather than solely
resetting to zero values close to zero, they reset to integer values
close to integers.
{p 4 4 2}
See {bf:{help mf_edittozero:[M-5] edittozero()}}.
Whereas use of the functions documented there is recommended, use of the
functions documented here is not, in general, recommended.
While zeros commonly arise in real problems so that
there is reason to suspect small numbers would be zero but for
roundoff error, integers arise more rarely.
{p 4 4 2}
If you have reason to believe that integer values are likely, then by
all means, use these functions.
{title:Conformability}
{cmd:edittoint(}{it:Z}{cmd:,} {it:amt}{cmd:)}:
{it:Z}: {it:r x c}
{it:amt}: 1 {it:x} 1
{it:result}: {it:r x c}
{cmd:_edittoint(}{it:Z}{cmd:,} {it:amt}{cmd:)}:
{it:input:}
{it:Z}: {it:r x c}
{it:amt}: 1 {it:x} 1
{it:output:}
{it:Z}: {it:r x c}
{cmd:edittointtol(}{it:Z}{cmd:,} {it:tol}{cmd:)}:
{it:Z}: {it:r x c}
{it:tol}: 1 {it:x} 1
{it:result}: {it:r x c}
{cmd:_edittointtol(}{it:Z}{cmd:,} {it:tol}{cmd:)}:
{it:input:}
{it:Z}: {it:r x c}
{it:tol}: 1 {it:x} 1
{it:output:}
{it:Z}: {it:r x c}
{title:Diagnostics}
{p 4 4 2}
None.
{title:Source code}
{p 4 4 2}
{view edittoint.mata, adopath asis:edittoint.mata},
{view _edittoint.mata, adopath asis:_edittoint.mata},
{view edittointtol.mata, adopath asis:edittointtol.mata},
{view _edittointtol.mata, adopath asis:_edittointtol.mata}
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] edittoint()}
{p 4 13 2}
Online: help for
{bf:{help mf_edittozero:[M-5] edittozero()}};
{bf:{help m4_manipulation:[M-4] manipulation}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -