📄 mf_sum.hlp
字号:
{smcl}
{* 23mar2005}{...}
{cmd:help mata sum()}
{hline}
{* index rowsum()}{...}
{* index colsum()}{...}
{* index sum()}{...}
{* index quadrowsum()}{...}
{* index quadcolsum()}{...}
{* index quadsum()}{...}
{* index quad precision}{...}
{title:Title}
{p 4 8 2}
{bf:[M-5] sum() -- Sums}
{title:Syntax}
{p 8 12 2}
{it:numeric colvector}
{cmd:rowsum(}{it:numeric matrix Z}{cmd:)}
{p 8 12 2}
{it:numeric rowvector}
{cmd:colsum(}{it:numeric matrix Z}{cmd:)}
{p 8 12 2}
{it:numeric scalar}{bind: }
{cmd:sum(}{it:numeric matrix Z}{cmd:)}
{p 8 12 2}
{it:numeric colvector}
{cmd:quadrowsum(}{it:numeric matrix Z}{cmd:)}
{p 8 12 2}
{it:numeric rowvector}
{cmd:quadcolsum(}{it:numeric matrix Z}{cmd:)}
{p 8 12 2}
{it:numeric scalar}{bind: }
{cmd:quadsum(}{it:numeric matrix Z}{cmd:)}
{title:Description}
{p 4 4 2}
{cmd:rowsum(}{it:Z}{cmd:)} returns a colvector containing the
sum over the rows of {it:Z}.
{p 4 4 2}
{cmd:colsum(}{it:Z}{cmd:)} returns a rowvector containing the
sum over the columns of {it:Z}.
{p 4 4 2}
{cmd:sum(}{it:Z}{cmd:)} returns a scalar containing the
sum over the rows and columns of {it:Z}.
{p 4 4 2}
{cmd:quadrowsum()},
{cmd:quadcolsum()}, and
{cmd:quadsum()} are quad-precision variants of
the above functions.
The sum is accumulated in quad precision and then rounded
to double precision and returned.
{p 4 4 2}
In all cases, missing values are treated as zero.
The functions may be used with real or complex matrix {it:Z}.
{title:Remarks}
{p 4 4 2}
All functions return the same type as the argument, real if argument is real,
complex if complex.
{title:Conformability}
{cmd:rowsum(}{it:Z}{cmd:)}, {cmd:quadrowsum(}{it:Z}{cmd:)}:
{it:Z}: {it:r x c}
{it:result}: 1 {it:x c}
{cmd:colsum(}{it:Z}{cmd:)}, {cmd:quadcolsum(}{it:Z}{cmd:)}:
{it:Z}: {it:r x c}
{it:result}: {it:r x} 1
{cmd:sum(}{it:Z}{cmd:)}, {cmd:quadsum(}{it:Z}{cmd:)}:
{it:Z}: {it:r x c}
{it:result}: 1 {it:x} 1
{title:Diagnostics}
{p 4 4 2}
Missing values are treated as as contributing zero to the sum; they do
not cause the sum to become missing.
{title:Source code}
{p 4 4 2}
Functions are built-in.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-5] sum()}
{p 4 13 2}
Online: help for
{bf:{help mf_mean:[M-5] mean()}},
{bf:{help mf_cross:[M-5] cross()}};
{bf:{help m4_utility:[M-4] utility}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -