114 REAL function
cqrt14( trans, m, n, nrhs, a, lda, x,
123 INTEGER lda, ldx, lwork, m, n, nrhs
126 COMPLEX a( lda, * ), work( lwork ), x( ldx, * )
133 parameter( zero = 0.0e0, one = 1.0e0 )
137 INTEGER i, info, j, ldwork
152 INTRINSIC abs, conjg, max, min, real
157 IF(
lsame( trans,
'N' ) )
THEN
160 IF( lwork.LT.( m+nrhs )*( n+2 ) )
THEN
161 CALL xerbla(
'CQRT14', 10 )
163 ELSE IF( n.LE.0 .OR. nrhs.LE.0 )
THEN
166 ELSE IF(
lsame( trans,
'C' ) )
THEN
169 IF( lwork.LT.( n+nrhs )*( m+2 ) )
THEN
170 CALL xerbla(
'CQRT14', 10 )
172 ELSE IF( m.LE.0 .OR. nrhs.LE.0 )
THEN
176 CALL xerbla(
'CQRT14', 1 )
182 CALL clacpy(
'All', m, n, a, lda, work, ldwork )
183 anrm =
clange(
'M', m, n, work, ldwork, rwork )
185 $
CALL clascl(
'G', 0, 0, anrm, one, m, n, work, ldwork, info )
193 CALL clacpy(
'All', m, nrhs, x, ldx, work( n*ldwork+1 ),
195 xnrm =
clange(
'M', m, nrhs, work( n*ldwork+1 ), ldwork,
198 $
CALL clascl(
'G', 0, 0, xnrm, one, m, nrhs,
199 $ work( n*ldwork+1 ), ldwork, info )
203 CALL cgeqr2( m, n+nrhs, work, ldwork,
204 $ work( ldwork*( n+nrhs )+1 ),
205 $ work( ldwork*( n+nrhs )+min( m, n+nrhs )+1 ),
212 DO 20 j = n + 1, n + nrhs
213 DO 10 i = n + 1, min( m, j )
214 err = max( err, abs( work( i+( j-1 )*m ) ) )
224 work( m+j+( i-1 )*ldwork ) = conjg( x( i, j ) )
228 xnrm =
clange(
'M', nrhs, n, work( m+1 ), ldwork, rwork )
230 $
CALL clascl(
'G', 0, 0, xnrm, one, nrhs, n, work( m+1 ),
235 CALL cgelq2( ldwork, n, work, ldwork, work( ldwork*n+1 ),
236 $ work( ldwork*( n+1 )+1 ), info )
244 err = max( err, abs( work( i+( j-1 )*ldwork ) ) )
250 cqrt14 = err / ( real( max( m, n, nrhs ) )*
slamch(
'Epsilon' ) )
subroutine xerbla(srname, info)
real function cqrt14(trans, m, n, nrhs, a, lda, x, ldx, work, lwork)
CQRT14
subroutine cgelq2(m, n, a, lda, tau, work, info)
CGELQ2 computes the LQ factorization of a general rectangular matrix using an unblocked algorithm.
subroutine cgeqr2(m, n, a, lda, tau, work, info)
CGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm.
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
real function slamch(cmach)
SLAMCH
real function clange(norm, m, n, a, lda, work)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
subroutine clascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
CLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
logical function lsame(ca, cb)
LSAME