Contents

# ?tgsja

Computes the generalized SVD of two upper triangular or trapezoidal matrices.

## Syntax

Include Files
• mkl.h
Description
The routine computes the generalized singular value decomposition (GSVD) of two real/complex upper triangular (or trapezoidal) matrices
A
and
B
. On entry, it is assumed that matrices
A
and
B
have the following forms, which may be obtained by the preprocessing subroutine ggsvp from a general
m
-by-
n
matrix
A
and
p
-by-
n
matrix
B
:   where the
k
-by-
k
matrix
A
12
and
l
-by-
l
matrix
B
13
are nonsingular upper triangular;
A
23
is
l
-by-
l
upper triangular if
m
-
k
-l
0
, otherwise
A
23
is (
m
-
k
)-by-
l
upper trapezoidal.
On exit,
U
H
*
A
*
Q
=
D
1
*(0
R
)
,
V
H
*
B
*
Q
=
D
2
*(0
R
)
,
where
U
,
V
and
Q
are orthogonal/unitary matrices,
R
is a nonsingular upper triangular matrix, and
D
1
and
D
2
are "diagonal" matrices, which are of the following structures:
If
m
-
k
-l
0
,   where
C
= diag(
alpha
[
k
],...,
alpha
[
k
+
l
-1]
)
S
= diag(
beta[
k
],...,
beta
[
k
+
l
-1]
)
C
2
+
S
2
= I
R
is stored in
a
(1:
k
+
l
,
n
-
k
-
l
+1:
n
) on exit.
If
m
-
k
-l
< 0
,   where
C
= diag(
alpha
[
k
],...,
alpha
[
m
-1]
)
,
S
= diag(
beta
[
k
],...,
beta
[
m
-1]
)
,
C
2
+
S
2
= I
On exit, is stored in
a
(1:
m
,
n
-
k
-
l
+1:
n
) and
R
33
is stored
in
b
(
m
-
k
+1:
l
,
n
+
m
-
k
-
l
+1:
n
).
The computation of the orthogonal/unitary transformation matrices
U
,
V
or
Q
is optional. These matrices may either be formed explicitly, or they
may
be postmultiplied into input matrices
U
1
,
V
1
, or
Q
1
.
Input Parameters
matrix_layout
Specifies whether matrix storage layout is row major (
LAPACK_ROW_MAJOR
) or column major (
LAPACK_COL_MAJOR
).
jobu
Must be
'U'
,
'I'
, or
'N'
.
If
jobu
=
'U'
,
u
must contain an orthogonal/unitary matrix
U
1
on entry.
If
jobu
=
'I'
,
u
is initialized to the unit matrix.
If
jobu
=
'N'
,
u
is not computed.
jobv
Must be
'V'
,
'I'
, or
'N'
.
If
jobv
=
'V'
,
v
must contain an orthogonal/unitary matrix
V
1
on entry.
If
jobv
=
'I'
,
v
is initialized to the unit matrix.
If
jobv
=
'N'
,
v
is not computed.
jobq
Must be
'Q'
,
'I'
, or
'N'
.
If
jobq
=
'Q'
,
q
must contain an orthogonal/unitary matrix
Q
1
on entry.
If
jobq
=
'I'
,
q
is initialized to the unit matrix.
If
jobq
=
'N'
,
q
is not computed.
m
The number of rows of the matrix
A
(
m
0).
p
The number of rows of the matrix
B
(
p
0).
n
The number of columns of the matrices
A
and
B
(
n
0).
k
,
l
Specify the subblocks in the input matrices
A
and
B
, whose GSVD is computed.
a
,
b
,
u
,
v
,
q
Arrays:
a
(size at least max(1,
lda
*
n
) for column major layout and max(1,
lda
*
m
) for row major layout)
contains the
m
-by-
n
matrix
A
.
b
(size at least max(1,
ldb
*
n
) for column major layout and max(1,
ldb
*
p
) for row major layout)
contains the
p
-by-
n
matrix
B
.
If
jobu
=
'U'
,
u
(size max(1,
ldu
*
m
))
must contain a matrix
U
1
(usually the orthogonal/unitary matrix returned by
?ggsvp
).
If
jobv
=
'V'
,
v
(size at least max(1,
ldv
*
p
))
must contain a matrix
V
1
(usually the orthogonal/unitary matrix returned by
?ggsvp
).
If
jobq
=
'Q'
,
q
(size at least max(1,
ldq
*
n
))
must contain a matrix
Q
1
(usually the orthogonal/unitary matrix returned by
?ggsvp
).
lda
a
; at least max(1,
m
)
for column major layout and max(1,
n
) for row major layout
.
ldb
b
; at least max(1,
p
)
for column major layout and max(1,
n
) for row major layout
.
ldu
The leading dimension of the array
u
.
ldu
max(1,
m
)
if
jobu
=
'U'
;
ldu
1
otherwise.
ldv
The leading dimension of the array
v
.
ldv
max(1,
p
)
if
jobv
=
'V'
;
ldv
1
otherwise.
ldq
The leading dimension of the array
q
.
ldq
max(1,
n
)
if
jobq
=
'Q'
;
ldq
1
otherwise.
tola
,
tolb
tola
and
tolb
are the convergence criteria for the Jacobi-Kogbetliantz iteration procedure. Generally, they are the same as used in
?ggsvp
:
tola
= max(
m
,
n
)*|
A
|*MACHEPS
,
tolb
= max(
p
,
n
)*|
B
|*MACHEPS
.
Output Parameters
a
On exit,
a
(
n
-
k
+1:
n
, 1:min(
k
+
l
,
m
)) contains the triangular matrix
R
or part of
R
.
b
On exit, if necessary,
b
(
m
-
k
+1:
l
,
n
+
m
-
k
-
l
+1:
n
)) contains a part of
R
.
alpha
,
beta
Arrays, size at least max(1,
n
). Contain the generalized singular value pairs of
A
and
B
:
alpha
(1:
k
) = 1
,
beta
(1:
k
) = 0
,
and if
m
-
k
-
l
0
,
alpha
(
k
+1:
k
+
l
) = diag(
C
)
,
beta
(
k
+1:
k
+
l
) = diag(
S
)
,
or if