Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Using -J()- in Mata when initializing vectors
From
"Joseph Coveney" <[email protected]>
To
<[email protected]>
Subject
st: Using -J()- in Mata when initializing vectors
Date
Thu, 14 Apr 2011 12:57:11 +0900
Does anyone have advice about whether -J(1, <vector length>, <element>)- or
-J(<vector length>, 1, <element>)- is better when initializing a -vector-
organizational type in Mata?
The online documentation for declarations (-help m2_declarations-) says, "If n
had been declared a vector, a 0 x 1 vector would have been created. Mata could
just as well have created a 1 x 0 vector, but it creates a 0 x 1." This is the
same result as when n is declared to be -colvector- (see just above in the help
file). Can I rightly construe this to imply that Mata would favor
-J(<vector length>, 1, <element>)-?
Assuming that the -vector- organizational type is not intended for use in
inner or outer products, etc., is there any other reason to favor one -J()-
over the other with -vector-?
Joseph Coveney
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/