{smcl} {bf:Mata course: Interpretive commands} {hline} {title:Syntax} {p 4 8 2} They are used from the Mata colon (:) prompt. {p 4 8 2} They start with the word {cmd:mata}. {p 4 8 2} They are documented in {bf:{help m3_intro:[M-3]}}. {p 4 8 2} They describe and manipulate the environment you are in {bf:RIGHT NOW}. {p 4 8 2} Mata programs are compiled. They run {bf:LATER}. {p 4 8 2} Mata programs never use Mata interpretive commands. {title:mata describe and mata clear} {com}. mata {txt}{hline 49} mata (type {cmd:end} to exit) {hline} {com}: mata describe {txt}# bytes type name and extent {hline 71} {res} 76 {txt}transmorphic matrix {res}add{txt}() {res} 200 {txt}real matrix {res}id{txt}() {res} 32 {txt}real matrix {res}A{txt}[2,2] {res} 32 {txt}real matrix {res}B{txt}[2,2] {res} 72 {txt}real matrix {res}I3{txt}[3,3] {res} 48 {txt}real matrix {res}M{txt}[3,2] {res} 48 {txt}real matrix {res}S{txt}[3,2] {res} 72 {txt}real matrix {res}X{txt}[3,3] {res} 72 {txt}real matrix {res}Xi{txt}[3,3] {res} 64 {txt}complex matrix {res}Z{txt}[2,2] {res} 16 {txt}real colvector {res}a{txt}[2] {res} 16 {txt}complex scalar {res}acomplex 8 {txt}real scalar {res}areal 16 {txt}real colvector {res}b{txt}[2] {res} 32 {txt}real colvector {res}c{txt}[4] {res} 8 {txt}real scalar {res}findout 16 {txt}real rowvector {res}x{txt}[2] {res} 16 {txt}real rowvector {res}y{txt}[2] {res} 32 {txt}real rowvector {res}z{txt}[4] {hline 71}{txt} {com}: mata clear {com}: mata describe {txt}# bytes type name and extent {hline 71} {hline 71}{txt} {p 4 4 2} Mata's {cmd:mata clear} command clears Mata. {p 4 4 2} Stata's {cmd:clear} command also clears Mata, and lots more. {title:mata query and mata set} {com}: mata query {txt}{hline} Mata settings {col 17}{help mata_set:set matastrict}{col 37}{res}off {txt}{col 17}{help mata_set:set matalnum}{col 37}{res}off {txt}{col 17}{help mata_set:set mataoptimize}{col 37}{res}on {txt}{col 17}{help mata_set:set matafavor}{col 37}{res}space{txt}{col 48}may be {res:space} or {res:speed} {col 17}{help mata_set:set matacache}{col 37}{res}400{txt}{col 48}kilobytes {col 17}{help mata_set:set matalibs}{col 37}{res}lmatabase;lmataado {txt}{col 17}{help mata_set:set matamofirst}{col 37}{res}off {com}: mata set matafavor speed {com}: mata query {txt}{hline} Mata settings {col 17}{help mata_set:set matastrict}{col 37}{res}off {txt}{col 17}{help mata_set:set matalnum}{col 37}{res}off {txt}{col 17}{help mata_set:set mataoptimize}{col 37}{res}on {txt}{col 17}{help mata_set:set matafavor}{col 37}{res}speed{txt}{col 48}may be {res:space} or {res:speed} {col 17}{help mata_set:set matacache}{col 37}{res}400{txt}{col 48}kilobytes {col 17}{help mata_set:set matalibs}{col 37}{res}lmatabase;lmataado {txt}{col 17}{help mata_set:set matamofirst}{col 37}{res}off {title:mata which} {com}: mata which I() {txt}I(): built-in {com}: mata which solvelower() {txt}solvelower(): lmatabase {com}: mata which recorr() {err}function recorr() not found {txt}{search r(111):r(111);} {p 4 4 2} Implications: {p 8 11 2} -- You {bf:CANNOT} look at the source for {cmd:I()} {p 8 11 2} -- You {bf:CAN} look at the source for {cmd:solvelower()} {p 8 11 2} -- No function named {cmd:recorr()} exists {p 8 11 2} -- You {bf:CANNOT} create a function named {cmd:I()} {p 8 11 2} -- You {bf:CAN} create a function named {cmd:solvelower()} (surprise!){break} (You do not want to unless You are fixing a bug) {p 8 11 2} -- You {bf:CAN} create a function named {cmd:recorr()} {title:mata mosave and mata mlib} {p 8 12 2} -- You can use {cmd:mata mosave} to create {cmd:.mo} files. {p 8 12 2} -- You can use {cmd:mata mlib} to create {cmd:.mlib} files. {p 8 12 2} -- They contain compiled source code (object code). {p 8 12 2} -- {cmd:.mo} files contain object code for one (1) function. {p 8 12 2} -- {cmd:.mlib} files contain object codes for lots of functions (up to 500). {p 4 4 2} All of that is getting ahead of ourselves. {p 4 4 2} Even sophisticated programmers may never need these features. {title:Other interpretive commands} {p 4 4 2} Rarely used. {hline} {bf:{view talk.smcl:Top}}