cgelsy.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 410 行 · 第 1/3 页
HTML
410 行
</span><span class="comment">*</span><span class="comment"> this value as the first entry of the WORK array, and no error
</span><span class="comment">*</span><span class="comment"> message related to LWORK is issued by <a name="XERBLA.120"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> RWORK (workspace) REAL array, dimension (2*N)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> INFO (output) INTEGER
</span><span class="comment">*</span><span class="comment"> = 0: successful exit
</span><span class="comment">*</span><span class="comment"> < 0: if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Further Details
</span><span class="comment">*</span><span class="comment"> ===============
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Based on contributions by
</span><span class="comment">*</span><span class="comment"> A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
</span><span class="comment">*</span><span class="comment"> E. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
</span><span class="comment">*</span><span class="comment"> G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> INTEGER IMAX, IMIN
PARAMETER ( IMAX = 1, IMIN = 2 )
REAL ZERO, ONE
PARAMETER ( ZERO = 0.0E+0, ONE = 1.0E+0 )
COMPLEX CZERO, CONE
PARAMETER ( CZERO = ( 0.0E+0, 0.0E+0 ),
$ CONE = ( 1.0E+0, 0.0E+0 ) )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL LQUERY
INTEGER I, IASCL, IBSCL, ISMAX, ISMIN, J, LWKOPT, MN,
$ NB, NB1, NB2, NB3, NB4
REAL ANRM, BIGNUM, BNRM, SMAX, SMAXPR, SMIN, SMINPR,
$ SMLNUM, WSIZE
COMPLEX C1, C2, S1, S2
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL CCOPY, <a name="CGEQP3.156"></a><a href="cgeqp3.f.html#CGEQP3.1">CGEQP3</a>, <a name="CLAIC1.156"></a><a href="claic1.f.html#CLAIC1.1">CLAIC1</a>, <a name="CLASCL.156"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>, <a name="CLASET.156"></a><a href="claset.f.html#CLASET.1">CLASET</a>, CTRSM,
$ <a name="CTZRZF.157"></a><a href="ctzrzf.f.html#CTZRZF.1">CTZRZF</a>, <a name="CUNMQR.157"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>, <a name="CUNMRZ.157"></a><a href="cunmrz.f.html#CUNMRZ.1">CUNMRZ</a>, <a name="SLABAD.157"></a><a href="slabad.f.html#SLABAD.1">SLABAD</a>, <a name="XERBLA.157"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> INTEGER <a name="ILAENV.160"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
REAL <a name="CLANGE.161"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>, <a name="SLAMCH.161"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>
EXTERNAL <a name="CLANGE.162"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>, <a name="ILAENV.162"></a><a href="hfy-index.html#ILAENV">ILAENV</a>, <a name="SLAMCH.162"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC ABS, MAX, MIN, REAL, CMPLX
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span> MN = MIN( M, N )
ISMIN = MN + 1
ISMAX = 2*MN + 1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Test the input arguments.
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
NB1 = <a name="ILAENV.176"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGEQRF.176"></a><a href="cgeqrf.f.html#CGEQRF.1">CGEQRF</a>'</span>, <span class="string">' '</span>, M, N, -1, -1 )
NB2 = <a name="ILAENV.177"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CGERQF.177"></a><a href="cgerqf.f.html#CGERQF.1">CGERQF</a>'</span>, <span class="string">' '</span>, M, N, -1, -1 )
NB3 = <a name="ILAENV.178"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNMQR.178"></a><a href="cunmqr.f.html#CUNMQR.1">CUNMQR</a>'</span>, <span class="string">' '</span>, M, N, NRHS, -1 )
NB4 = <a name="ILAENV.179"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="CUNMRQ.179"></a><a href="cunmrq.f.html#CUNMRQ.1">CUNMRQ</a>'</span>, <span class="string">' '</span>, M, N, NRHS, -1 )
NB = MAX( NB1, NB2, NB3, NB4 )
LWKOPT = MAX( 1, MN+2*N+NB*(N+1), 2*MN+NB*NRHS )
WORK( 1 ) = CMPLX( LWKOPT )
LQUERY = ( LWORK.EQ.-1 )
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( NRHS.LT.0 ) THEN
INFO = -3
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -5
ELSE IF( LDB.LT.MAX( 1, M, N ) ) THEN
INFO = -7
ELSE IF( LWORK.LT.( MN+MAX( 2*MN, N+1, MN+NRHS ) ) .AND.
$ .NOT.LQUERY ) THEN
INFO = -12
END IF
<span class="comment">*</span><span class="comment">
</span> IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.200"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CGELSY.200"></a><a href="cgelsy.f.html#CGELSY.1">CGELSY</a>'</span>, -INFO )
RETURN
ELSE IF( LQUERY ) THEN
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( MIN( M, N, NRHS ).EQ.0 ) THEN
RANK = 0
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Get machine parameters
</span><span class="comment">*</span><span class="comment">
</span> SMLNUM = <a name="SLAMCH.215"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'S'</span> ) / <a name="SLAMCH.215"></a><a href="slamch.f.html#SLAMCH.1">SLAMCH</a>( <span class="string">'P'</span> )
BIGNUM = ONE / SMLNUM
CALL <a name="SLABAD.217"></a><a href="slabad.f.html#SLABAD.1">SLABAD</a>( SMLNUM, BIGNUM )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale A, B if max entries outside range [SMLNUM,BIGNUM]
</span><span class="comment">*</span><span class="comment">
</span> ANRM = <a name="CLANGE.221"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>( <span class="string">'M'</span>, M, N, A, LDA, RWORK )
IASCL = 0
IF( ANRM.GT.ZERO .AND. ANRM.LT.SMLNUM ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale matrix norm up to SMLNUM
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CLASCL.227"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRM, SMLNUM, M, N, A, LDA, INFO )
IASCL = 1
ELSE IF( ANRM.GT.BIGNUM ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale matrix norm down to BIGNUM
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CLASCL.233"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'G'</span>, 0, 0, ANRM, BIGNUM, M, N, A, LDA, INFO )
IASCL = 2
ELSE IF( ANRM.EQ.ZERO ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Matrix all zero. Return zero solution.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CLASET.239"></a><a href="claset.f.html#CLASET.1">CLASET</a>( <span class="string">'F'</span>, MAX( M, N ), NRHS, CZERO, CZERO, B, LDB )
RANK = 0
GO TO 70
END IF
<span class="comment">*</span><span class="comment">
</span> BNRM = <a name="CLANGE.244"></a><a href="clange.f.html#CLANGE.1">CLANGE</a>( <span class="string">'M'</span>, M, NRHS, B, LDB, RWORK )
IBSCL = 0
IF( BNRM.GT.ZERO .AND. BNRM.LT.SMLNUM ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale matrix norm up to SMLNUM
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="CLASCL.250"></a><a href="clascl.f.html#CLASCL.1">CLASCL</a>( <span class="string">'G'</span>, 0, 0, BNRM, SMLNUM, M, NRHS, B, LDB, INFO )
IBSCL = 1
ELSE IF( BNRM.GT.BIGNUM ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Scale matrix norm down to BIGNUM
</span><span class="comment">*</span><span class="comment">
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?