|
|
Reducing memory requirements for tiled matrices
Posted:
Nov 14, 2012 11:27 AM
|
|
"Harry Commin" wrote in message <k8010m$98f$1@newscl01ah.mathworks.com>... > Yes, using multiple loops was actually my starting point, but then I removed the loops in an attempt to speed up execution. This worked pretty well for modestly-sized matrices (allowing execution to finish within a day or two). However, I've hit a wall with this slightly larger data size in that I now run out of memory. > > I suppose a brute-force approach would be to get my hands on a 64-bit architecture. Or I could try keeping "some" loops and not others... but it's difficult to identify a good trade-off. - - - - - - - - - - - Just in case you are still interested in "loops" solutions, here is a modification of the code I sent before. I think you can replace the repmat term with just the scalar F(i1,j1). I had to use the repmat version on my very ancient system.
K = zeros(Nf*Ns*N0,Mf*Ms); for i1 = 1:Nf*N0 for j1 = 1:Mf K(1+Ns*(i1-1):Ns*i1,j1:Mf:j1+Mf*(Ms-1)) = repmat(F(i1,j1),Ns,Ms); end end for i1 = 1:Ns*N0 for j1 = 1:Ms i2 = i1:Ns*N0:i1+Ns*N0*(Nf-1); j2 = 1+Mf*(j1-1):Mf*j1; K(i2,j2) = K(i2,j2)*S(i1,j1); end end
Roger Stafford
|
|