zgeequ.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 258 行 · 第 1/2 页
HTML
258 行
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.117"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZGEEQU.117"></a><a href="zgeequ.f.html#ZGEEQU.1">ZGEEQU</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span> IF( M.EQ.0 .OR. N.EQ.0 ) THEN
ROWCND = ONE
COLCND = ONE
AMAX = ZERO
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Get machine constants.
</span><span class="comment">*</span><span class="comment">
</span> SMLNUM = <a name="DLAMCH.132"></a><a href="dlamch.f.html#DLAMCH.1">DLAMCH</a>( <span class="string">'S'</span> )
BIGNUM = ONE / SMLNUM
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute row scale factors.
</span><span class="comment">*</span><span class="comment">
</span> DO 10 I = 1, M
R( I ) = ZERO
10 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find the maximum element in each row.
</span><span class="comment">*</span><span class="comment">
</span> DO 30 J = 1, N
DO 20 I = 1, M
R( I ) = MAX( R( I ), CABS1( A( I, J ) ) )
20 CONTINUE
30 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find the maximum and minimum scale factors.
</span><span class="comment">*</span><span class="comment">
</span> RCMIN = BIGNUM
RCMAX = ZERO
DO 40 I = 1, M
RCMAX = MAX( RCMAX, R( I ) )
RCMIN = MIN( RCMIN, R( I ) )
40 CONTINUE
AMAX = RCMAX
<span class="comment">*</span><span class="comment">
</span> IF( RCMIN.EQ.ZERO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find the first zero scale factor and return an error code.
</span><span class="comment">*</span><span class="comment">
</span> DO 50 I = 1, M
IF( R( I ).EQ.ZERO ) THEN
INFO = I
RETURN
END IF
50 CONTINUE
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Invert the scale factors.
</span><span class="comment">*</span><span class="comment">
</span> DO 60 I = 1, M
R( I ) = ONE / MIN( MAX( R( I ), SMLNUM ), BIGNUM )
60 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute ROWCND = min(R(I)) / max(R(I))
</span><span class="comment">*</span><span class="comment">
</span> ROWCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute column scale factors
</span><span class="comment">*</span><span class="comment">
</span> DO 70 J = 1, N
C( J ) = ZERO
70 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find the maximum element in each column,
</span><span class="comment">*</span><span class="comment"> assuming the row scaling computed above.
</span><span class="comment">*</span><span class="comment">
</span> DO 90 J = 1, N
DO 80 I = 1, M
C( J ) = MAX( C( J ), CABS1( A( I, J ) )*R( I ) )
80 CONTINUE
90 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find the maximum and minimum scale factors.
</span><span class="comment">*</span><span class="comment">
</span> RCMIN = BIGNUM
RCMAX = ZERO
DO 100 J = 1, N
RCMIN = MIN( RCMIN, C( J ) )
RCMAX = MAX( RCMAX, C( J ) )
100 CONTINUE
<span class="comment">*</span><span class="comment">
</span> IF( RCMIN.EQ.ZERO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Find the first zero scale factor and return an error code.
</span><span class="comment">*</span><span class="comment">
</span> DO 110 J = 1, N
IF( C( J ).EQ.ZERO ) THEN
INFO = M + J
RETURN
END IF
110 CONTINUE
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Invert the scale factors.
</span><span class="comment">*</span><span class="comment">
</span> DO 120 J = 1, N
C( J ) = ONE / MIN( MAX( C( J ), SMLNUM ), BIGNUM )
120 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute COLCND = min(C(J)) / max(C(J))
</span><span class="comment">*</span><span class="comment">
</span> COLCND = MAX( RCMIN, SMLNUM ) / MIN( RCMAX, BIGNUM )
END IF
<span class="comment">*</span><span class="comment">
</span> RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="ZGEEQU.231"></a><a href="zgeequ.f.html#ZGEEQU.1">ZGEEQU</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?