"Harry Commin" wrote in message <email@example.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.