LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zgelqs()

subroutine zgelqs ( integer  m,
integer  n,
integer  nrhs,
complex*16, dimension( lda, * )  a,
integer  lda,
complex*16, dimension( * )  tau,
complex*16, dimension( ldb, * )  b,
integer  ldb,
complex*16, dimension( lwork )  work,
integer  lwork,
integer  info 
)

ZGELQS

Purpose:
 Compute a minimum-norm solution
     min || A*X - B ||
 using the LQ factorization
     A = L*Q
 computed by ZGELQF.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix A.  N >= M >= 0.
[in]NRHS
          NRHS is INTEGER
          The number of columns of B.  NRHS >= 0.
[in]A
          A is COMPLEX*16 array, dimension (LDA,N)
          Details of the LQ factorization of the original matrix A as
          returned by ZGELQF.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= M.
[in]TAU
          TAU is COMPLEX*16 array, dimension (M)
          Details of the orthogonal matrix Q.
[in,out]B
          B is COMPLEX*16 array, dimension (LDB,NRHS)
          On entry, the m-by-nrhs right hand side matrix B.
          On exit, the n-by-nrhs solution matrix X.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B. LDB >= N.
[out]WORK
          WORK is COMPLEX*16 array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The length of the array WORK.  LWORK must be at least NRHS,
          and should be at least NRHS*NB, where NB is the block size
          for this environment.
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          < 0: if INFO = -i, the i-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 119 of file zgelqs.f.

121*
122* -- LAPACK test routine --
123* -- LAPACK is a software package provided by Univ. of Tennessee, --
124* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
125*
126* .. Scalar Arguments ..
127 INTEGER INFO, LDA, LDB, LWORK, M, N, NRHS
128* ..
129* .. Array Arguments ..
130 COMPLEX*16 A( LDA, * ), B( LDB, * ), TAU( * ),
131 $ WORK( LWORK )
132* ..
133*
134* =====================================================================
135*
136* .. Parameters ..
137 COMPLEX*16 CZERO, CONE
138 parameter( czero = ( 0.0d+0, 0.0d+0 ),
139 $ cone = ( 1.0d+0, 0.0d+0 ) )
140* ..
141* .. External Subroutines ..
142 EXTERNAL xerbla, zlaset, ztrsm, zunmlq
143* ..
144* .. Intrinsic Functions ..
145 INTRINSIC max
146* ..
147* .. Executable Statements ..
148*
149* Test the input parameters.
150*
151 info = 0
152 IF( m.LT.0 ) THEN
153 info = -1
154 ELSE IF( n.LT.0 .OR. m.GT.n ) THEN
155 info = -2
156 ELSE IF( nrhs.LT.0 ) THEN
157 info = -3
158 ELSE IF( lda.LT.max( 1, m ) ) THEN
159 info = -5
160 ELSE IF( ldb.LT.max( 1, n ) ) THEN
161 info = -8
162 ELSE IF( lwork.LT.1 .OR. lwork.LT.nrhs .AND. m.GT.0 .AND. n.GT.0 )
163 $ THEN
164 info = -10
165 END IF
166 IF( info.NE.0 ) THEN
167 CALL xerbla( 'ZGELQS', -info )
168 RETURN
169 END IF
170*
171* Quick return if possible
172*
173 IF( n.EQ.0 .OR. nrhs.EQ.0 .OR. m.EQ.0 )
174 $ RETURN
175*
176* Solve L*X = B(1:m,:)
177*
178 CALL ztrsm( 'Left', 'Lower', 'No transpose', 'Non-unit', m, nrhs,
179 $ cone, a, lda, b, ldb )
180*
181* Set B(m+1:n,:) to zero
182*
183 IF( m.LT.n )
184 $ CALL zlaset( 'Full', n-m, nrhs, czero, czero, b( m+1, 1 ),
185 $ ldb )
186*
187* B := Q' * B
188*
189 CALL zunmlq( 'Left', 'Conjugate transpose', n, nrhs, m, a, lda,
190 $ tau, b, ldb, work, lwork, info )
191*
192 RETURN
193*
194* End of ZGELQS
195*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
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:106
subroutine ztrsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
ZTRSM
Definition ztrsm.f:180
subroutine zunmlq(side, trans, m, n, k, a, lda, tau, c, ldc, work, lwork, info)
ZUNMLQ
Definition zunmlq.f:167
Here is the call graph for this function: