Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Reducing memory requirements for tiled matrices
Replies: 5   Last Post: Nov 14, 2012 11:27 AM

 Messages: [ Previous | Next ]
 Roger Stafford Posts: 5,929 Registered: 12/7/04
Reducing memory requirements for tiled matrices
Posted: Nov 13, 2012 8:19 PM

"Harry Commin" wrote in message <k7ue91\$mh1\$1@newscl01ah.mathworks.com>...
> I need to perform element-by-element multiplication between two "tiled" matrices (i.e. where relatively few unique values are repeated in a structured, tiled manner). However, these matrices (formed by a double Kronecker product) are large and I only have enough memory to process one of them at a time.
>
> Using (x) to denote a Kronecker product, the required operation is:
>
> (ones(1,Ms) (x) F (x) ones(Ns,1)) .* (ones(Nf,1) (x) S (x) ones(1,Mf))
>
> where F is (Nf*N0 x Mf)
> and S is (Ns*N0 x Ms)
>
> Is there a computationally efficient way of getting this result? I feel that so few unique values should not need to hog so much memory. I know I can replace ones() (x) A with a repmat() operation, but other than that I'm stumped.

- - - - - - - -
Your final kronecker product will be an Nf*Ns*N0 by Mf*Ms matrix in size. Furthermore each of its elements is different in general - that is, each is a product of a different pair of factors from F and S. Therefore if you are having memory problems, this size itself is a major part of that memory usage. Presumably you could use a set of for-loops to directly generate this result and thereby avoid having to store intermediate 'kron' products, but I doubt if you would gain much more than a one-third savings in memory usage this way.

As I see it your principal difficulty is that even though there may be relatively few unique values in each of the two separate double kronecker products, when they are element-by-element multiplied together, each of the element products in the result is as I say unique.

Perhaps the real question to ask is what you intend to do with these final matrices if you have a number of them to generate. You won't have enough memory to store more than a very few at any one time. Perhaps there is some shortcut in achieving this purpose that can be accomplished without creating these huge matrices.

Roger Stafford

Date Subject Author
11/13/12 Harry Commin
11/13/12 Roger Stafford
11/14/12 Roger Stafford
11/14/12 Harry Commin
11/14/12 Steven Lord
11/14/12 Roger Stafford