LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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.
Date
December 2016

Definition at line 123 of file zgelqs.f.

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