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]

st: Re: Fwd: Linear indexing of matrices in Mata


From   "Joseph Coveney" <[email protected]>
To   <[email protected]>
Subject   st: Re: Fwd: Linear indexing of matrices in Mata
Date   Tue, 24 Jul 2012 12:06:09 +0900

Joerg Luedicke wrote (excerpted):

. . . Especially if you have several of the same expressions that
need to be evaluated, the code gets messy and it probably slows things
down as the expression has to be evaluated every time instead of just
once if it would be possible to index elements.

--------------------------------------------------------------------------------

I don't understand what you mean here:  I don't understand how

    index=which(m1>2)
    m2[index]

would be less messy or less slowed down than

    index_which(M2, (M1 :> 2))

when you have several of the same expressions that need to be evaluated.  Are
you referring to vectorization or ?apply() or something?

Could you illustrate what you mean with an example?

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/


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