-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecover.m
34 lines (31 loc) · 1007 Bytes
/
recover.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function recover (i,l,inv_R)
global complete_sigma
global State
sum = 0;
for j=find(State.iSAM.R(i,:))
if (j~=i)
if (j>l)
if (isnan(complete_sigma(l,j)))
recover(l, j, inv_R);
end
sum = sum + State.iSAM.R(i,j) * complete_sigma(l,j);
else
if (isnan(complete_sigma(j,l)))
recover(j, l, inv_R);
end
sum = sum + State.iSAM.R(i,j) * complete_sigma(j,l);
end
end
end
if (i == l) % diagonal entries
complete_sigma(i,l) = (inv_R(l) * (inv_R(l) - sum));
if(isnan(complete_sigma(i,l)))
error('error in recover function. Wrongly set sigma value as nan');
end
else % off-diagonal entries
complete_sigma(i,l) = (- sum * inv_R(i));
if(isnan(complete_sigma(i,l)))
error('error in recover function. Wrongly set sigma value as nan');
end
complete_sigma(l,i) = complete_sigma(i,l);
end