88 REAL function
sqrt12( m, n, a, lda, s, work, lwork )
95 INTEGER lda, lwork, m, n
98 REAL a( lda, * ), s( * ), work( lwork )
105 parameter( zero = 0.0e0, one = 1.0e0 )
108 INTEGER i, info, iscl, j, mn
109 REAL anrm, bignum, nrmsvl, smlnum
119 INTRINSIC max, min, real
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(
'SQRT12', 7 )
142 nrmsvl =
snrm2( mn, s, 1 )
146 CALL slaset(
'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 =
slange(
'M', m, n, work, m, dummy )
162 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
166 CALL slascl(
'G', 0, 0, anrm, smlnum, m, n, work, m, info )
168 ELSE IF( anrm.GT.bignum )
THEN
172 CALL slascl(
'G', 0, 0, anrm, bignum, m, n, work, m, info )
176 IF( anrm.NE.zero )
THEN
180 CALL sgebd2( 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 sbdsqr(
'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 slascl(
'G', 0, 0, bignum, anrm, mn, 1,
190 $ work( m*n+1 ), mn, info )
192 IF( anrm.LT.smlnum )
THEN
193 CALL slascl(
'G', 0, 0, smlnum, anrm, mn, 1,
194 $ work( m*n+1 ), mn, info )
207 CALL saxpy( mn, -one, s, 1, work( m*n+1 ), 1 )
209 $ (
slamch(
'Epsilon' )*real( max( m, n ) ) )
subroutine sbdsqr(uplo, n, ncvt, nru, ncc, d, e, vt, ldvt, u, ldu, c, ldc, work, info)
SBDSQR
subroutine sgebd2(m, n, a, lda, d, e, tauq, taup, work, info)
SGEBD2 reduces a general matrix to bidiagonal form using an unblocked algorithm.
real function slange(norm, m, n, a, lda, work)
SLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
subroutine slascl(type, kl, ku, cfrom, cto, m, n, a, lda, info)
SLASCL multiplies a general rectangular matrix by a real scalar defined as cto/cfrom.
subroutine slaset(uplo, m, n, alpha, beta, a, lda)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.