1SGGQRF ‐ a generalized QR factorization of an N‐by‐M matrix A and
2an N‐by‐P matrix B SUBROUTINE SGGQRF( N, M, P, A, LDA,  TAUA,  B,
3LDB, TAUB, WORK, LWORK, INFO )
4    INTEGER INFO, LDA, LDB, LWORK, M, N, P
5    REAL  A( LDA, * ), B( LDB, * ), TAUA( * ), TAUB( * ), WORK( *
6) SGGQRF computes a generalized QR factorization of an N‐by‐M ma‐
7trix A and an N‐by‐P matrix B:
8
9            A = Q*R,        B = Q*T*Z,
10
11where  Q is an N‐by‐N orthogonal matrix, Z is a P‐by‐P orthogonal
12matrix, and R and T assume one of the forms:
13
14if N >= M,  R = ( R11 ) M  ,   or if N < M,  R = ( R11  R12 ) N,
15                (  0  ) N‐M                         N   M‐N
16                   M
17
18where R11 is upper triangular, and
19
20if N <= P,  T = ( 0  T12 ) N,   or if N > P,  T = ( T11 ) N‐P,
21                 P‐N  N                           ( T21 ) P
22                                                     P
23
24where T12 or T21 is upper triangular.
25
26In particular, if B is square and nonsingular, the GQR factoriza‐
27tion  of  A  and  B  implicitly  gives  the  QR  factorization of
28inv(B)*A:
29
30             inv(B)*A = Z'*(inv(T)*R)
31
32where inv(B) denotes the inverse of the matrix B, and Z'  denotes
33the transpose of the matrix Z.
34
35N        (input) INTEGER The number of rows of the matrices A and
36B. N >= 0.  M       (input) INTEGER The number of columns of  the
37matrix A.  M >= 0.  P       (input) INTEGER The number of columns
38of the matrix B.  P >= 0.  A       (input/output) REAL array, di‐
39mension (LDA,M) On entry, the N‐by‐M matrix A.  On exit, the ele‐
40ments on  and  above  the  diagonal  of  the  array  contain  the
41min(N,M)‐by‐M  upper  trapezoidal matrix R (R is upper triangular
42if N >= M); the elements below the diagonal, with the array TAUA,
43represent  the  orthogonal matrix Q as a product of min(N,M) ele‐
44mentary reflectors (see Further Details).  LDA     (input)  INTE‐
45GER  The leading dimension of the array A. LDA >= max(1,N).  TAUA
46(output) REAL array, dimension (min(N,M)) The scalar  factors  of
47the elementary reflectors which represent the orthogonal matrix Q
48(see Further Details).  B       (input/output) REAL array, dimen‐
49sion  (LDB,P) On entry, the N‐by‐P matrix B.  On exit, if N <= P,
50the upper triangle of the subarray B(1:N,P‐N+1:P) contains the N‐
51by‐N  upper  triangular  matrix  T; if N > P, the elements on and
52above the (N‐P)‐th subdiagonal contain the  N‐by‐P  upper  trape‐
53zoidal  matrix  T;  the  remaining elements, with the array TAUB,
54represent the orthogonal matrix Z as a product of elementary  re‐
55flectors  (see  Further  Details).   LDB      (input) INTEGER The
56leading dimension of the array B. LDB >= max(1,N).  TAUB    (out‐
57put)  REAL  array, dimension (min(N,P)) The scalar factors of the
58elementary reflectors which represent  the  orthogonal  matrix  Z
59(see  Further  Details).   WORK    (workspace/output) REAL array,
60dimension (MAX(1,LWORK)) On exit, if INFO =  0,  WORK(1)  returns
61the  optimal LWORK.  LWORK   (input) INTEGER The dimension of the
62array WORK. LWORK >= max(1,N,M,P).  For optimum performance LWORK
63>=  max(N,M,P)*max(NB1,NB2,NB3),  where NB1 is the optimal block‐
64size for the QR factorization of an N‐by‐M matrix, NB2 is the op‐
65timal blocksize for the RQ factorization of an N‐by‐P matrix, and
66NB3 is the optimal blocksize for a call of SORMQR.
67
68If LWORK = ‐1, then a workspace query is assumed; the routine on‐
69ly  calculates  the  optimal size of the WORK array, returns this
70value as the first entry of the WORK array, and no error  message
71related to LWORK is issued by XERBLA.  INFO    (output) INTEGER =
720:  successful exit
73< 0:  if INFO = ‐i, the i‐th argument had an illegal value.   The
74matrix Q is represented as a product of elementary reflectors
75
76   Q = H(1) H(2) . . . H(k), where k = min(n,m).
77
78Each H(i) has the form
79
80   H(i) = I ‐ taua * v * v'
81
82where taua is a real scalar, and v is a real vector with
83v(1:i‐1)  =  0  and  v(i)  =  1;  v(i+1:n)  is  stored on exit in
84A(i+1:n,i), and taua in TAUA(i).
85To form Q explicitly, use LAPACK subroutine SORGQR.
86To use Q to update another matrix, use LAPACK subroutine SORMQR.
87
88The matrix Z is represented as a product of elementary reflectors
89
90   Z = H(1) H(2) . . . H(k), where k = min(n,p).
91
92Each H(i) has the form
93
94   H(i) = I ‐ taub * v * v'
95
96where taub is a real scalar, and v is a real vector with
97v(p‐k+i+1:p) = 0 and v(p‐k+i) = 1; v(1:p‐k+i‐1) is stored on exit
98in B(n‐k+i,1:p‐k+i‐1), and taub in TAUB(i).
99To form Z explicitly, use LAPACK subroutine SORGRQ.
100To use Z to update another matrix, use LAPACK subroutine SORMRQ.
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
Impressum