Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

re: st: matrix operations when N exceeds matsize

From   Kit Baum <BAUM@BC.EDU>
Subject   re: st: matrix operations when N exceeds matsize
Date   Tue, 18 May 2010 16:35:48 -0400

Re my last posting, to move Stata variables into Mata and get the resulting matrix back is straightforward (even with N = 120,000):

set obs 120000
forv i=1/10 {
	g W`i' = runiform()
	g B`i' = runiform()
	loc wl "`wl' W`i'"
	loc bl "`bl' B`i'"
st_view(W=., ., st_local("wl"))
st_view(B=., ., st_local("bl"))
vard = runiform(10,10)
result = W' * B * vard * B' * W
st_matrix("result", result)
mat list result

NB. I have about 500m allocated to Stata (which would work even on a 32-bit machine). The use of views in Mata avoids making a copy of those 120000 x 10 x 2 variables, which saves a great deal of memory.

Kit Baum   |   Boston College Economics & DIW Berlin   |
                              An Introduction to Stata Programming  |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index