Bookmark and Share

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]

Re: st: RE: mata: columns of different eltypes in a transmorphic matrix


From   László Sándor <[email protected]>
To   [email protected]
Subject   Re: st: RE: mata: columns of different eltypes in a transmorphic matrix
Date   Wed, 9 Oct 2013 22:26:41 -0400

Thanks, Joe.

I would understand the limitation, but then don't understand what
st_data/st_view matrices will be if the underlying data has both
string variables and numeric variables. My code did not complain when
I only had that before.

And in any case, as my implementation is about lookups, indices and
ordering, it would be a huge pain to collect the data in two matrices
kept "in sync", meaning the same indices and ordering. Well-well.

On Wed, Oct 9, 2013 at 9:50 PM, Joe Canner <[email protected]> wrote:
> 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/

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index