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

◆ cgerqs()

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

CGERQS

Purpose:
 Compute a minimum-norm solution
     min || A*X - B ||
 using the RQ factorization
     A = R*Q
 computed by CGERQF.
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 array, dimension (LDA,N)
          Details of the RQ factorization of the original matrix A as
          returned by CGERQF.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= M.
[in]TAU
          TAU is COMPLEX array, dimension (M)
          Details of the orthogonal matrix Q.
[in,out]B
          B is COMPLEX array, dimension (LDB,NRHS)
          On entry, the right hand side vectors for the linear system.
          On exit, the solution vectors X.  Each solution vector
          is contained in rows 1:N of a column of B.
[in]LDB
          LDB is INTEGER
          The leading dimension of the array B. LDB >= max(1,N).
[out]WORK
          WORK is COMPLEX 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 120 of file cgerqs.f.

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