-
Notifications
You must be signed in to change notification settings - Fork 0
/
AORA.m
80 lines (73 loc) · 1.8 KB
/
AORA.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
function [V s0] = AORA(A,E,c,b,S,q)
% [V s0] = AORA(A,E,c,b,S,q)
%
% Given A,E in R^{N x N}
% S = [s1 s2 ... sn]
%
% This is the Rational Arnoldi process for computing a basis for the union of n Krylov
% subspaces K_ji(Hi,ri) for i = 1...n
%
% where Hi = (A-si E)\E and ri = (si E - A)\b
%
% i.e. we perform ji iterations with each expansion point si
%
%
% Output: n x n matrix H and basis vectors v as columns of N x q matrix V.
% where q = sum(J)
%
% This was adapted from pseudocode from Table 1 of
% "An adaptive Arnoldi method for model-order reductions of linear time-invariant systems"
% (2004) by Lee, Chu, and Feng
%
% Efrem Rensi 8/2013
reorthogonalize = false;
N = length(b); % order of realization
n = length(S); % number of runs "restarts"
V = zeros(N,q);
H = zeros(q,q,n);
r = zeros(N,n);
k = zeros(N,n);
s0 = zeros(q,1);
hpi = zeros(1,n);
%% Initialize
for i = 1:n
[op{i} r(:,i)] = make_SI_op(A,E,b,S(i));
k(:,i) = r(:,i);
hpi(i) = 1;
end
%% Begin AORA Iterations
for j = 1:q
% Select the Expansion point with the Maximum Output Moment Error
moment_err = abs(c'*r .* hpi);
[~, idx_maxerr] = max(moment_err);
s0(j) = S(idx_maxerr);
% Generate Orthonormal Vector at s0(j)
nrm_r = norm(r(:,idx_maxerr));
if j > 1
H(j,j-1,idx_maxerr) = nrm_r;
end
V(:,j) = r(:,idx_maxerr) / nrm_r;
hpi(idx_maxerr) = hpi(idx_maxerr) * nrm_r;
% Update the Residue for the next iteration
for i = 1:n
if i == idx_maxerr
k(:,i) = op{i}(V(:,j));
end
r(:,i) = k(:,i);
for t = 1:j
vt = V(:,t);
H(t,j,i) = vt' * r(:,i);
r(:,i) = r(:,i) - H(t,j,i)*vt;
end
%% optional reorthogonalization
if reorthogonalize
h2 = zeros(j,1);
for t = 1:j
vt = V(:,t);
h2(t) = vt' * r(:,i);
r(:,i) = r(:,i) - h2(t)*vt;
end
H(1:j,j,i) = H(1:j,j,i) + h2;
end
end
end