LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ sla_gbrcond()

real function sla_gbrcond ( character trans,
integer n,
integer kl,
integer ku,
real, dimension( ldab, * ) ab,
integer ldab,
real, dimension( ldafb, * ) afb,
integer ldafb,
integer, dimension( * ) ipiv,
integer cmode,
real, dimension( * ) c,
integer info,
real, dimension( * ) work,
integer, dimension( * ) iwork )

SLA_GBRCOND estimates the Skeel condition number for a general banded matrix.

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

Purpose:
!>
!>    SLA_GBRCOND Estimates the Skeel condition number of  op(A) * op2(C)
!>    where op2 is determined by CMODE as follows
!>    CMODE =  1    op2(C) = C
!>    CMODE =  0    op2(C) = I
!>    CMODE = -1    op2(C) = inv(C)
!>    The Skeel condition number  cond(A) = norminf( |inv(A)||A| )
!>    is computed by computing scaling factors R such that
!>    diag(R)*A*op2(C) is row equilibrated and computing the standard
!>    infinity-norm condition number.
!> 
Parameters
[in]TRANS
!>          TRANS is CHARACTER*1
!>     Specifies the form of the system of equations:
!>       = 'N':  A * X = B     (No transpose)
!>       = 'T':  A**T * X = B  (Transpose)
!>       = 'C':  A**H * X = B  (Conjugate Transpose = Transpose)
!> 
[in]N
!>          N is INTEGER
!>     The number of linear equations, i.e., the order of the
!>     matrix A.  N >= 0.
!> 
[in]KL
!>          KL is INTEGER
!>     The number of subdiagonals within the band of A.  KL >= 0.
!> 
[in]KU
!>          KU is INTEGER
!>     The number of superdiagonals within the band of A.  KU >= 0.
!> 
[in]AB
!>          AB is REAL array, dimension (LDAB,N)
!>     On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
!>     The j-th column of A is stored in the j-th column of the
!>     array AB as follows:
!>     AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
!> 
[in]LDAB
!>          LDAB is INTEGER
!>     The leading dimension of the array AB.  LDAB >= KL+KU+1.
!> 
[in]AFB
!>          AFB is REAL array, dimension (LDAFB,N)
!>     Details of the LU factorization of the band matrix A, as
!>     computed by SGBTRF.  U is stored as an upper triangular
!>     band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
!>     and the multipliers used during the factorization are stored
!>     in rows KL+KU+2 to 2*KL+KU+1.
!> 
[in]LDAFB
!>          LDAFB is INTEGER
!>     The leading dimension of the array AFB.  LDAFB >= 2*KL+KU+1.
!> 
[in]IPIV
!>          IPIV is INTEGER array, dimension (N)
!>     The pivot indices from the factorization A = P*L*U
!>     as computed by SGBTRF; row i of the matrix was interchanged
!>     with row IPIV(i).
!> 
[in]CMODE
!>          CMODE is INTEGER
!>     Determines op2(C) in the formula op(A) * op2(C) as follows:
!>     CMODE =  1    op2(C) = C
!>     CMODE =  0    op2(C) = I
!>     CMODE = -1    op2(C) = inv(C)
!> 
[in]C
!>          C is REAL array, dimension (N)
!>     The vector C in the formula op(A) * op2(C).
!> 
[out]INFO
!>          INFO is INTEGER
!>       = 0:  Successful exit.
!>     i > 0:  The ith argument is invalid.
!> 
[out]WORK
!>          WORK is REAL array, dimension (5*N).
!>     Workspace.
!> 
[out]IWORK
!>          IWORK is INTEGER array, dimension (N).
!>     Workspace.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 164 of file sla_gbrcond.f.

167*
168* -- LAPACK computational routine --
169* -- LAPACK is a software package provided by Univ. of Tennessee, --
170* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
171*
172* .. Scalar Arguments ..
173 CHARACTER TRANS
174 INTEGER N, LDAB, LDAFB, INFO, KL, KU, CMODE
175* ..
176* .. Array Arguments ..
177 INTEGER IWORK( * ), IPIV( * )
178 REAL AB( LDAB, * ), AFB( LDAFB, * ), WORK( * ),
179 $ C( * )
180* ..
181*
182* =====================================================================
183*
184* .. Local Scalars ..
185 LOGICAL NOTRANS
186 INTEGER KASE, I, J, KD, KE
187 REAL AINVNM, TMP
188* ..
189* .. Local Arrays ..
190 INTEGER ISAVE( 3 )
191* ..
192* .. External Functions ..
193 LOGICAL LSAME
194 EXTERNAL lsame
195* ..
196* .. External Subroutines ..
197 EXTERNAL slacn2, sgbtrs, xerbla
198* ..
199* .. Intrinsic Functions ..
200 INTRINSIC abs, max
201* ..
202* .. Executable Statements ..
203*
204 sla_gbrcond = 0.0
205*
206 info = 0
207 notrans = lsame( trans, 'N' )
208 IF ( .NOT. notrans .AND. .NOT. lsame(trans, 'T')
209 $ .AND. .NOT. lsame(trans, 'C') ) THEN
210 info = -1
211 ELSE IF( n.LT.0 ) THEN
212 info = -2
213 ELSE IF( kl.LT.0 .OR. kl.GT.n-1 ) THEN
214 info = -3
215 ELSE IF( ku.LT.0 .OR. ku.GT.n-1 ) THEN
216 info = -4
217 ELSE IF( ldab.LT.kl+ku+1 ) THEN
218 info = -6
219 ELSE IF( ldafb.LT.2*kl+ku+1 ) THEN
220 info = -8
221 END IF
222 IF( info.NE.0 ) THEN
223 CALL xerbla( 'SLA_GBRCOND', -info )
224 RETURN
225 END IF
226 IF( n.EQ.0 ) THEN
227 sla_gbrcond = 1.0
228 RETURN
229 END IF
230*
231* Compute the equilibration matrix R such that
232* inv(R)*A*C has unit 1-norm.
233*
234 kd = ku + 1
235 ke = kl + 1
236 IF ( notrans ) THEN
237 DO i = 1, n
238 tmp = 0.0
239 IF ( cmode .EQ. 1 ) THEN
240 DO j = max( i-kl, 1 ), min( i+ku, n )
241 tmp = tmp + abs( ab( kd+i-j, j ) * c( j ) )
242 END DO
243 ELSE IF ( cmode .EQ. 0 ) THEN
244 DO j = max( i-kl, 1 ), min( i+ku, n )
245 tmp = tmp + abs( ab( kd+i-j, j ) )
246 END DO
247 ELSE
248 DO j = max( i-kl, 1 ), min( i+ku, n )
249 tmp = tmp + abs( ab( kd+i-j, j ) / c( j ) )
250 END DO
251 END IF
252 work( 2*n+i ) = tmp
253 END DO
254 ELSE
255 DO i = 1, n
256 tmp = 0.0
257 IF ( cmode .EQ. 1 ) THEN
258 DO j = max( i-kl, 1 ), min( i+ku, n )
259 tmp = tmp + abs( ab( ke-i+j, i ) * c( j ) )
260 END DO
261 ELSE IF ( cmode .EQ. 0 ) THEN
262 DO j = max( i-kl, 1 ), min( i+ku, n )
263 tmp = tmp + abs( ab( ke-i+j, i ) )
264 END DO
265 ELSE
266 DO j = max( i-kl, 1 ), min( i+ku, n )
267 tmp = tmp + abs( ab( ke-i+j, i ) / c( j ) )
268 END DO
269 END IF
270 work( 2*n+i ) = tmp
271 END DO
272 END IF
273*
274* Estimate the norm of inv(op(A)).
275*
276 ainvnm = 0.0
277
278 kase = 0
279 10 CONTINUE
280 CALL slacn2( n, work( n+1 ), work, iwork, ainvnm, kase, isave )
281 IF( kase.NE.0 ) THEN
282 IF( kase.EQ.2 ) THEN
283*
284* Multiply by R.
285*
286 DO i = 1, n
287 work( i ) = work( i ) * work( 2*n+i )
288 END DO
289
290 IF ( notrans ) THEN
291 CALL sgbtrs( 'No transpose', n, kl, ku, 1, afb, ldafb,
292 $ ipiv, work, n, info )
293 ELSE
294 CALL sgbtrs( 'Transpose', n, kl, ku, 1, afb, ldafb,
295 $ ipiv,
296 $ work, n, info )
297 END IF
298*
299* Multiply by inv(C).
300*
301 IF ( cmode .EQ. 1 ) THEN
302 DO i = 1, n
303 work( i ) = work( i ) / c( i )
304 END DO
305 ELSE IF ( cmode .EQ. -1 ) THEN
306 DO i = 1, n
307 work( i ) = work( i ) * c( i )
308 END DO
309 END IF
310 ELSE
311*
312* Multiply by inv(C**T).
313*
314 IF ( cmode .EQ. 1 ) THEN
315 DO i = 1, n
316 work( i ) = work( i ) / c( i )
317 END DO
318 ELSE IF ( cmode .EQ. -1 ) THEN
319 DO i = 1, n
320 work( i ) = work( i ) * c( i )
321 END DO
322 END IF
323
324 IF ( notrans ) THEN
325 CALL sgbtrs( 'Transpose', n, kl, ku, 1, afb, ldafb,
326 $ ipiv,
327 $ work, n, info )
328 ELSE
329 CALL sgbtrs( 'No transpose', n, kl, ku, 1, afb, ldafb,
330 $ ipiv, work, n, info )
331 END IF
332*
333* Multiply by R.
334*
335 DO i = 1, n
336 work( i ) = work( i ) * work( 2*n+i )
337 END DO
338 END IF
339 GO TO 10
340 END IF
341*
342* Compute the estimate of the reciprocal condition number.
343*
344 IF( ainvnm .NE. 0.0 )
345 $ sla_gbrcond = ( 1.0 / ainvnm )
346*
347 RETURN
348*
349* End of SLA_GBRCOND
350*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sgbtrs(trans, n, kl, ku, nrhs, ab, ldab, ipiv, b, ldb, info)
SGBTRS
Definition sgbtrs.f:137
real function sla_gbrcond(trans, n, kl, ku, ab, ldab, afb, ldafb, ipiv, cmode, c, info, work, iwork)
SLA_GBRCOND estimates the Skeel condition number for a general banded matrix.
subroutine slacn2(n, v, x, isgn, est, kase, isave)
SLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
Definition slacn2.f:134
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48
Here is the call graph for this function:
Here is the caller graph for this function: