95 REAL function
cqrt12( m, n, a, lda, s, work, lwork,
103 INTEGER lda, lwork, m, n
106 REAL rwork( * ), s( * )
107 COMPLEX a( lda, * ), work( lwork )
114 parameter( zero = 0.0e0, one = 1.0e0 )
117 INTEGER i, info, iscl, j, mn
118 REAL anrm, bignum, nrmsvl, smlnum
132 INTRINSIC cmplx, max, min, real
140 IF( lwork.LT.m*n+2*min( m, n )+max( m, n ) )
THEN
141 CALL xerbla(
'CQRT12', 7 )
151 nrmsvl =
snrm2( mn, s, 1 )
155 CALL claset(
'Full', m, n, cmplx( zero ), cmplx( zero ), work, m )
157 DO i = 1, min( j, m )
158 work( ( j-1 )*m+i ) = a( i, j )
165 bignum = one / smlnum
169 anrm =
clange(
'M', m, n, work, m, dummy )
171 IF( anrm.GT.zero .AND. anrm.LT.smlnum )
THEN
175 CALL clascl(
'G', 0, 0, anrm, smlnum, m, n, work, m, info )
177 ELSE IF( anrm.GT.bignum )
THEN
181 CALL clascl(
'G', 0, 0, anrm, bignum, m, n, work, m, info )
185 IF( anrm.NE.zero )
THEN
189 CALL cgebd2( m, n, work, m, rwork( 1 ), rwork( mn+1 ),
190 $ work( m*n+1 ), work( m*n+mn+1 ),
191 $ work( m*n+2*mn+1 ), info )
192 CALL sbdsqr(
'Upper', mn, 0, 0, 0, rwork( 1 ), rwork( mn+1 ),
193 $ dummy, mn, dummy, 1, dummy, mn, rwork( 2*mn+1 ),
197 IF( anrm.GT.bignum )
THEN
198 CALL slascl(
'G', 0, 0, bignum, anrm, mn, 1, rwork( 1 ),
201 IF( anrm.LT.smlnum )
THEN
202 CALL slascl(
'G', 0, 0, smlnum, anrm, mn, 1, rwork( 1 ),
216 CALL saxpy( mn, -one, s, 1, rwork( 1 ), 1 )
218 $ (
slamch(
'Epsilon' )*real( max( m, n ) ) )
subroutine xerbla(srname, info)
real function cqrt12(m, n, a, lda, s, work, lwork, rwork)
CQRT12
real function sasum(n, sx, incx)
SASUM
subroutine saxpy(n, sa, sx, incx, sy, incy)
SAXPY
subroutine sbdsqr(uplo, n, ncvt, nru, ncc, d, e, vt, ldvt, u, ldu, c, ldc, work, info)
SBDSQR
subroutine cgebd2(m, n, a, lda, d, e, tauq, taup, work, info)
CGEBD2 reduces a general matrix to bidiagonal form using an unblocked algorithm.
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.
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 claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
real(wp) function snrm2(n, x, incx)
SNRM2