95 DOUBLE PRECISION FUNCTION zqrt12( M, N, A, LDA, S, WORK, LWORK,
103 INTEGER lda, lwork, m, n
106 DOUBLE PRECISION rwork( * ), s( * )
107 COMPLEX*16 a( lda, * ), work( lwork )
113 DOUBLE PRECISION zero, one
114 parameter( zero = 0.0d0, one = 1.0d0 )
117 INTEGER i, info, iscl, j, mn
118 DOUBLE PRECISION anrm, bignum, nrmsvl, smlnum
121 DOUBLE PRECISION dummy( 1 )
132 INTRINSIC dble, dcmplx, max, min
140 IF( lwork.LT.m*n+2*min( m, n )+max( m, n ) )
THEN
141 CALL xerbla(
'ZQRT12', 7 )
151 nrmsvl =
dnrm2( mn, s, 1 )
155 CALL zlaset(
'Full', m, n, dcmplx( zero ), dcmplx( zero ), work,
158 DO i = 1, min( j, m )
159 work( ( j-1 )*m+i ) = a( i, j )
166 bignum = one / smlnum
170 anrm =
zlange(
'M', m, n, work, m, dummy )
172 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
176 CALL zlascl(
'G', 0, 0, anrm, smlnum, m, n, work, m, info )
178 ELSE IF( anrm.GT.bignum )
THEN
182 CALL zlascl(
'G', 0, 0, anrm, bignum, m, n, work, m, info )
186 IF( anrm.NE.zero )
THEN
190 CALL zgebd2( m, n, work, m, rwork( 1 ), rwork( mn+1 ),
191 $ work( m*n+1 ), work( m*n+mn+1 ),
192 $ work( m*n+2*mn+1 ), info )
193 CALL dbdsqr(
'Upper', mn, 0, 0, 0, rwork( 1 ), rwork( mn+1 ),
194 $ dummy, mn, dummy, 1, dummy, mn, rwork( 2*mn+1 ),
198 IF( anrm.GT.bignum )
THEN
199 CALL dlascl(
'G', 0, 0, bignum, anrm, mn, 1, rwork( 1 ),
202 IF( anrm.LT.smlnum )
THEN
203 CALL dlascl(
'G', 0, 0, smlnum, anrm, mn, 1, rwork( 1 ),
217 CALL daxpy( mn, -one, s, 1, rwork( 1 ), 1 )
219 $ (
dlamch(
'Epsilon' )*dble( max( m, n ) ) )
subroutine dbdsqr(uplo, n, ncvt, nru, ncc, d, e, vt, ldvt, u, ldu, c, ldc, work, info)
DBDSQR
subroutine zgebd2(m, n, a, lda, d, e, tauq, taup, work, info)
ZGEBD2 reduces a general matrix to bidiagonal form using an unblocked algorithm.
double precision function zlange(norm, m, n, a, lda, work)
ZLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
subroutine zlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
ZLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine dlascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
DLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
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.