424
•
I. Jonsson and B. K˚agstr¨om
Algorithm 2: rtrglydt
Input:
(
A
,
E
) (
N
×
N
) in upper generalized Schur form.
C
(
N
×
N
) dense matrix.
blks
, block size
that specifies when to switch to a standard algorithm for solving smallsized triangular
generalized Lyapunov equations.
Output:
X
(
N
×
N
), the solution of
AXA
T

EXE
T
=
C
.
X
is allowed to overwrite
C
, and is
symmetric if
C
=
C
T
on entry.
function
[
X
]
=
rtrglydt
(
A
,
E
,
C
,
blks
)
if
1
≤
N
≤
blks
then
X
=
trglydt
(
A
,
E
,
C
);
elseif
C is symmetric
% Split (
A
,
E
), and
C
(all by rows and columns)
X
22
=
rtrglydt
(
A
22
,
E
22
,
C
22
,
blks
);
C
12
=
axb
(

A
12
,
X
22
,
A
T
22
,
C
12
);
C
12
=
axb
(
E
12
,
X
22
,
E
T
22
,
C
12
);
X
12
=
rtrgsyl
(
A
11
,
A
22
,
E
11
,
E
22
,
C
12
,
blks
);
X
21
=
X
T
12
;
C
11
=
syr2k
(
trmm
(
A
11
,
X
12
),

A
12
,
C
11
);
C
11
=
syr2k
(
trmm
(
E
11
,
X
12
),
E
12
,
C
11
);
C
11
=
axb
(

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