📄 m6_glossary.hlp
字号:
{* index source code}{...}
{p 4 8 2}
{bf:source code}{break}
Source code refers to the human-readable code that you type into
Mata to define a function. Source code is compiled into object
code, which is binary. See {bf:{help m1_how:[M-1] how}}.
{* index square matrix}{...}
{p 4 8 2}
{bf:square matrix}{break}
A matrix is square if it has the same number of rows and columns.
A 3 {it:x} 3 matrix is square; a 3 {it:x} 4 matrix is not.
{* index string}{...}
{p 4 8 2}
{bf:string}{break}
A matrix is said to be a string matrix if its elements are strings (text);
see {it:type}.
In Mata, a string may be text or binary and may be up to
2,147,483,647 characters (bytes) long.
{* index subscripts}{...}
{* index range subscripts, see subscripts}{...}
{* index list subscripts, see subscripts}{...}
{p 4 8 2}
{bf:subscripts}{break}
Subscripts are how you refer to an element or even a submatrix of a matrix.
{p 8 8 2}
Mata provides two kinds of subscripts, known as list subscripts and
range subscripts.
{p 8 8 2}
In list subscripts, {it:A}{cmd:[2,3]} refers to the (2,3) element
of {it:A}. {it:A}{cmd:[(2\3), (4,6)]} refers to the submatrix made up
of the second and third rows, fourth and sixth columns, of {it:A}.
{p 8 8 2}
In range subscripts, {it:A}{cmd:[|2,3|]} also refers to the (2,3)
element of {it:A}. {it:A}{cmd:[|2,3\4,6|]} refers to the submatrix
beginning at the (2,3) element and ending at the (4,6) element.
{p 8 8 2}
See {bf:{help m2_subscripts:[M-2] subscripts}} for more information.
{* index symmetric matrices}{...}
{p 4 8 2}
{bf:symmetric matrix}{break}
Matrix {it:A} is symmetric if {it:A}={it:A}{bf:'}. The word symmetric
is usually reserved for real matrices, and in that case, a
symmetric matrix is a square matrix with
{it:a_ij}=={it:a_ji}.
{p 8 8 2}
Matrix {it:A} is said to be Hermitian if {it:A}={it:A}{bf:'}, where
the transpose operator is understood to mean the conjugate-transpose
operator; see {it:Hermitian}. In Mata, the {bf:'} operator is the
conjugate-transpose operator, and thus, in this manual, we will use
the word symmetric both to refer to real, symmetric matrices and to
refer to complex, Hermitian matrices.
{p 8 8 2}
Sometimes, you will see us follow the word symmetric with a parenthesized
Hermitian, as in, "the resulting matrix is symmetric (Hermitian)".
That is done only for emphasis.
{p 8 8 2}
The inverse of a symmetric (Hermitian) matrix is symmetric (Hermitian).
{* index symmetriconly}{...}
{p 4 8 2}
{bf:symmetriconly}{break}
Symmetriconly is a word we have coined to refer to a square matrix
whose corresponding off-diagonal elements are equal to each other,
whether the matrix is real or complex. Symmetriconly matrices have
no mathematical significance, but sometimes, in data-processing and
memory-management routines, it is useful to be able to distinguish
such matrices.
{* index stata time-series operated variable}{...}
{* index stata op.varname, see stata time-series operated variable}{...}
{p 4 8 2}
{bf:time-series operated variable}{break}
Time-series operated variables are a Stata concept. The term refers to
{it:op}{cmd:.}{it:varname} combinations such as {cmd:L.gnp} to mean the
lagged value of variable {cmd:gnp}. Mata's
{bf:{help mf_st_data:[M-5] st_data()}} function works with
time-series operated variables just as it works with other variables, but
many other Stata-interface functions do not allow {it:op}{cmd:.}{it:varname}
combinations. In those cases, you must use
{bf:{help mf_st_tsrevar:[M-5] st_tsrevar()}}.
{* index traceback log}{...}
{p 4 8 2}
{bf:traceback log}{break}
When a function fails -- either because of a programming error or because
it was used incorrectly -- it produces a traceback log:
: {cmd:myfunction(2,3)}
{err}solve(): 3200 conformability error
mysub(): - function returned error
myfunction(): - function returned error
<istmt>: - function returned error{txt}
r(3200);
{p 8 8 2}
The log says that {cmd:solve()} detected the problem -- arguments are
not conformable -- and that {cmd:solve()} was called by {cmd:mysub()} was
called by {cmd:myfunction()} was called by what you typed at the keyboard.
See {bf:{help m2_errors:[M-2] errors}} for more information.
{p 4 8 2}
{bf:transpose}{break}
The transpose operator is written different ways in different books,
including {bf:'}, superscript {it:*}, superscript {it:T},
and superscript {it:H}. Here we use the {bf:'} notation:
{it:A}{bf:'} means the transpose of {it:A}, {it:A} with its rows
and columns interchanged.
{p 8 8 2}
In complex analysis, the transpose operator, however it is written, is
usually defined to mean the conjugate transpose; that is, one interchanges
the rows and columns of the matrix and then one takes the conjugate of
each of the elements, or one does it in the opposite order -- it makes no
difference. Conjugation simply means reversing the sign of the imaginary
part of a complex number: the conjugate of 1+2i is 1-2i. The conjugate
of a real is the number itself; the conjugate of 2 is 2.
{p 8 8 2}
In Mata, {cmd:'} is defined to mean conjugate transpose.
Since the conjugate of a real is the number itself, {it:A}{cmd:'}
is regular transposition when {it:A} is real. Similarly, we have
defined {it:'} so that it performs regular transposition for string and
pointer matrices. For complex matrices, however, {cmd:'} also performs
conjugation.
{p 8 8 2}
If you have a complex matrix and simply want to transpose it without
taking the conjugate of its elements, see
{bf:{help mf_transposeonly:[M-5] transposeonly()}}.
Or code {cmd:conj(}{it:A}{cmd:')}. The extra {cmd:conj()} will undo
the undesired conjugation performed by the transpose operator.
{p 8 8 2}
In most cases, however, you want transposition and conjugation to
go hand in hand. Most mathematical formulas, generalized to complex
values, work that way.
{* index triangular matrix}{...}
{* index lower triangular matrix, see triangular matrix}{...}
{* index upper triangular matrix, see triangular matrix}{...}
{p 4 8 2}
{bf:triangular matrix}{break}
A triangular matrix is a matrix with all elements equal to zero above the
diagonal or all elements equal to zero below the diagonal.
{p 8 8 2}
A matrix {it:A} is {it:lower triangular} if all elements are zero above
the diagonal, i.e., if {it:A}[{it:i},{it:j}]==0, {it:j}>{it:i}.
{p 8 8 2}
A matrix {it:A} is {it:upper triangular} if all elements are zero below
the diagonal, i.e., if {it:A}[{it:i},{it:j}]==0, {it:j}<{it:i}.
{p 8 8 2}
A {it:diagonal matrix} is both lower and upper triangular. That is worth
mentioning because any function suitable for use with triangular matrices
is suitable for use with diagonal matrices.
{p 8 8 2}
A triangular matrix is usually {it:square}.
{p 8 8 2}
The inverse of a triangular matrix is a triangular matrix. The
determinant of a triangular matrix is the product of the diagonal
elements. The eigenvalues of a triangular matrix are the diagonal
elements.
{* index eltype it}{...}
{* index orgtype it}{...}
{* index type it}{...}
{p 4 8 2}
{bf:type}, {bf:eltype}, and {bf:orgtype}{break}
The {it:type} of a matrix (or vector or scalar) is formally defined as the
matrix's {it:eltype} and {it:orgtype}, listed one after the other -- such
as {cmd:real} {cmd:vector} -- but it can also mean just one or the other
-- such as the {it:eltype} {cmd:real} or the {it:orgtype} {cmd:vector}.
{p 8 8 2}
{it:eltype} refers to the type of the elements. The {it:eltypes} are
{cmd:real} numbers such as 1, 2, 3.4
{cmd:complex} numbers such as 1+2i, 3+0i
{cmd:string} strings such as "bill"
{cmd:pointer} pointers such as {cmd:&}{it:varname}
{cmd:numeric} meaning {cmd:real} or {cmd:complex}
{cmd:transmorphic} meaning any of the above
{p 8 8 2}
{it:orgtype} refers to the organizational type.
{it:orgtype} specifies how the elements are organized. The {it:orgtypes}
are
{cmd:matrix} two-dimensional arrays
{cmd:vector} one-dimensional arrays
{cmd:colvector} one-dimensional column arrays
{cmd:rowvector} one-dimensional row arrays
{cmd:scalar} single items
{p 8 8 2}
The fully specified type is the element and organization types combined,
as in {cmd:real} {cmd:vector}.
{* index underscore functions}{...}
{* index functions, underscore}{...}
{p 4 8 2}
{bf:underscore functions}{break}
{it:Functions} whose names start with an underscore are called
underscore functions, and when an underscore function exists,
usually a function without the underscore prefix also exists.
In those cases, the function is usually implemented in terms of the
underscore function, and the underscore function is more difficult
to use but is faster or provides greater control. Usually, the
difference is in the handling of errors.
{p 8 8 2}
For instance, function {cmd:fopen()} opens a file. If the file does not
exist, execution of your program is aborted. Function {cmd:_fopen()} does
the same thing, but if the file cannot be opened, it returns a special
value indicating failure, and it is the responsibility of your program to
check the indicator and to take the appropriate action. This can be
useful when the file might not exist, and if it does not, you wish to take
a different action. In most cases, however, if the file does not exist,
you will wish to abort, and use of {cmd:fopen()} will allow you to write
less code.
{p 4 8 2}
{bf:unitary matrix}{break}
See {it:orthogonal matrix}.
{* index variable}{...}
{p 4 8 2}
{bf:variable}{break}
In a program, the entities that store values ({it:a}, {it:b}, {it:c}, ...,
{it:x}, {it:y}, {it:z}) are called variables. Variables are given names
of 1 to 32 characters in length. To be terribly formal about it, a
variable is a container; it contains a matrix, vector, or scalar and is
referred to by its variable name or by another variable containing a
{it:pointer} to it.
{p 8 8 2}
In addition, {it:variable} is sometimes used to refer to columns of
data matrices; see {it:data matrix} above.
{* index vector tt}{...}
{* index rowvector tt}{...}
{* index colvector tt}{...}
{p 4 8 2}
{bf:vector}, {bf:colvector}, and {bf:rowvector}{break}
A special case of a matrix with either one row or one column. A vector
may be substituted anywhere a matrix is required. A matrix, however, may
not be substituted for a vector.
{p 8 8 2}
A {cmd:colvector} is a vector with a single column.
{p 8 8 2}
A {cmd:rowvector} is a vector with a single row.
{p 8 8 2}
A {cmd:vector} is either a {cmd:rowvector} or {cmd:colvector},
without saying which.
{* index view matrix}{...}
{p 4 8 2}
{bf:view}{break}
A view is a special type of matrix that appears to be an ordinary matrix
but in fact the values in the matrix are the values of certain or all
variables and observations in the Stata dataset that is currently in
memory. Its values are not just equal to the dataset's values, they
are the dataset's values: if an element of the matrix is changed,
the corresponding variable and observation in the Stata dataset also
changes. Views are obtained by {cmd:st_view()} and are very efficient;
see {bf:{help mf_st_view:[M-5] st_view()}}.
{* index void function}{...}
{p 4 8 2}
{bf:void function}{break}
A function is said to be void if it returns nothing. For instance, the
function {bf:{help mf_printf:[M-5] printf()}} is a void function; it
prints results, but it does not return anything in the sense that, say,
{bf:{help mf_sqrt:[M-5] sqrt()}} does. It would not make any sense to
code {cmd:x} {cmd:=} {cmd:printf("hi there")} but coding {cmd:x}
{cmd:=} {cmd:sqrt(2)} is perfectly logical.
{* index void matrix}{...}
{p 4 8 2}
{bf:void matrix}{break}
A matrix is said to be void if it is 0 {it:x} 0, {it:r} {it:x} 0, or
0 {it:x} {it:c}; see {bf:{help m2_void:[M-2] void}}.
{title:Also see}
{p 4 13 2}
Manual: {hi:[M-6] glossary}
{p 4 13 2}
Online: help for
{bf:{help mata:[M-0] intro}};
{bf:{help m1_intro:[M-1] intro}}
{p_end}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -