The Math Forum

Search All of the Math Forum:

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

Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Harry Commin" wrote in message <k7ue91$mh1$>...
> 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

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.