88 DOUBLE PRECISION FUNCTION dqrt12( M, N, A, LDA, S, WORK, LWORK )
95 INTEGER lda, lwork, m, n
98 DOUBLE PRECISION a( lda, * ), s( * ), work( lwork )
104 DOUBLE PRECISION zero, one
105 parameter( zero = 0.0d0, one = 1.0d0 )
108 INTEGER i, info, iscl, j, mn
109 DOUBLE PRECISION anrm, bignum, nrmsvl, smlnum
119 INTRINSIC dble, max, min
122 DOUBLE PRECISION dummy( 1 )
130 IF( lwork.LT.max( m*n+4*min( m, n )+max( m, n ),
131 $ m*n+2*min( m, n )+4*n) )
THEN
132 CALL xerbla(
'DQRT12', 7 )
142 nrmsvl =
dnrm2( mn, s, 1 )
146 CALL dlaset(
'Full', m, n, zero, zero, work, m )
148 DO i = 1, min( j, m )
149 work( ( j-1 )*m+i ) = a( i, j )
156 bignum = one / smlnum
160 anrm =
dlange(
'M', m, n, work, m, dummy )
162 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
166 CALL dlascl(
'G', 0, 0, anrm, smlnum, m, n, work, m, info )
168 ELSE IF( anrm.GT.bignum )
THEN
172 CALL dlascl(
'G', 0, 0, anrm, bignum, m, n, work, m, info )
176 IF( anrm.NE.zero )
THEN
180 CALL dgebd2( m, n, work, m, work( m*n+1 ), work( m*n+mn+1 ),
181 $ work( m*n+2*mn+1 ), work( m*n+3*mn+1 ),
182 $ work( m*n+4*mn+1 ), info )
183 CALL dbdsqr(
'Upper', mn, 0, 0, 0, work( m*n+1 ),
184 $ work( m*n+mn+1 ), dummy, mn, dummy, 1, dummy, mn,
185 $ work( m*n+2*mn+1 ), info )
188 IF( anrm.GT.bignum )
THEN
189 CALL dlascl(
'G', 0, 0, bignum, anrm, mn, 1,
190 $ work( m*n+1 ), mn, info )
192 IF( anrm.LT.smlnum )
THEN
193 CALL dlascl(
'G', 0, 0, smlnum, anrm, mn, 1,
194 $ work( m*n+1 ), mn, info )
207 CALL daxpy( mn, -one, s, 1, work( m*n+1 ), 1 )
210 $ (
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 dgebd2(m, n, a, lda, d, e, tauq, taup, work, info)
DGEBD2 reduces a general matrix to bidiagonal form using an unblocked algorithm.
double precision function dlange(norm, m, n, a, lda, work)
DLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
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 dlaset(uplo, m, n, alpha, beta, a, lda)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.