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: RE: mata: columns of different eltypes in a transmorphic matrix
From
Joe Canner <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: RE: mata: columns of different eltypes in a transmorphic matrix
Date
Thu, 10 Oct 2013 01:50:47 +0000
Laszlo,
As I understand it, transmorphic means that a matrix can take on one of a number of types (real, complex, string, or pointer), not that it can be comprised of multiple types. This is useful for making functions that can handle different types of arguments, but is probably not helpful for what you want to do.
See here for an interesting discussion of the origins of transmorphic matrices in Mata: http://www.stata.com/statalist/archive/2006-10/msg00739.html (I am assuming, absent evidence to the contrary, that Bill has not changed his mind about transmorphic matrices since 2006.)
As for the documentation, while it does specifically prohibit or discourage what you are trying to do, it certainly does not give any reason to think that it is possible.
Regards,
Joe
________________________________________
From: [email protected] [[email protected]] on behalf of László Sándor [[email protected]]
Sent: Wednesday, October 09, 2013 8:56 PM
To: [email protected]
Subject: st: mata: columns of different eltypes in a transmorphic matrix
Hi all,
I am confused by some behavior in StataMP 13 on my mac.
I am pretty sure that a transmorphic matrix can have columns (or
simply cells) of different types, as you can easily grab some Stata
data with st_data and the resulting matrix will hold both strings and
reals according to your Stata variables.
But then I am not sure I understand why Stata complains about joining
transmorphic matrices into a transmorphic matrix if some of them
happen to hold reals and other strings. Why isn't this OK if I mean
the end result to hold cells of both types?
I tried to define a transmorphic placeholder first and fill in the
columns one by one, but if I start with (transmorphic colvectors
happening to be:) real colvectors the code breaks when I get to the
string colvector.
I don't see why this is invalid or why this limitation isn't better
documented. In any case, it would be nice to have a way around this.
Thanks!
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/