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 14, 2012 2:49 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Roger Stafford" wrote in message <k7urig$875$>...
> ....... Presumably you could use a set of for-loops to directly generate this result and thereby avoid having to store intermediate 'kron' products, ......
- - - - - - - - -
The following code uses the for-loop method I mentioned earlier. It will compute your element-by-element product of the two double kronecker products you described using your definitions of N0, Nf, Ns, Mf, and Ms for the sizes involved. The only matrix it creates is 'K' containing the desired result, so it will save you memory space, but at the cost of slower execution than with the use of the 'kron' function.

K = zeros(Nf*Ns*N0,Mf*Ms);
for i1 = 1:Nf*N0
for j1 = 1:Mf
t = F(i1,j1);
for i2 = 1:Ns
for j2 = 1:Ms
K(i2+Ns*(i1-1),j1+Mf*(j2-1)) = t;
for i1 = 1:Ns*N0
for j1 = 1:Ms
t = S(i1,j1);
for i2 = 1:Nf
for j2 = 1:Mf
K(i1+Ns*N0*(i2-1),j2+Mf*(j1-1)) = ...

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.