I noticed that in Mata you can willy-nilly change the organizational type of
a declared variable, including one that is not declared a transmorphic
matrix, and even with -mata set matastrict on- (see below). It does lend
some flexibility, but I'm surprised that Mata lets you do it. Is the
philosophy behind this covered in the user's manual? I haven't run across
it. Is it a why-not philosophy?
Also, what is the intention of having three distinct vector organizational
type definitions (vector, rowvector and colvector)? Especially when you
can recast the variable so easily between row and column vectors after
having declared it the other? I'm still plodding through the manual, so it
might all be in there yet.
Joseph Coveney
: mata clear
: mata set matastrict on
:
: real colvector function flipem()
> {
> real rowvector A // Why does this
> A = (1, 2, 3)
> A = A' // allow this?
> return(A)
> }
:
: flipem()
1
+-----+
1 | 1 |
2 | 2 |
3 | 3 |
+-----+
:
: real colvector function expandem()
> {
> real scalar B // Why does this
> B = 2
> B = J(B, 1, 1) // allow this?
> return(B)
> }
:
: expandem()
1
+-----+
1 | 1 |
2 | 1 |
+-----+
:
: end
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/