Skip to content

Commit deec9fe

Browse files
committed
Improve the HSS full() function.
1 parent 22d36f0 commit deec9fe

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

@hss/full.m

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
function M = full(A)
2-
3-
m = size(A, 1);
4-
n = size(A, 2);
5-
6-
if m < n
7-
M = full(A')';
8-
return;
9-
end
10-
11-
if A.topnode == 0
12-
A.topnode = 1;
13-
M = hss_mul(A, eye(n));
14-
A.topnode = 0;
15-
else
16-
M = hss_mul(A, eye(n));
17-
end
1+
function [M, U, V] = full(H)
2+
if is_leafnode(H)
3+
M = H.D;
4+
U = H.U;
5+
V = H.V;
6+
else
7+
[M11, U1, V1] = full(H.A11);
8+
[M22, U2, V2] = full(H.A22);
9+
10+
M = [ M11 , U1 * H.B12 * V2' ; U2 * H.B21 * V1', M22 ];
11+
12+
if ~H.topnode
13+
U = blkdiag(U1, U2) * [ H.Rl ; H.Rr ];
14+
V = blkdiag(V1, V2) * [ H.Wl ; H.Wr ];
15+
else
16+
U = []; V = [];
17+
end
18+
end
19+
end

0 commit comments

Comments
 (0)