[SciPy-user] mid-size outerproduct too big for memory

Robert Kern rkern at ucsd.edu
Sun Apr 24 23:18:26 CDT 2005

Thomas Davidoff wrote:
> Thanks for the help.
> The code (attached) is going to reek of poor programming skills but I 
> think the dimensions on line 158 (where the program stops) are 
> conformable. 

Line 158 is this:
meanincomevec = outerproduct(diag(totalincomevec),householdvec)   # Want 
L x 1 ->  do LxL version of meanincome elements on diag, X L x 1)

What is L here? 15? Or 23297?

Now, are you sure that you want outerproduct here? You won't get a 
vector from outerproduct. You would get a matrix with shape (L*L, L). Is 
that what you want? However, since totalincomevec comes from a series of 
outerproducts itself, it may be much larger than what you thought. Print 
the shapes of these arrays before line 157 and between 157 and 158.

Read the documentation on outerproduct to make sure that it's what you want.

Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

More information about the SciPy-user mailing list