LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ dgesc2()

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 overflow in the solution.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors:
Bo Kagstrom and Peter Poromaa, Department of Computing Science, Umea University, S-901 87 Umea, Sweden.

Definition at line 113 of file dgesc2.f.

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