slasq2.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 473 行 · 第 1/2 页
HTML
473 行
30 CONTINUE
<span class="comment">*</span><span class="comment">
</span> I0 = 1
N0 = N
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Reverse the qd-array, if warranted.
</span><span class="comment">*</span><span class="comment">
</span> IF( CBIAS*Z( 4*I0-3 ).LT.Z( 4*N0-3 ) ) THEN
IPN4 = 4*( I0+N0 )
DO 40 I4 = 4*I0, 2*( I0+N0-1 ), 4
TEMP = Z( I4-3 )
Z( I4-3 ) = Z( IPN4-I4-3 )
Z( IPN4-I4-3 ) = TEMP
TEMP = Z( I4-1 )
Z( I4-1 ) = Z( IPN4-I4-5 )
Z( IPN4-I4-5 ) = TEMP
40 CONTINUE
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Initial split checking via dqd and Li's test.
</span><span class="comment">*</span><span class="comment">
</span> PP = 0
<span class="comment">*</span><span class="comment">
</span> DO 80 K = 1, 2
<span class="comment">*</span><span class="comment">
</span> D = Z( 4*N0+PP-3 )
DO 50 I4 = 4*( N0-1 ) + PP, 4*I0 + PP, -4
IF( Z( I4-1 ).LE.TOL2*D ) THEN
Z( I4-1 ) = -ZERO
D = Z( I4-3 )
ELSE
D = Z( I4-3 )*( D / ( D+Z( I4-1 ) ) )
END IF
50 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> dqd maps Z to ZZ plus Li's test.
</span><span class="comment">*</span><span class="comment">
</span> EMIN = Z( 4*I0+PP+1 )
D = Z( 4*I0+PP-3 )
DO 60 I4 = 4*I0 + PP, 4*( N0-1 ) + PP, 4
Z( I4-2*PP-2 ) = D + Z( I4-1 )
IF( Z( I4-1 ).LE.TOL2*D ) THEN
Z( I4-1 ) = -ZERO
Z( I4-2*PP-2 ) = D
Z( I4-2*PP ) = ZERO
D = Z( I4+1 )
ELSE IF( SAFMIN*Z( I4+1 ).LT.Z( I4-2*PP-2 ) .AND.
$ SAFMIN*Z( I4-2*PP-2 ).LT.Z( I4+1 ) ) THEN
TEMP = Z( I4+1 ) / Z( I4-2*PP-2 )
Z( I4-2*PP ) = Z( I4-1 )*TEMP
D = D*TEMP
ELSE
Z( I4-2*PP ) = Z( I4+1 )*( Z( I4-1 ) / Z( I4-2*PP-2 ) )
D = Z( I4+1 )*( D / Z( I4-2*PP-2 ) )
END IF
EMIN = MIN( EMIN, Z( I4-2*PP ) )
60 CONTINUE
Z( 4*N0-PP-2 ) = D
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Now find qmax.
</span><span class="comment">*</span><span class="comment">
</span> QMAX = Z( 4*I0-PP-2 )
DO 70 I4 = 4*I0 - PP + 2, 4*N0 - PP - 2, 4
QMAX = MAX( QMAX, Z( I4 ) )
70 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Prepare for the next iteration on K.
</span><span class="comment">*</span><span class="comment">
</span> PP = 1 - PP
80 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Initialise variables to pass to <a name="SLAZQ3.290"></a><a href="slazq3.f.html#SLAZQ3.1">SLAZQ3</a>
</span><span class="comment">*</span><span class="comment">
</span> TTYPE = 0
DMIN1 = ZERO
DMIN2 = ZERO
DN = ZERO
DN1 = ZERO
DN2 = ZERO
TAU = ZERO
<span class="comment">*</span><span class="comment">
</span> ITER = 2
NFAIL = 0
NDIV = 2*( N0-I0 )
<span class="comment">*</span><span class="comment">
</span> DO 140 IWHILA = 1, N + 1
IF( N0.LT.1 )
$ GO TO 150
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> While array unfinished do
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> E(N0) holds the value of SIGMA when submatrix in I0:N0
</span><span class="comment">*</span><span class="comment"> splits from the rest of the array, but is negated.
</span><span class="comment">*</span><span class="comment">
</span> DESIG = ZERO
IF( N0.EQ.N ) THEN
SIGMA = ZERO
ELSE
SIGMA = -Z( 4*N0-1 )
END IF
IF( SIGMA.LT.ZERO ) THEN
INFO = 1
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find last unreduced submatrix's top index I0, find QMAX and
</span><span class="comment">*</span><span class="comment"> EMIN. Find Gershgorin-type bound if Q's much greater than E's.
</span><span class="comment">*</span><span class="comment">
</span> EMAX = ZERO
IF( N0.GT.I0 ) THEN
EMIN = ABS( Z( 4*N0-5 ) )
ELSE
EMIN = ZERO
END IF
QMIN = Z( 4*N0-3 )
QMAX = QMIN
DO 90 I4 = 4*N0, 8, -4
IF( Z( I4-5 ).LE.ZERO )
$ GO TO 100
IF( QMIN.GE.FOUR*EMAX ) THEN
QMIN = MIN( QMIN, Z( I4-3 ) )
EMAX = MAX( EMAX, Z( I4-5 ) )
END IF
QMAX = MAX( QMAX, Z( I4-7 )+Z( I4-5 ) )
EMIN = MIN( EMIN, Z( I4-5 ) )
90 CONTINUE
I4 = 4
<span class="comment">*</span><span class="comment">
</span> 100 CONTINUE
I0 = I4 / 4
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Store EMIN for passing to <a name="SLAZQ3.350"></a><a href="slazq3.f.html#SLAZQ3.1">SLAZQ3</a>.
</span><span class="comment">*</span><span class="comment">
</span> Z( 4*N0-1 ) = EMIN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Put -(initial shift) into DMIN.
</span><span class="comment">*</span><span class="comment">
</span> DMIN = -MAX( ZERO, QMIN-TWO*SQRT( QMIN )*SQRT( EMAX ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Now I0:N0 is unreduced. PP = 0 for ping, PP = 1 for pong.
</span><span class="comment">*</span><span class="comment">
</span> PP = 0
<span class="comment">*</span><span class="comment">
</span> NBIG = 30*( N0-I0+1 )
DO 120 IWHILB = 1, NBIG
IF( I0.GT.N0 )
$ GO TO 130
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> While submatrix unfinished take a good dqds step.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="SLAZQ3.369"></a><a href="slazq3.f.html#SLAZQ3.1">SLAZQ3</a>( I0, N0, Z, PP, DMIN, SIGMA, DESIG, QMAX, NFAIL,
$ ITER, NDIV, IEEE, TTYPE, DMIN1, DMIN2, DN, DN1,
$ DN2, TAU )
<span class="comment">*</span><span class="comment">
</span> PP = 1 - PP
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> When EMIN is very small check for splits.
</span><span class="comment">*</span><span class="comment">
</span> IF( PP.EQ.0 .AND. N0-I0.GE.3 ) THEN
IF( Z( 4*N0 ).LE.TOL2*QMAX .OR.
$ Z( 4*N0-1 ).LE.TOL2*SIGMA ) THEN
SPLT = I0 - 1
QMAX = Z( 4*I0-3 )
EMIN = Z( 4*I0-1 )
OLDEMN = Z( 4*I0 )
DO 110 I4 = 4*I0, 4*( N0-3 ), 4
IF( Z( I4 ).LE.TOL2*Z( I4-3 ) .OR.
$ Z( I4-1 ).LE.TOL2*SIGMA ) THEN
Z( I4-1 ) = -SIGMA
SPLT = I4 / 4
QMAX = ZERO
EMIN = Z( I4+3 )
OLDEMN = Z( I4+4 )
ELSE
QMAX = MAX( QMAX, Z( I4+1 ) )
EMIN = MIN( EMIN, Z( I4-1 ) )
OLDEMN = MIN( OLDEMN, Z( I4 ) )
END IF
110 CONTINUE
Z( 4*N0-1 ) = EMIN
Z( 4*N0 ) = OLDEMN
I0 = SPLT + 1
END IF
END IF
<span class="comment">*</span><span class="comment">
</span> 120 CONTINUE
<span class="comment">*</span><span class="comment">
</span> INFO = 2
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> end IWHILB
</span><span class="comment">*</span><span class="comment">
</span> 130 CONTINUE
<span class="comment">*</span><span class="comment">
</span> 140 CONTINUE
<span class="comment">*</span><span class="comment">
</span> INFO = 3
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> end IWHILA
</span><span class="comment">*</span><span class="comment">
</span> 150 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Move q's to the front.
</span><span class="comment">*</span><span class="comment">
</span> DO 160 K = 2, N
Z( K ) = Z( 4*K-3 )
160 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Sort and compute sum of eigenvalues.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="SLASRT.430"></a><a href="slasrt.f.html#SLASRT.1">SLASRT</a>( <span class="string">'D'</span>, N, Z, IINFO )
<span class="comment">*</span><span class="comment">
</span> E = ZERO
DO 170 K = N, 1, -1
E = E + Z( K )
170 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Store trace, sum(eigenvalues) and information on performance.
</span><span class="comment">*</span><span class="comment">
</span> Z( 2*N+1 ) = TRACE
Z( 2*N+2 ) = E
Z( 2*N+3 ) = REAL( ITER )
Z( 2*N+4 ) = REAL( NDIV ) / REAL( N**2 )
Z( 2*N+5 ) = HUNDRD*NFAIL / REAL( ITER )
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="SLASQ2.446"></a><a href="slasq2.f.html#SLASQ2.1">SLASQ2</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?