📄 m6_glossary.hlp
字号:
{smcl}
{* 29mar2005}{...}
{cmd:help m6 glossary}
{hline}
{title:Title}
{p 4 4 2}
{bf:[M-6] glossary -- Mata glossary of common terms}
{title:Description}
{p 4 4 2}
Commonly used terms are defined here.
{title:Mata glossary}
{* index arguments, program}{...}
{p 4 8 2}
{bf:arguments}{break}
The values a function receives are called the function's arguments.
For instance, in {cmd:lud(}{it:A}{cmd:,} {it:L}{cmd:,} {it:U}{cmd:)},
{it:A}, {it:L}, and {it:U} are the arguments.
{* index type, broad}{...}
{* index broad type}{...}
{p 4 8 2}
{bf:broad type}{break}
Two matrices are said to be of the same broad type if the
elements in each are numeric, are string, or are pointers.
Mata provides two numeric types, real and complex. The term
{it:broad type} is used to mask the distinction within numeric,
and is often used when discussing operators or functions.
One might say, "the comma operator can be used to join the rows of two
matrices of the same broad type," and the implication of that is that one
could join a real to a complex. The result would be complex. Also see
{it:type}.
{* index c-conformability}{...}
{p 4 8 2}
{bf:c-conformability}{break}
Matrix, vector, or scalar {it:A} is said to be c-conformable with
matrix, vector, or scalar {it:B} if they have the same number of rows
and columns (they are {it:p-conformable}), or if they have the same
number of rows and one is a vector,
or if they have the same number of columns and one is a vector,
or if one
or the other is a scalar. c stands for colon; c-conformable matrices
are suitable for being used with Mata's {cmd::}{it:op} operators.
{it:A} and {it:B} are c-conformable if and only if
A B
{hline 22}
{it:r x c} {it:r x c}
{it:r x} 1 {it:r x c}
1 {it:x c} {it:r x c}
1 {it:x} 1 {it:r x c}
{it:r x c} {it:r x} 1
{it:r x c} 1 {it:x c}
{it:r x c} 1 {it:x} 1
{hline 22}
{p 8 8 2}
The idea behind c-conformability is generalized elementwise operation.
For example, consider {it:C}={it:A}:*{it:B}. If {it:A} and {it:B}
have the same number of rows and have the same number of columns, then
||{it:C}_{it:ij}|| = ||{it:A}_{it:ij}*{it:B}_{it:ij}||. Now say that
{it:A} is a column vector and {it:B} is a matrix. In that case,
||{it:C}_{it:ij}|| = ||{it:A}_{it:i}*{it:B}_{it:ij}||: each element of
{it:A} is applied to the entire row of {it:B}. If {it:A}
is a row vector, each column of {it:A} is applied to the entire column
of {it:B}. If {it:A} is a scalar, {it:A} is applied to every element
of {it:B}. And then all the rules repeat, with the roles of {it:A}
and {it:B} interchanged. See {bf:{help m2_op_colon:[M-2] op_colon}} for
a complete definition.
{p 4 8 2}
{bf:colvector}{break}
See {it:vector}.
{* index complex tt}{...}
{p 4 8 2}
{bf:complex}{break}
A matrix is said to be complex if its elements are complex numbers.
Complex is one of two numeric types in Stata, the other being real.
Note that complex is generally used to describe how a matrix is
stored and not the kind of numbers that happen to be in it:
complex matrix {it:Z} might contain real numbers.
Also see {it:type}.
{* index condition number}{...}
{p 4 8 2}
{bf:condition number}{break}
The condition number associated with a numerical problem is a measure of
that quantity's amenability to digital computation. A problem with a low
condition number is said to be well conditioned, whereas a problem with a
high condition number is said to be ill conditioned.
{p 8 8 2}
Sometimes reciprocals of condition numbers are reported and yet authors
will still refer to them as condition numbers. Reciprocal
condition numbers are often scaled between 0 and 1, with values near
epsilon(1) indicating problems.
{* index conformability}{...}
{* index conformability, also see c-conformability}{...}
{* index conformability, also see r-conformability}{...}
{* index conformability, also see p-conformability}{...}
{p 4 8 2}
{bf:conformability}{break}
Conformability refers to row-and-column matching between two or more
matrices. For instance, to multiply A*B, A must have the same number of
columns as B has rows. If that is not true, then the matrices are said to
be nonconformable (for multiplication).
{p 8 8 2}
Three kinds of conformability are often mentioned in the Mata
documentation: {it:p-conformability}, {it:c-conformability}, and
{it:r-conformability}.
{* index conjugate}{...}
{p 4 8 2}
{bf:conjugate}{break}
If {it:z} = {it:a} + {it:b}i, the conjugate of {it:z} is conj(z) =
{it:a} - {it:b}i. The conjugate is obtained by reversing the sign
of the imaginary part. Note that the conjugate of a real number is
the number itself.
{* index conjugate transpose}{...}
{* index transpose, also see conjugate transpose}{...}
{p 4 8 2}
{bf:conjugate transpose}{break}
See {it:transpose}.
{* index data matrix}{...}
{p 4 8 2}
{bf:data matrix}{break}
A dataset containing {it:n} observations on {it:k} variables in
often stored in an {it:n x k} matrix. An observation refers to a
row of that matrix; a variable refers to a column.
When the rows are observations and the columns variables, the matrix
is called a data matrix.
{* index declarations}{...}
{p 4 8 2}
{bf:declarations}{break}
Declarations state the {it:eltype} and {it:orgtype} of functions,
arguments, and variables. In
{cmd}real matrix myfunc(real vector A, complex scalar B)
{
real scalar i
{txt}...{cmd}
}{txt}
{p 8 8 2}
the {cmd:real matrix} is a function declaration, the {cmd:real vector}
and {cmd:complex scalar} are argument declarations, and
{cmd:real scalar i} is a variable declaration. The {cmd:real matrix}
states the function returns a real matrix. The {cmd:real vector}
and {cmd:complex scalar} state the kind of arguments {cmd:myfunc()}
expects and requires. The {cmd:real scalar i} helps Mata to produce
more efficient compiled code.
{p 8 8 2}
Declarations are optional, so the above could just as well have read
{cmd}function myfunc(A, B)
{
{txt}...{cmd}
}{txt}
{p 8 8 2}
When you omit the function declaration, you must substitute the word
{cmd:function}.
{p 8 8 2}
When you omit the other declarations,
{cmd:transmorphic matrix} is
assumed, which is fancy jargon for a matrix that can hold anything.
The advantages of explicit
declarations are that they reduce the chances you make a mistake either in
coding or in using the function, and they assist Mata in producing more
efficient code. Working interactively, most people omit the declarations.
{p 8 8 2}
See {bf:{help m2_declarations:[M-2] declarations}} for more information.
{* index defective matrix}{...}
{p 4 8 2}
{bf:defective matrix}{break}
An {it:n x n} matrix is defective if it does not have {it:n}
linearly independent eigenvectors.
{* index diagonal matrix}{...}
{p 4 8 2}
{bf:diagonal matrix}{break}
A matrix is diagonal if its off-diagonal elements are zero; {it:A} is
diagonal if {it:A}[{it:i},{it:j}]==0 for {it:i}!={it:j}. Usually,
diagonal matrices are also {it:square}. Some definitions require that a
diagonal matrix also be a square matrix.
{* index diagonal}{...}
{p 4 8 2}
{bf:diagonal of a matrix}{break}
The diagonal of a matrix is the set of elements {it:A}[{it:i},{it:j}].
{p 4 8 2}
{bf:eltype}{break}
See {it:type}.
{* index machine precision}{...}
{* index epsilon}{...}
{p 4 8 2}
{bf:epsilon(1)}, etc.{break}
epsilon(1) refers to the unit-roundoff error associated with a computer,
also informally called machine precision. It is the smallest amount
by which a number may differ from 1. For IEEE double-precision variables,
epsilon(1) is approximately 2.22045e-16.
{p 8 8 2}
epsilon({it:x}{cmd:)} is the smallest amount by which a real number
can differ from {it:x}, or an approximation thereof; see
{bf:{help mf_epsilon:[M-5] epsilon()}}.
{* index exp it}{...}
{p 4 8 2}
{bf:exp}{break}
{it:exp} is used in syntax diagrams to mean "any valid expression may
appear here"; see {bf:{help m2_exp:[M-2] exp}}.
{* index externals}{...}
{p 4 8 2}
{bf:external variable}{break}
See {it:global variable}.
{* index function}{...}
{p 4 8 2}
{bf:function}{break}
The words program and function are used interchangeably. The programs
that you write in Mata are in fact functions. Functions receive arguments
and optionally return results.
{p 8 8 2}
Examples of functions that are included with Mata are {cmd:sqrt()},
{cmd:ttail()}, and {cmd:substr()}. Such functions are often referred to as
the built-in functions or the library functions. Built-in functions refer
to functions implemented in the C code that implements Mata, and library
functions refer to functions written in the Mata programming language, but
many users use the words interchangeably because how functions are
implemented is of little importance. If you have a choice between using a
built-in function and a library function, however, the built-in function
will usually execute more quickly and the library function will be
easier to use. Mostly, however, features are implemented one way or the
other and you have no choice.
{p 8 8 2}
Also see {it:underscore functions}
{p 8 8 2}
For a list of the functions that Mata provides, see
{bf:{help m4_intro:[M-4] intro}}.
{* index global variable}{...}
{p 4 8 2}
{bf:global variable}{break}
Global variables, also known as external variables and as global external
variables, refer to variables that are common across programs, and which
programs may access without the variable being passed as an argument.
{p 8 8 2}
The variables you create interactively are global variables. Even so,
programs cannot access those variables without engaging in another step,
and global variables can be created without you creating them interactively.
{p 8 8 2}
To access (and create if necessary) global external variables, you
declare the variable in the body of your program:
{cmd:function myfunction(}...{cmd})
{
external real scalar globalvar
{txt}...{cmd}
}{txt}
{p 8 8 2}
See {bf:Linking to external globals} in
{bf:{help m2_declarations:[M-2] declarations}}.
{p 8 8 2}
There are other ways of creating and accessing global variables, but
the declaration method is recommended. The alternatives are
{cmd:crexternal()}, {cmd:findexternal()}, and {cmd:rmexternal()}
documented in {bf:{help mf_findexternal:[M-5] findexternal()}}
and {cmd:valofexternal()} documented in
{bf:{help mf_valofexternal:[M-5] valofexternal()}}.
{* index Hermitian matrices}{...}
{p 4 8 2}
{bf:Hermitian matrix}{break}
Matrix {it:A} is Hermitian if it is equal to its conjugate transpose;
{it:A}={it:A}{cmd:'}; see {it:transpose}.
This means that each off-diagonal element {it:a_ij} must equal the
conjugate of {it:a_ji}, and that the diagonal elements must be real. The
following matrix is Hermitian:
{c TLC} {c TRC}
{c |} 2 4+5i {c |}
{c |} 4-5i 6 {c |}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -