Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: How Mata stores matrixes


From   "Joseph Coveney" <jcoveney@bigplanet.com>
To   "Statalist" <statalist@hsphsun2.harvard.edu>
Subject   st: How Mata stores matrixes
Date   Sun, 30 Mar 2008 21:48:24 +0900

I need to repeatedly traverse the larger dimension of a real matrix in Mata.
Some of the traversals involve updating the value of the ith element based
upon the value in the ith-1 element.  I have a choice of dimensioning the
matrix as 4  5000 (four rows, 5000 columns) or 5000  4.  Would one work
faster?  (Ultimately, I'd experiment with copying the set of the involved
elements left-shifted into a temporary vector and use colon operators.  But
right now, I'd just like to get the algorithm implemented stably using
brute-force loops before tweaking the code with Mata-specific language
features that are new to me.)

Likewise, if  I'm porting Fortran-77 source code to Mata that involves
nested loops on row and columns of a matrix, what care should I take about
which index varies faster?

Joseph Coveney


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



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index