LINE Solver
MATLAB API documentation
Loading...
Searching...
No Matches
MG1_RR_tempB.m
1% This script multiplies temp by B (i.e., temp*B) without
2% storing B (only b, r1, r2, c1 and c2).
3% recall B = L(b) + L(c1)L(Zr1)' + L(c2)L(Zr2)'
4
5hd=size(temp,1);
6
7% we start with temp*L(c1)
8for lus1=1:N
9 temp1(1:hd,(lus1-1)*m+1:lus1*m)=temp(1:hd,(lus1-1)*m+1:end)*c1(1:(N-lus1+1)*m,:);
10end
11% we now obtain (temp*L(c1))*L(Zr1)'
12for lus1=1:N-1
13 temp1b((lus1-1)*m+1:lus1*m,1:m)=r1((N-lus1-1)*m+1:(N-lus1)*m,:)';
14end
15temp2(1:hd,1:m)=zeros(hd,m);
16for lus1=2:N
17 temp2(1:hd,(lus1-1)*m+1:lus1*m)=temp1(1:hd,1:(lus1-1)*m)*...
18 temp1b((N-lus1)*m+1:end,:);
19end
20clear temp1;
21clear temp1b;
22% we continue with temp*Lc2
23for lus1=1:N
24 temp1(1:hd,(lus1-1)*m+1:lus1*m)=temp(1:hd,(lus1-1)*m+1:end)*c2(1:(N-lus1+1)*m,:);
25end
26% next we store temp*(L(c1)*L(Zr1)'+L(c2)*L(Zr2)') in temp2.
27for lus1=1:N-1
28 temp1b((lus1-1)*m+1:lus1*m,1:m)=r2((N-lus1-1)*m+1:(N-lus1)*m,:)';
29end
30for lus1=2:N
31 temp2(1:hd,(lus1-1)*m+1:lus1*m)=temp2(1:hd,(lus1-1)*m+1:lus1*m)+...
32 temp1(1:hd,1:(lus1-1)*m)*temp1b((N-lus1)*m+1:end,:);
33end
34% finally we add temp*L(b) to temp2
35for lus1=1:N
36 temp2(1:hd,(lus1-1)*m+1:lus1*m)=temp2(1:hd,(lus1-1)*m+1:lus1*m)+...
37 temp(1:hd,(lus1-1)*m+1:end)*b(1:(N-lus1+1)*m,:);
38end
39temp=temp2;
40clear temp1;
41clear temp2;
42clear temp1b;