LAPACK  3.8.0
LAPACK: Linear Algebra PACKage
zgerqs.f
Go to the documentation of this file.
1 *> \brief \b ZGERQS
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE ZGERQS( M, N, NRHS, A, LDA, TAU, B, LDB, WORK, LWORK,
12 * INFO )
13 *
14 * .. Scalar Arguments ..
15 * INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS
16 * ..
17 * .. Array Arguments ..
18 * COMPLEX*16 A( LDA, * ), B( LDB, * ), TAU( * ),
19 * $ WORK( LWORK )
20 * ..
21 *
22 *
23 *> \par Purpose:
24 * =============
25 *>
26 *> \verbatim
27 *>
28 *> Compute a minimum-norm solution
29 *> min || A*X - B ||
30 *> using the RQ factorization
31 *> A = R*Q
32 *> computed by ZGERQF.
33 *> \endverbatim
34 *
35 * Arguments:
36 * ==========
37 *
38 *> \param[in] M
39 *> \verbatim
40 *> M is INTEGER
41 *> The number of rows of the matrix A. M >= 0.
42 *> \endverbatim
43 *>
44 *> \param[in] N
45 *> \verbatim
46 *> N is INTEGER
47 *> The number of columns of the matrix A. N >= M >= 0.
48 *> \endverbatim
49 *>
50 *> \param[in] NRHS
51 *> \verbatim
52 *> NRHS is INTEGER
53 *> The number of columns of B. NRHS >= 0.
54 *> \endverbatim
55 *>
56 *> \param[in] A
57 *> \verbatim
58 *> A is COMPLEX*16 array, dimension (LDA,N)
59 *> Details of the RQ factorization of the original matrix A as
60 *> returned by ZGERQF.
61 *> \endverbatim
62 *>
63 *> \param[in] LDA
64 *> \verbatim
65 *> LDA is INTEGER
66 *> The leading dimension of the array A. LDA >= M.
67 *> \endverbatim
68 *>
69 *> \param[in] TAU
70 *> \verbatim
71 *> TAU is COMPLEX*16 array, dimension (M)
72 *> Details of the orthogonal matrix Q.
73 *> \endverbatim
74 *>
75 *> \param[in,out] B
76 *> \verbatim
77 *> B is COMPLEX*16 array, dimension (LDB,NRHS)
78 *> On entry, the right hand side vectors for the linear system.
79 *> On exit, the solution vectors X. Each solution vector
80 *> is contained in rows 1:N of a column of B.
81 *> \endverbatim
82 *>
83 *> \param[in] LDB
84 *> \verbatim
85 *> LDB is INTEGER
86 *> The leading dimension of the array B. LDB >= max(1,N).
87 *> \endverbatim
88 *>
89 *> \param[out] WORK
90 *> \verbatim
91 *> WORK is COMPLEX*16 array, dimension (LWORK)
92 *> \endverbatim
93 *>
94 *> \param[in] LWORK
95 *> \verbatim
96 *> LWORK is INTEGER
97 *> The length of the array WORK. LWORK must be at least NRHS,
98 *> and should be at least NRHS*NB, where NB is the block size
99 *> for this environment.
100 *> \endverbatim
101 *>
102 *> \param[out] INFO
103 *> \verbatim
104 *> INFO is INTEGER
105 *> = 0: successful exit
106 *> < 0: if INFO = -i, the i-th argument had an illegal value
107 *> \endverbatim
108 *
109 * Authors:
110 * ========
111 *
112 *> \author Univ. of Tennessee
113 *> \author Univ. of California Berkeley
114 *> \author Univ. of Colorado Denver
115 *> \author NAG Ltd.
116 *
117 *> \date December 2016
118 *
119 *> \ingroup complex16_lin
120 *
121 * =====================================================================
122  SUBROUTINE zgerqs( M, N, NRHS, A, LDA, TAU, B, LDB, WORK, LWORK,
123  $ INFO )
124 *
125 * -- LAPACK test routine (version 3.7.0) --
126 * -- LAPACK is a software package provided by Univ. of Tennessee, --
127 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
128 * December 2016
129 *
130 * .. Scalar Arguments ..
131  INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS
132 * ..
133 * .. Array Arguments ..
134  COMPLEX*16 A( lda, * ), B( ldb, * ), TAU( * ),
135  $ work( lwork )
136 * ..
137 *
138 * =====================================================================
139 *
140 * .. Parameters ..
141  COMPLEX*16 CZERO, CONE
142  parameter( czero = ( 0.0d+0, 0.0d+0 ),
143  $ cone = ( 1.0d+0, 0.0d+0 ) )
144 * ..
145 * .. External Subroutines ..
146  EXTERNAL xerbla, zlaset, ztrsm, zunmrq
147 * ..
148 * .. Intrinsic Functions ..
149  INTRINSIC max
150 * ..
151 * .. Executable Statements ..
152 *
153 * Test the input parameters.
154 *
155  info = 0
156  IF( m.LT.0 ) THEN
157  info = -1
158  ELSE IF( n.LT.0 .OR. m.GT.n ) THEN
159  info = -2
160  ELSE IF( nrhs.LT.0 ) THEN
161  info = -3
162  ELSE IF( lda.LT.max( 1, m ) ) THEN
163  info = -5
164  ELSE IF( ldb.LT.max( 1, n ) ) THEN
165  info = -8
166  ELSE IF( lwork.LT.1 .OR. lwork.LT.nrhs .AND. m.GT.0 .AND. n.GT.0 )
167  $ THEN
168  info = -10
169  END IF
170  IF( info.NE.0 ) THEN
171  CALL xerbla( 'ZGERQS', -info )
172  RETURN
173  END IF
174 *
175 * Quick return if possible
176 *
177  IF( n.EQ.0 .OR. nrhs.EQ.0 .OR. m.EQ.0 )
178  $ RETURN
179 *
180 * Solve R*X = B(n-m+1:n,:)
181 *
182  CALL ztrsm( 'Left', 'Upper', 'No transpose', 'Non-unit', m, nrhs,
183  $ cone, a( 1, n-m+1 ), lda, b( n-m+1, 1 ), ldb )
184 *
185 * Set B(1:n-m,:) to zero
186 *
187  CALL zlaset( 'Full', n-m, nrhs, czero, czero, b, ldb )
188 *
189 * B := Q' * B
190 *
191  CALL zunmrq( 'Left', 'Conjugate transpose', n, nrhs, m, a, lda,
192  $ tau, b, ldb, work, lwork, info )
193 *
194  RETURN
195 *
196 * End of ZGERQS
197 *
198  END
subroutine zunmrq(SIDE, TRANS, M, N, K, A, LDA, TAU, C, LDC, WORK, LWORK, INFO)
ZUNMRQ
Definition: zunmrq.f:169
subroutine zgerqs(M, N, NRHS, A, LDA, TAU, B, LDB, WORK, LWORK, INFO)
ZGERQS
Definition: zgerqs.f:124
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine zlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: zlaset.f:108
subroutine ztrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
ZTRSM
Definition: ztrsm.f:182