LFCRT

more...

more...

Estimates the condition number of a real triangular matrix.

Required Arguments

AN by N matrix containing the coefficient matrix for the triangular linear system. (Input)
For a lower triangular system, only the lower triangular part and diagonal of A are referenced. For an upper triangular system, only the upper triangular part and diagonal of A are referenced.

RCOND — Scalar containing an estimate of the reciprocal of the L1 condition number of A. (Output)

Optional Arguments

N — Number of equations. (Input)
Default: N = size (A,2).

LDA — Leading dimension of A exactly as specified in the dimension statement of the calling program. (Input)
Default: LDA = size (A,1).

IPATH — Path indicator. (Input)
IPATH = 1 means A is lower triangular. IPATH = 2 means A is upper triangular.
Default: IPATH =1.

FORTRAN 90 Interface

Generic: CALL LFCRT (A, RCOND [])

Specific: The specific interface names are S_LFCRT and D_LFCRT.

FORTRAN 77 Interface

Single: CALL LFCRT (N, A, LDA, IPATH, RCOND)

Double: The double precision name is DLFCRT.

ScaLAPACK Interface

Generic: CALL LFCRT (A0, RCOND [])

Specific: The specific interface names are S_LFCRT and D_LFCRT.

See the ScaLAPACK Usage Notes below for a description of the arguments for distributed computing.

Description

Routine LFCRT estimates the condition number of a real triangular matrix. The L1 condition number of the matrix A is defined to be κ(A) = A1A-11. Since it is expensive to compute A-11, the condition number is only estimated. The estimation algorithm is the same as used by LINPACK and is described by Cline et al. (1979).

If the estimated condition number is greater than 1/ɛ (where ɛ is machine precision), a warning error is issued. This indicates that very small changes in A can cause very large changes in the solution x.

The underlying code is based on either LINPACK , LAPACK, or ScaLAPACK code depending upon which supporting libraries are used during linking. For a detailed explanation see Using ScaLAPACK, LAPACK, LINPACK, and EISPACK in the Introduction section of this manual.

Comments

1. Workspace may be explicitly provided, if desired, by use of L2CRT/ DL2CRT. The reference is:

CALL L2CRT (N, A, LDA, IPATH, RCOND, WK)

The additional argument is:

WK — Work vector of length N.

2. Informational error

 

Type

Code

Description

3

1

The input triangular matrix is algorithmically singular.

ScaLAPACK Usage Notes

The arguments which differ from the standard version of this routine are:

A0MXLDA by MXCOL local matrix containing the local portions of the distributed matrix A. A contains the coefficient matrix for the triangular linear system. (Input)
For a lower triangular system, only the lower triangular part and diagonal of A are referenced. For an upper triangular system, only the upper triangular part and diagonal of A are referenced.

All other arguments are global and are the same as described for the standard version of the routine. In the argument descriptions above, MXLDA and MXCOL can be obtained through a call to SCALAPACK_GETDIM (see Utilities) after a call to SCALAPACK_SETUP (see Utilities) has been made. See the ScaLAPACK Example below.

Examples

Example

An estimate of the reciprocal condition number is computed for a 3 × 3 lower triangular coefficient matrix.

 

USE LFCRT_INT

USE UMACH_INT

! Declare variables

PARAMETER (LDA=3)

REAL A(LDA,LDA), RCOND

INTEGER NOUT

! Set values for A and B

! A = ( 2.0 )

! ( 2.0 -1.0 )

! ( -4.0 2.0 5.0)

!

DATA A/2.0, 2.0, -4.0, 0.0, -1.0, 2.0, 0.0, 0.0, 5.0/

!

! Compute the reciprocal condition

! number (IPATH=1)

CALL LFCRT (A, RCOND)

! Print results

CALL UMACH (2, NOUT)

WRITE (NOUT,99999) RCOND, 1.0E0/RCOND

99999 FORMAT (’ RCOND = ’,F5.3,/,’ L1 Condition number = ’,F6.3)

END

Output

 

RCOND < 0.1

L1 Condition number < 15.0

ScaLAPACK Example

The same lower triangular matrix as in the example above is used in this distributed computing example. An estimate of the reciprocal condition number is computed for the 3 × 3 lower triangular coefficient matrix. SCALAPACK_MAP is an IMSL utility routine (see Chapter 11, “Utilities”) used to map an array to the processor grid. It is used here for brevity. DESCINIT is a ScaLAPACK tools routine which initializes the descriptors for the local arrays.

 

USE MPI_SETUP_INT

USE LFCRT_INT

USE SCALAPACK_SUPPORT

IMPLICIT NONE

INCLUDE ‘mpif.h’

! Declare variables

INTEGER LDA, N, NOUT, DESCA(9)

INTEGER INFO, MXCOL, MXLDA

REAL RCOND

REAL, ALLOCATABLE :: A(:,:)

REAL, ALLOCATABLE :: A0(:,:)

PARAMETER (LDA=3, N=3)

! Set up for MPI

MP_NPROCS = MP_SETUP()

IF(MP_RANK .EQ. 0) THEN

ALLOCATE (A(LDA,N))

! Set values for A

A(1,:) = (/ 2.0, 0.0, 0.0/)

A(2,:) = (/ 2.0, -1.0, 0.0/)

A(3,:) = (/-4.0, 2.0, 5.0/)

ENDIF

! Set up a 1D processor grid and define

! its context ID, MP_ICTXT

CALL SCALAPACK_SETUP(N, N, .TRUE., .TRUE.)

! Get the array descriptor entities MXLDA,

! and MXCOL

CALL SCALAPACK_GETDIM(N, N, MP_MB, MP_NB, MXLDA, MXCOL)

! Set up the array descriptor

CALL DESCINIT(DESCA, N, N, MP_MB, MP_NB, 0, 0, MP_ICTXT, MXLDA, INFO)

! Allocate space for the local arrays

ALLOCATE (A0(MXLDA,MXCOL))

! Map input array to the processor grid

CALL SCALAPACK_MAP(A, DESCA, A0)

! Compute the reciprocal condition

! number (IPATH=1)

CALL LFCRT (A0, RCOND)

! Print results.

! Only Rank=0 has the solution, RCOND.

IF(MP_RANK .EQ. 0) THEN

CALL UMACH (2, NOUT)

WRITE (NOUT,99999) RCOND, 1.0E0/RCOND

ENDIF

IF (MP_RANK .EQ. 0) DEALLOCATE(A)

DEALLOCATE(A0)

! Exit Scalapack usage

CALL SCALAPACK_EXIT(MP_ICTXT)

! Shut down MPI

MP_NPROCS = MP_SETUP(‘FINAL’)

99999 FORMAT (’ RCOND = ’,F5.3,/,’ L1 Condition number = ’,F6.3)

END

Output

 

RCOND < 0.1

L1 Condition number < 15.0