📄 mf_lowertriangle.hlp
字号:
{smcl}
{* 03dec2004}{...}
{cmd:help mata lowertriangle()}
{hline}
{* index lowertriangle()}{...}
{* index uppertriangle()}{...}
{* index _lowertriangle()}{...}
{* index _uppertriangle()}{...}
{title:Title}
{p 4 4 2}
{bf:[M-5] lowertriangle() -- Extract lower or upper triangle}
{title:Syntax}
{p 8 12 2}
{it:numeric matrix}
{cmd:lowertriangle(}{it:numeric matrix A} [{cmd:,}
{it:numeric scalar d}]{cmd:)}
{p 8 12 2}
{it:numeric matrix}
{cmd:uppertriangle(}{it:numeric matrix A} [{cmd:,}
{it:numeric scalar d}]{cmd:)}
{p 8 12 2}
{it:void}{bind: }
{cmd:_lowertriangle(}{it:numeric matrix A} [{cmd:,}
{it:numeric scalar d}]{cmd:)}
{p 8 12 2}
{it:void}{bind: }
{cmd:_uppertriangle(}{it:numeric matrix A} [{cmd:,}
{it:numeric scalar d}]{cmd:)}
{p 4 4 2}
where argument {it:d} is optional.
{title:Description}
{p 4 4 2}
{cmd:lowertriangle()} returns the lower triangle of
{it:A}.
{p 4 4 2}
{cmd:uppertriangle()} returns the upper triangle of
{it:A}.
{p 4 4 2}
{cmd:_lowertriangle()} replaces {it:A} with its lower triangle.
{p 4 4 2}
{cmd:_uppertriangle()} replaces {it:A} with its upper triangle.
{title:Remarks}
{p 4 4 2}
Remarks are presented under the headings
{bf:Optional argument d}
{bf:Nonsquare matrices}
{title:Optional argument d}
{p 4 4 2}
Optional argument {it:d} specifies the treatment of the diagonal.
Specifying {it:d}>={cmd:.}, or not specifying {it:d} at all, means no
special treatment; if
{c TLC}{c -} {c -}{c TRC}
{c |} 1 2 3 {c |}
{it:A} = {c |} 4 5 6 {c |}
{c |} 7 8 9 {c |}
{c BLC}{c -} {c -}{c BRC}
then
{c TLC}{c -} {c -}{c TRC}
{c |} 1 0 0 {c |}
{cmd:lowertriangle(}{it:A}{cmd:, .)} = {c |} 4 5 0 {c |}
{c |} 7 8 9 {c |}
{c BLC}{c -} {c -}{c BRC}
{p 4 4 2}
If a nonmissing value is specified for {it:d}, however, that value is
substituted for each element of the diagonal, for example,
{c TLC}{c -} {c -}{c TRC}
{c |} 1 0 0 {c |}
{cmd:lowertriangle(}{it:A}{cmd:, 1)} = {c |} 4 1 0 {c |}
{c |} 7 8 1 {c |}
{c BLC}{c -} {c -}{c BRC}
{title:Nonsquare matrices}
{p 4 4 2}
{cmd:lowertriangle()} and {cmd:uppertriangle()} may be used with nonsquare
matrices. If
{c TLC}{c -} {c -}{c TRC}
{c |} 1 2 3 4 {c |}
{it:A} = {c |} 5 6 7 8 {c |}
{c |} 9 10 11 12 {c |}
{c BLC}{c -} {c -}{c BRC}
then
{c TLC}{c -} {c -}{c TRC}
{c |} 1 0 0 {c |}
{cmd:lowertriangle(}{it:A}{cmd:)} = {c |} 5 6 0 {c |}
{c |} 9 10 11 {c |}
{c BLC}{c -} {c -}{c BRC}
and
{c TLC}{c -} {c -}{c TRC}
{c |} 1 2 3 4 {c |}
{cmd:uppertriangle(}{it:A}{cmd:)} = {c |} 0 6 7 8 {c |}
{c |} 0 0 11 12 {c |}
{c BLC}{c -} {c -}{c BRC}
{p 4 4 2}
{cmd:_lowertriangle()} and
{cmd:_uppertriangle()}, however, may not be used with nonsquare matrices.
{title:Conformability}
{cmd:lowertriangle(}{it:A}{cmd:,} {it:d}{cmd:)}:
{it:A}: {it:r x c}
{it:d}: 1 {it:x} 1 (optional)
{it:result}: {it:r x} min({it:r},{it:c})
{cmd:uppertriangle(}{it:A}{cmd:,} {it:d}{cmd:)}:
{it:A}: {it:r x c}
{it:d}: 1 {it:x} 1 (optional)
{it:result}: min({it:r},{it:c}) {it:x c}
{p 4 4 2}
{cmd:_lowertriangle(}{it:A}{cmd:,} {it:d}{cmd:)},
{cmd:_uppertriangle(}{it:A}{cmd:,} {it:d}{cmd:)}:
{p_end}
{it:input:}
{it:A}: {it:n x n}
{it:d}: 1 {it:x} 1 (optional)
{it:output:}
{it:A}: {it:n x n}
{title:Diagnostics}
{p 4 4 2}
None.
{title:Source code}
{p 4 4 2}
{view lowertriangle.mata, adopath asis:lowertriangle.mata},
{view uppertriangle.mata, adopath asis:uppertriangle.mata},
{view _lowertriangle.mata, adopath asis:_lowertriangle.mata},
{view _uppertriangle.mata, adopath asis:_uppertriangle.mata}
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] lowertriangle()}
{p 4 13 2}
Online: help for
{bf:{help m4_manipulation:[M-4] manipulation}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -