90 SUBROUTINE sget38( RMAX, LMAX, NINFO, KNT, NIN )
100 INTEGER LMAX( 3 ), NINFO( 3 )
108 parameter( zero = 0.0e0, one = 1.0e0, two = 2.0e0 )
110 parameter( epsin = 5.9605e-8 )
112 parameter( ldt = 20, lwork = 2*ldt*( 10+ldt ) )
114 parameter( liwork = ldt*ldt )
117 INTEGER I, INFO, ISCL, ITMP, J, KMIN, M, N, NDIM
118 REAL BIGNUM, EPS, S, SEP, SEPIN, SEPTMP, SIN,
119 $ SMLNUM, STMP, TNRM, TOL, TOLIN, V, VIMIN, VMAX,
123 LOGICAL SELECT( LDT )
124 INTEGER IPNT( LDT ), ISELEC( LDT ), IWORK( LIWORK )
125 REAL Q( LDT, LDT ), QSAV( LDT, LDT ),
126 $ QTMP( LDT, LDT ), RESULT( 2 ), T( LDT, LDT ),
127 $ TMP( LDT, LDT ), TSAV( LDT, LDT ),
128 $ TSAV1( LDT, LDT ), TTMP( LDT, LDT ), VAL( 3 ),
129 $ WI( LDT ), WITMP( LDT ), WORK( LWORK ),
130 $ WR( LDT ), WRTMP( LDT )
134 EXTERNAL slamch, slange
141 INTRINSIC max, real, sqrt
146 smlnum = slamch(
'S' ) / eps
147 bignum = one / smlnum
151 eps = max( eps, epsin )
163 val( 1 ) = sqrt( smlnum )
165 val( 3 ) = sqrt( sqrt( bignum ) )
172 READ( nin, fmt = * )n, ndim
175 READ( nin, fmt = * )( iselec( i ), i = 1, ndim )
177 READ( nin, fmt = * )( tmp( i, j ), j = 1, n )
179 READ( nin, fmt = * )sin, sepin
181 tnrm = slange(
'M', n, n, tmp, ldt, work )
187 CALL slacpy(
'F', n, n, tmp, ldt, t, ldt )
190 CALL sscal( n, vmul, t( 1, i ), 1 )
194 CALL slacpy(
'F', n, n, t, ldt, tsav, ldt )
198 CALL sgehrd( n, 1, n, t, ldt, work( 1 ), work( n+1 ), lwork-n,
202 ninfo( 1 ) = ninfo( 1 ) + 1
208 CALL slacpy(
'L', n, n, t, ldt, q, ldt )
209 CALL sorghr( n, 1, n, q, ldt, work( 1 ), work( n+1 ), lwork-n,
214 CALL shseqr(
'S',
'V', n, 1, n, t, ldt, wr, wi, q, ldt, work,
218 ninfo( 2 ) = ninfo( 2 ) + 1
226 SELECT( i ) = .false.
228 CALL scopy( n, wr, 1, wrtmp, 1 )
229 CALL scopy( n, wi, 1, witmp, 1 )
235 IF( wrtmp( j ).LT.vrmin )
THEN
241 wrtmp( kmin ) = wrtmp( i )
242 witmp( kmin ) = witmp( i )
246 ipnt( i ) = ipnt( kmin )
250 SELECT( ipnt( iselec( i ) ) ) = .true.
255 CALL slacpy(
'F', n, n, q, ldt, qsav, ldt )
256 CALL slacpy(
'F', n, n, t, ldt, tsav1, ldt )
257 CALL strsen(
'B',
'V',
SELECT, n, t, ldt, q, ldt, wrtmp, witmp,
258 $ m, s, sep, work, lwork, iwork, liwork, info )
261 ninfo( 3 ) = ninfo( 3 ) + 1
269 CALL shst01( n, 1, n, tsav, ldt, t, ldt, q, ldt, work, lwork,
271 vmax = max( result( 1 ), result( 2 ) )
272 IF( vmax.GT.rmax( 1 ) )
THEN
274 IF( ninfo( 1 ).EQ.0 )
281 v = max( two*real( n )*eps*tnrm, smlnum )
284 IF( v.GT.septmp )
THEN
289 IF( v.GT.sepin )
THEN
294 tol = max( tol, smlnum / eps )
295 tolin = max( tolin, smlnum / eps )
296 IF( eps*( sin-tolin ).GT.stmp+tol )
THEN
298 ELSE IF( sin-tolin.GT.stmp+tol )
THEN
299 vmax = ( sin-tolin ) / ( stmp+tol )
300 ELSE IF( sin+tolin.LT.eps*( stmp-tol ) )
THEN
302 ELSE IF( sin+tolin.LT.stmp-tol )
THEN
303 vmax = ( stmp-tol ) / ( sin+tolin )
307 IF( vmax.GT.rmax( 2 ) )
THEN
309 IF( ninfo( 2 ).EQ.0 )
316 IF( v.GT.septmp*stmp )
THEN
321 IF( v.GT.sepin*sin )
THEN
326 tol = max( tol, smlnum / eps )
327 tolin = max( tolin, smlnum / eps )
328 IF( eps*( sepin-tolin ).GT.septmp+tol )
THEN
330 ELSE IF( sepin-tolin.GT.septmp+tol )
THEN
331 vmax = ( sepin-tolin ) / ( septmp+tol )
332 ELSE IF( sepin+tolin.LT.eps*( septmp-tol ) )
THEN
334 ELSE IF( sepin+tolin.LT.septmp-tol )
THEN
335 vmax = ( septmp-tol ) / ( sepin+tolin )
339 IF( vmax.GT.rmax( 2 ) )
THEN
341 IF( ninfo( 2 ).EQ.0 )
348 IF( sin.LE.real( 2*n )*eps .AND. stmp.LE.real( 2*n )*eps )
THEN
350 ELSE IF( eps*sin.GT.stmp )
THEN
352 ELSE IF( sin.GT.stmp )
THEN
354 ELSE IF( sin.LT.eps*stmp )
THEN
356 ELSE IF( sin.LT.stmp )
THEN
361 IF( vmax.GT.rmax( 3 ) )
THEN
363 IF( ninfo( 3 ).EQ.0 )
370 IF( sepin.LE.v .AND. septmp.LE.v )
THEN
372 ELSE IF( eps*sepin.GT.septmp )
THEN
374 ELSE IF( sepin.GT.septmp )
THEN
375 vmax = sepin / septmp
376 ELSE IF( sepin.LT.eps*septmp )
THEN
378 ELSE IF( sepin.LT.septmp )
THEN
379 vmax = septmp / sepin
383 IF( vmax.GT.rmax( 3 ) )
THEN
385 IF( ninfo( 3 ).EQ.0 )
393 CALL slacpy(
'F', n, n, tsav1, ldt, ttmp, ldt )
394 CALL slacpy(
'F', n, n, qsav, ldt, qtmp, ldt )
397 CALL strsen(
'E',
'V',
SELECT, n, ttmp, ldt, qtmp, ldt, wrtmp,
398 $ witmp, m, stmp, septmp, work, lwork, iwork,
402 ninfo( 3 ) = ninfo( 3 ) + 1
411 IF( ttmp( i, j ).NE.t( i, j ) )
413 IF( qtmp( i, j ).NE.q( i, j ) )
421 CALL slacpy(
'F', n, n, tsav1, ldt, ttmp, ldt )
422 CALL slacpy(
'F', n, n, qsav, ldt, qtmp, ldt )
425 CALL strsen(
'V',
'V',
SELECT, n, ttmp, ldt, qtmp, ldt, wrtmp,
426 $ witmp, m, stmp, septmp, work, lwork, iwork,
430 ninfo( 3 ) = ninfo( 3 ) + 1
439 IF( ttmp( i, j ).NE.t( i, j ) )
441 IF( qtmp( i, j ).NE.q( i, j ) )
449 CALL slacpy(
'F', n, n, tsav1, ldt, ttmp, ldt )
450 CALL slacpy(
'F', n, n, qsav, ldt, qtmp, ldt )
453 CALL strsen(
'E',
'N',
SELECT, n, ttmp, ldt, qtmp, ldt, wrtmp,
454 $ witmp, m, stmp, septmp, work, lwork, iwork,
458 ninfo( 3 ) = ninfo( 3 ) + 1
467 IF( ttmp( i, j ).NE.t( i, j ) )
469 IF( qtmp( i, j ).NE.qsav( i, j ) )
477 CALL slacpy(
'F', n, n, tsav1, ldt, ttmp, ldt )
478 CALL slacpy(
'F', n, n, qsav, ldt, qtmp, ldt )
481 CALL strsen(
'V',
'N',
SELECT, n, ttmp, ldt, qtmp, ldt, wrtmp,
482 $ witmp, m, stmp, septmp, work, lwork, iwork,
486 ninfo( 3 ) = ninfo( 3 ) + 1
495 IF( ttmp( i, j ).NE.t( i, j ) )
497 IF( qtmp( i, j ).NE.qsav( i, j ) )
501 IF( vmax.GT.rmax( 1 ) )
THEN
503 IF( ninfo( 1 ).EQ.0 )