Recursive Blocked Algorithms—Part II
•
421
Algorithm 1: rtrgsyl
Input:
(
A
,
C
) (
M
×
M
) and (
B
,
D
) (
N
×
N
) in upper generalized Schur form.
E
(
M
×
N
) dense
matrix.
blks
, block size that specifies when to switch to a standard algorithm for solving
smallsized triangular generalized Sylvester equations.
Output:
X
(
M
×
N
), the solution of
AXB
T

CXD
T
=
E
.
X
is allowed to overwrite
E
.
function
[
X
]
=
rtrgsyl
(
A
,
B
,
C
,
D
,
E
,
uplo
,
blks
)
if
1
≤
M
,
N
≤
blks
then
X
=
trgsyl
(
A
,
B
,
C
,
D
,
E
,
uplo
);
else switch
uplo
case
1
if
1
≤
N
≤
M
/
2
% Case 1: Split (
A
,
C
) (by rows and columns),
E
(by rows only)
X
2
=
rtrgsyl
(
A
22
,
B
,
C
22
,
D
,
E
2
,
uplo
,
blks
);
E
1
=
axb
(

A
12
,
X
2
,
B
T
,
E
1
);
E
1
=
axb
(
C
12
,
X
2
,
D
T
,
E
1
);
X
1
=
rtrgsyl
(
A
11
,
B
,
C
11
,
D
,
E
1
,
uplo
,
blks
);
X
=
[
X
1
;
X
2
];
elseif
1
≤
M
≤
N
/
2
% Case 2: Split (
B
,
D
) (by rows and columns),
E
(by columns only)
X
2
=
rtrgsyl
(
A
,
B
22
,
C
,
D
22
,
E
2
,
uplo
,
blks
);
E
1
=
axb
(

A
,
X
2
,
B
T
12
,
E
1
);
E
1
=
axb
(
C
,
X
2
,
D
T
12
,
E
1
);
X
1
=
rtrgsyl
(
A
,
B
11
,
C
,
D
11
,
E
1
,
uplo
,
blks
);
X
=
[
X
1
,
X
2
];
else
%
M
,
N
>
blks
Case 3: Split (
A
,
C
), (
B
,
D
) and
E
(all by rows and columns)
X
22
=
rtrgsyl
(
A
22
,
B
22
,
C
22
,
D
22
,
E
22
,
uplo
,
blks
);
E
12
=
axb
(

A
12
,
X
22
,
B
T
22
,
E
12
);
E
12
=
axb
(
C
12
,
X
22
,
D
T
22
,
E
12
);
E
21
=
axb
(

A
22
,
X
22
,
B
T
12
,
E
21
);
E
21
=
axb
(
C
22
,
X
22
,
D
T
12
,
E
21
);
X
12
=
rtrgsyl
(
A
11
,
B
22
,
C
11
,
D
22
,
E
12
,
uplo
,
blks
);
X
21
=
rtrgsyl
(
A
22
,
B
11
,
C
22
,
D
11
,
E
21
,
uplo
,
blks
);
if
M
<
N
then
E
11
=
axb
(

A
11
,
X
12
,
B
T
12
,
E
11
);
E
11
=
axb
(
C
11
,
X
12
,
D
T
12
,
E
11
);
E
11
=
axb
(

A
12
, [
X
21
X
22
], [
B
11
B
12
]
T
,
E
11
);
E
11
=
axb
(
C
12
, [
X
21
X
22
], [
D
11
D
12
]
T
,
E
11
);
else
E
11
=
axb
(

A
12
,
X
21
,
B
T
11
,
E
11
);
E
11
=
axb
(
C
12
,
X
21
,
D
T
11
,
E
11
);
E
11
=
axb
(

[
A
11
A
12
],
£
X
T
12
X
T
22
/
T
,
B
T
12
,
E
11
);
E
11
=
axb
([
C
11
C
12
],
£
X
T
12
X
T
22
/
T
,
D
T
12
,
E
11
);
end
X
11
=
rtrgsyl
(
A
11
,
B
11
,
C
11
,
D
11
,
E
11
,
uplo
,
blks
);
X
=
[
X
11
,
X
12
;
X
21
,
X
22
];
end
case
2
% Code for
uplo
=
2.
case
3
% Code for
uplo
=
3.
case
4
% Code for
uplo
=
4.
end
Algorithm 1.
Recursive blocked algorithm for solving the triangular generalized Sylvester
equation.