LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine cgesc2 ( integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
complex, dimension( * )  RHS,
integer, dimension( * )  IPIV,
integer, dimension( * )  JPIV,
real  SCALE 
)

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

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

Purpose:
 CGESC2 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 CGETC2.
Parameters
[in]N
          N is INTEGER
          The number of columns of the matrix A.
[in]A
          A is COMPLEX array, dimension (LDA, N)
          On entry, the  LU part of the factorization of the n-by-n
          matrix A computed by CGETC2:  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 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 REAL
           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 cgesc2.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  REAL scale
126 * ..
127 * .. Array Arguments ..
128  INTEGER ipiv( * ), jpiv( * )
129  COMPLEX a( lda, * ), rhs( * )
130 * ..
131 *
132 * =====================================================================
133 *
134 * .. Parameters ..
135  REAL zero, one, two
136  parameter ( zero = 0.0e+0, one = 1.0e+0, two = 2.0e+0 )
137 * ..
138 * .. Local Scalars ..
139  INTEGER i, j
140  REAL bignum, eps, smlnum
141  COMPLEX temp
142 * ..
143 * .. External Subroutines ..
144  EXTERNAL claswp, cscal, slabad
145 * ..
146 * .. External Functions ..
147  INTEGER icamax
148  REAL slamch
149  EXTERNAL icamax, slamch
150 * ..
151 * .. Intrinsic Functions ..
152  INTRINSIC abs, cmplx, real
153 * ..
154 * .. Executable Statements ..
155 *
156 * Set constant to control overflow
157 *
158  eps = slamch( 'P' )
159  smlnum = slamch( 'S' ) / eps
160  bignum = one / smlnum
161  CALL slabad( smlnum, bignum )
162 *
163 * Apply permutations IPIV to RHS
164 *
165  CALL claswp( 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 = icamax( n, rhs, 1 )
182  IF( two*smlnum*abs( rhs( i ) ).GT.abs( a( n, n ) ) ) THEN
183  temp = cmplx( one / two, zero ) / abs( rhs( i ) )
184  CALL cscal( n, temp, rhs( 1 ), 1 )
185  scale = scale*REAL( temp )
186  END IF
187  DO 40 i = n, 1, -1
188  temp = cmplx( 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 claswp( 1, rhs, lda, 1, n-1, jpiv, -1 )
198  RETURN
199 *
200 * End of CGESC2
201 *
subroutine slabad(SMALL, LARGE)
SLABAD
Definition: slabad.f:76
subroutine cscal(N, CA, CX, INCX)
CSCAL
Definition: cscal.f:54
integer function icamax(N, CX, INCX)
ICAMAX
Definition: icamax.f:53
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine claswp(N, A, LDA, K1, K2, IPIV, INCX)
CLASWP performs a series of row interchanges on a general rectangular matrix.
Definition: claswp.f:116

Here is the call graph for this function:

Here is the caller graph for this function: