147 SUBROUTINE cqrt15( SCALE, RKSEL, M, N, NRHS, A, LDA, B, LDB, S,
148 $ RANK, NORMA, NORMB, ISEED, WORK, LWORK )
155 INTEGER LDA, LDB, LWORK, M, N, NRHS, RANK, RKSEL, SCALE
161 COMPLEX A( LDA, * ), B( LDB, * ), WORK( LWORK )
167 REAL ZERO, ONE, TWO, SVMIN
168 parameter( zero = 0.0e+0, one = 1.0e+0, two = 2.0e+0,
171 parameter( czero = ( 0.0e+0, 0.0e+0 ),
172 $ cone = ( 1.0e+0, 0.0e+0 ) )
176 REAL BIGNUM, EPS, SMLNUM, TEMP
182 REAL CLANGE, SASUM, SCNRM2, SLAMCH, SLARND
183 EXTERNAL clange, sasum, scnrm2, slamch, slarnd
195 IF( lwork.LT.
max( m+mn, mn*nrhs, 2*n+m ) )
THEN
196 CALL xerbla(
'CQRT15', 16 )
200 smlnum = slamch(
'Safe minimum' )
201 bignum = one / smlnum
202 CALL slabad( smlnum, bignum )
203 eps = slamch(
'Epsilon' )
204 smlnum = ( smlnum / eps ) / eps
205 bignum = one / smlnum
209 IF( rksel.EQ.1 )
THEN
211 ELSE IF( rksel.EQ.2 )
THEN
213 DO 10 j = rank + 1, mn
217 CALL xerbla(
'CQRT15', 2 )
227 temp = slarnd( 1, iseed )
228 IF( temp.GT.svmin )
THEN
234 CALL slaord(
'Decreasing', rank, s, 1 )
238 CALL clarnv( 2, iseed, m, work )
239 CALL csscal( m, one / scnrm2( m, work, 1 ), work, 1 )
240 CALL claset(
'Full', m, rank, czero, cone, a, lda )
241 CALL clarf(
'Left', m, rank, work, 1,
cmplx( two ), a, lda,
248 CALL clarnv( 2, iseed, rank*nrhs, work )
249 CALL cgemm(
'No transpose',
'No transpose', m, nrhs, rank,
250 $ cone, a, lda, work, rank, czero, b, ldb )
257 CALL csscal( m, s( j ), a( 1, j ), 1 )
260 $
CALL claset(
'Full', m, n-rank, czero, czero,
261 $ a( 1, rank+1 ), lda )
262 CALL claror(
'Right',
'No initialization', m, n, a, lda, iseed,
274 CALL claset(
'Full', m, n, czero, czero, a, lda )
275 CALL claset(
'Full', m, nrhs, czero, czero, b, ldb )
281 IF( scale.NE.1 )
THEN
282 norma = clange(
'Max', m, n, a, lda, dummy )
283 IF( norma.NE.zero )
THEN
284 IF( scale.EQ.2 )
THEN
288 CALL clascl(
'General', 0, 0, norma, bignum, m, n, a,
290 CALL slascl(
'General', 0, 0, norma, bignum, mn, 1, s,
292 CALL clascl(
'General', 0, 0, norma, bignum, m, nrhs, b,
294 ELSE IF( scale.EQ.3 )
THEN
298 CALL clascl(
'General', 0, 0, norma, smlnum, m, n, a,
300 CALL slascl(
'General', 0, 0, norma, smlnum, mn, 1, s,
302 CALL clascl(
'General', 0, 0, norma, smlnum, m, nrhs, b,
305 CALL xerbla(
'CQRT15', 1 )
311 norma = sasum( mn, s, 1 )
312 normb = clange(
'One-norm', m, nrhs, b, ldb, dummy )