Mata course: Interpretive commands

Syntax

They are used from the Mata colon (:) prompt.

They start with the word mata.

They are documented in [M-3].

They describe and manipulate the environment you are in RIGHT NOW.

Mata programs are compiled. They run LATER.

Mata programs never use Mata interpretive commands.

mata describe and mata clear

. mata

mata (type end to exit)

: mata describe

# bytes type name and extent

76 transmorphic matrix add()
200 real matrix id()
32 real matrix A[2,2]
32 real matrix B[2,2]
72 real matrix I3[3,3]
48 real matrix M[3,2]
48 real matrix S[3,2]
72 real matrix X[3,3]
72 real matrix Xi[3,3]
64 complex matrix Z[2,2]
16 real colvector a[2]
16 complex scalar acomplex
8 real scalar areal
16 real colvector b[2]
32 real colvector c[4]
8 real scalar findout
16 real rowvector x[2]
16 real rowvector y[2]
32 real rowvector z[4]

: mata clear

: mata describe

# bytes type name and extent

Mata's mata clear command clears Mata.

Stata's clear command also clears Mata, and lots more.

mata query and mata set

: mata query

Mata settings
set matastrict off
set matalnum off
set mataoptimize on
set matafavor space may be space or speed
set matacache 400 kilobytes
set matalibs lmatabase;lmataado
set matamofirst off

: mata set matafavor speed

: mata query

Mata settings
set matastrict off
set matalnum off
set mataoptimize on
set matafavor speed may be space or speed
set matacache 400 kilobytes
set matalibs lmatabase;lmataado
set matamofirst off

mata which

: mata which I()
I(): built-in

: mata which solvelower()
solvelower(): lmatabase

: mata which recorr()
function recorr() not found
r(111);

Implications:

-- You CANNOT look at the source for I()

-- You CAN look at the source for solvelower()

-- No function named recorr() exists

-- You CANNOT create a function named I()

-- You CAN create a function named solvelower() (surprise!)

(You do not want to unless You are fixing a bug)

-- You CAN create a function named recorr()

mata mosave and mata mlib

-- You can use mata mosave to create .mo files.

-- You can use mata mlib to create .mlib files.

-- They contain compiled source code (object code).

-- .mo files contain object code for one (1) function.

-- .mlib files contain object codes for lots of functions (up to 500).

All of that is getting ahead of ourselves.

Even sophisticated programmers may never need these features.

Other interpretive commands

Rarely used.

Top