LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine zgesc2 ( integer  N,
complex*16, dimension( lda, * )  A,
integer  LDA,
complex*16, dimension( * )  RHS,
integer, dimension( * )  IPIV,
integer, dimension( * )  JPIV,
double precision  SCALE 
)

ZGESC2 solves a system of linear equations using the LU factorization with complete pivoting computed by sgetc2.

Download ZGESC2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 ZGESC2 solves a system of linear equations

           A * X = scale* RHS

 with a general N-by-N matrix A using the LU factorization with
 complete pivoting computed by ZGETC2.
Parameters
[in]N
          N is INTEGER
          The number of columns of the matrix A.
[in]A
          A is COMPLEX*16 array, dimension (LDA, N)
          On entry, the  LU part of the factorization of the n-by-n
          matrix A computed by ZGETC2:  A = P * L * U * Q
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1, N).
[in,out]RHS
          RHS is COMPLEX*16 array, dimension N.
          On entry, the right hand side vector b.
          On exit, the solution vector X.
[in]IPIV
          IPIV is INTEGER array, dimension (N).
          The pivot indices; for 1 <= i <= N, row i of the
          matrix has been interchanged with row IPIV(i).
[in]JPIV
          JPIV is INTEGER array, dimension (N).
          The pivot indices; for 1 <= j <= N, column j of the
          matrix has been interchanged with column JPIV(j).
[out]SCALE
          SCALE is DOUBLE PRECISION
           On exit, SCALE contains the scale factor. SCALE is chosen
           0 <= SCALE <= 1 to prevent owerflow in the solution.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
September 2012
Contributors:
Bo Kagstrom and Peter Poromaa, Department of Computing Science, Umea University, S-901 87 Umea, Sweden.

Definition at line 117 of file zgesc2.f.

117 *
118 * -- LAPACK auxiliary routine (version 3.4.2) --
119 * -- LAPACK is a software package provided by Univ. of Tennessee, --
120 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
121 * September 2012
122 *
123 * .. Scalar Arguments ..
124  INTEGER lda, n
125  DOUBLE PRECISION scale
126 * ..
127 * .. Array Arguments ..
128  INTEGER ipiv( * ), jpiv( * )
129  COMPLEX*16 a( lda, * ), rhs( * )
130 * ..
131 *
132 * =====================================================================
133 *
134 * .. Parameters ..
135  DOUBLE PRECISION zero, one, two
136  parameter ( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
137 * ..
138 * .. Local Scalars ..
139  INTEGER i, j
140  DOUBLE PRECISION bignum, eps, smlnum
141  COMPLEX*16 temp
142 * ..
143 * .. External Subroutines ..
144  EXTERNAL zlaswp, zscal
145 * ..
146 * .. External Functions ..
147  INTEGER izamax
148  DOUBLE PRECISION dlamch
149  EXTERNAL izamax, dlamch
150 * ..
151 * .. Intrinsic Functions ..
152  INTRINSIC abs, dble, dcmplx
153 * ..
154 * .. Executable Statements ..
155 *
156 * Set constant to control overflow
157 *
158  eps = dlamch( 'P' )
159  smlnum = dlamch( 'S' ) / eps
160  bignum = one / smlnum
161  CALL dlabad( smlnum, bignum )
162 *
163 * Apply permutations IPIV to RHS
164 *
165  CALL zlaswp( 1, rhs, lda, 1, n-1, ipiv, 1 )
166 *
167 * Solve for L part
168 *
169  DO 20 i = 1, n - 1
170  DO 10 j = i + 1, n
171  rhs( j ) = rhs( j ) - a( j, i )*rhs( i )
172  10 CONTINUE
173  20 CONTINUE
174 *
175 * Solve for U part
176 *
177  scale = one
178 *
179 * Check for scaling
180 *
181  i = izamax( n, rhs, 1 )
182  IF( two*smlnum*abs( rhs( i ) ).GT.abs( a( n, n ) ) ) THEN
183  temp = dcmplx( one / two, zero ) / abs( rhs( i ) )
184  CALL zscal( n, temp, rhs( 1 ), 1 )
185  scale = scale*dble( temp )
186  END IF
187  DO 40 i = n, 1, -1
188  temp = dcmplx( one, zero ) / a( i, i )
189  rhs( i ) = rhs( i )*temp
190  DO 30 j = i + 1, n
191  rhs( i ) = rhs( i ) - rhs( j )*( a( i, j )*temp )
192  30 CONTINUE
193  40 CONTINUE
194 *
195 * Apply permutations JPIV to the solution (RHS)
196 *
197  CALL zlaswp( 1, rhs, lda, 1, n-1, jpiv, -1 )
198  RETURN
199 *
200 * End of ZGESC2
201 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine zlaswp(N, A, LDA, K1, K2, IPIV, INCX)
ZLASWP performs a series of row interchanges on a general rectangular matrix.
Definition: zlaswp.f:116
subroutine dlabad(SMALL, LARGE)
DLABAD
Definition: dlabad.f:76
integer function izamax(N, ZX, INCX)
IZAMAX
Definition: izamax.f:53
subroutine zscal(N, ZA, ZX, INCX)
ZSCAL
Definition: zscal.f:54

Here is the call graph for this function:

Here is the caller graph for this function: