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

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

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

Purpose:
 DGESC2 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 DGETC2.
Parameters
[in]N
          N is INTEGER
          The order of the matrix A.
[in]A
          A is DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the  LU part of the factorization of the n-by-n
          matrix A computed by DGETC2:  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 DOUBLE PRECISION 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 116 of file dgesc2.f.

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

Here is the call graph for this function:

Here is the caller graph for this function: