-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMP_TC_IE1.m
62 lines (55 loc) · 1.91 KB
/
MP_TC_IE1.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
%% Multiplied propagator for single-step terminal-cost implicit Euler
% See Appendix C of the thesis for information about MPs
%
classdef MP_TC_IE1 < handle
properties
d
Xi_f_
Xi_b_
XiPhi_f_
XiPhi_b_
XiPsi_f_
XiPsi_b_
Xi_f
Xi_b
XiPhi_f
XiPhi_b
XiPsi_f
XiPsi_b
end
methods
function mp = MP_TC_IE1(K, obj, dt)
d = size(K, 1);
mp.d = d;
mp.Xi_f_ = speye(d) + dt*K;
mp.Xi_b_ = speye(d) + dt*K';
mp.XiPhi_f_ = speye(d);
mp.XiPhi_b_ = speye(d);
mp.XiPsi_f_ = dt/obj.gamma*speye(d);
mp.XiPsi_b_ = sparse(d,d);
mp.Xi_f = mp.Xi_f_;
mp.Xi_b = mp.Xi_b_;
mp.XiPhi_f = mp.XiPhi_f_;
mp.XiPhi_b = mp.XiPhi_b_;
mp.XiPsi_f = mp.XiPsi_f_;
mp.XiPsi_b = mp.XiPsi_b_;
end
function update_subenh(self, S, SP, SQ)
nonproj = eye(2*self.d) - S*S';
Pproj = SP*S';
Qproj = SQ*S';
self.XiPhi_f = self.XiPhi_f_ * nonproj(1:self.d,1:self.d) ...
- self.XiPsi_f_ * nonproj(self.d+1:end,1:self.d) ...
+ self.Xi_f_ * Pproj(:,1:self.d);
self.XiPsi_f = self.XiPsi_f_ * nonproj(self.d+1:end,self.d+1:end) ...
- self.XiPhi_f_ * nonproj(1:self.d,self.d+1:end) ...
- self.Xi_f_ * Pproj(:,self.d+1:end);
self.XiPsi_b = self.XiPsi_b_ * nonproj(1:self.d,1:self.d) ...
+ self.XiPhi_b_ * nonproj(self.d+1:end,1:self.d) ...
+ self.Xi_b_ * Qproj(:,1:self.d);
self.XiPhi_b = self.XiPhi_b_ * nonproj(self.d+1:end,self.d+1:end) ...
+ self.XiPsi_b_ * nonproj(1:self.d,self.d+1:end) ...
+ self.Xi_b_ * Qproj(:,self.d+1:end);
end
end
end