LFTDS

Computes the RTR Cholesky factorization of a real symmetric positive definite matrix.

Required Arguments

A — N by N symmetric positive definite matrix to be factored. (Input)

Only the upper triangle of A is referenced.

Only the upper triangle of A is referenced.

FACT — N by N matrix containing the upper triangular matrix R of the factorization of A in the upper triangle, and the lower triangular matrix RT in the lower triangle. (Output)

If A is not needed, A and FACT can share the same storage location.

If A is not needed, A and FACT can share the same storage location.

Optional Arguments

N — Order of the matrix. (Input)

Default: N = size (A,2).

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).

Default: LDA = size (A,1).

LDFACT — Leading dimension of FACT exactly as specified in the dimension statement of the calling program. (Input)

Default: LDFACT = size (FACT,1).

Default: LDFACT = size (FACT,1).

FORTRAN 90 Interface

Generic: CALL LFTDS (A, FACT [, …])

Specific: The specific interface names are S_LFTDS and D_LFTDS.

FORTRAN 77 Interface

Single: CALL LFTDS (N, A, LDA, FACT, LDFACT)

Double: The double precision name is DLFTDS.

ScaLAPACK Interface

Generic: CALL LFTDS (A0, FACT0 [, …])

Specific: The specific interface names are S_LFTDS and D_LFTDS.

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

Description

Routine LFTDS computes an RTR Cholesky factorization of a real symmetric positive definite coefficient matrix. The matrix R is upper triangular.

LFTDS fails if any submatrix of R is not positive definite or if R has a zero diagonal element. These errors occur only if A is very close to a singular matrix or to a matrix which is not positive definite.

The RTR factors are returned in a form that is compatible with routines LFIDS, LFSDS and LFDDS. To solve systems of equations with multiple right-hand-side vectors, use LFTDS followed by either LFIDS or LFSDS called once for each right-hand side. The routine LFDDS can be called to compute the determinant of the coefficient matrix after LFTDS has performed the factorization.

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

Informational error

Type | Code | Description |
---|---|---|

4 | 2 | The input matrix is not positive definite. |

ScaLAPACK Usage Notes

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

A0 — MXLDA by MXCOL local matrix containing the local portions of the distributed matrix A. A contains the symmetric positive definite matrix to be factored. (Input)

FACT0 — MXLDA by MXCOL local matrix containing the local portions of the distributed matrix FACT. FACT contains the upper triangular matrix R of the factorization of A in the upper triangular part. (Output)

Only the upper triangle of FACT will be used. If A is not needed, A and FACT can share the same storage locations.

Only the upper triangle of FACT will be used. If A is not needed, A and FACT can share the same storage locations.

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

The inverse of a 3 × 3 matrix is computed. LFTDS is called to factor the matrix and to check for nonpositive definiteness. LFSDS is called to determine the columns of the inverse.

USE LFTDS_INT

USE LFSDS_INT

USE WRRRN_INT

! Declare variables

INTEGER LDA, LDFACT, N

PARAMETER (LDA=3, LDFACT=3, N=3)

REAL A(LDA,LDA), AINV(LDA,LDA), FACT(LDFACT,LDFACT), RJ(N)

!

! Set values for A

! A = ( 1.0 -3.0 2.0)

! ( -3.0 10.0 -5.0)

! ( 2.0 -5.0 6.0)

!

DATA A/1.0, -3.0, 2.0, -3.0, 10.0, -5.0, 2.0, -5.0, 6.0/

! Factor the matrix A

CALL LFTDS (A, FACT)

! Set up the columns of the identity

! matrix one at a time in RJ

RJ = 0.0E0

DO 10 J=1, N

RJ(J) = 1.0E0

! RJ is the J-th column of the identity

! matrix so the following LFSDS

! reference places the J-th column of

! the inverse of A in the J-th column

! of AINV

CALL LFSDS (FACT, RJ, AINV(:,J))

RJ(J) = 0.0E0

10 CONTINUE

! Print the results

CALL WRRRN (’AINV’, AINV)

!

END

Output

AINV

1 2 3

1 35.00 8.00 -5.00

2 8.00 2.00 -1.00

3 -5.00 -1.00 1.00

ScaLAPACK Example

The inverse of the same 3 × 3 matrix is computed as a distributed example. LFTDS is called to factor the matrix and to check for nonpositive definiteness. LFSDS is called to determine the columns of the inverse. SCALAPACK_MAP and SCALAPACK_UNMAP are IMSL utility routines (see Chapter 11, “Utilities”) used to map and unmap arrays to and from the processor grid. They are used here for brevity. DESCINIT is a ScaLAPACK tools routine which initializes the descriptors for the local arrays.

USE MPI_SETUP_INT

USE LFTDS_INT

USE UMACH_INT

USE LFSDS_INT

USE WRRRN_INT

USE SCALAPACK_SUPPORT

IMPLICIT NONE

INCLUDE ‘mpif.h’

! Declare variables

INTEGER J, LDA, N, DESCA(9), DESCL(9)

INTEGER INFO, MXCOL, MXLDA

REAL, ALLOCATABLE :: A(:,:), AINV(:,:), X0(:)

REAL, ALLOCATABLE :: A0(:,:), FACT0(:,:), RES0(:), RJ0(:)

PARAMETER (LDA=3, N=3)

! Set up for MPI

MP_NPROCS = MP_SETUP()

IF(MP_RANK .EQ. 0) THEN

ALLOCATE (A(LDA,N), AINV(LDA,N))

! Set values for A

A(1,:) = (/ 1.0, -3.0, 2.0/)

A(2,:) = (/ -3.0, 10.0, -5.0/)

A(3,:) = (/ 2.0, -5.0, 6.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 descriptors

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

CALL DESCINIT(DESCL, N, 1, MP_MB, 1, 0, 0, MP_ICTXT, MXLDA, INFO)

! Allocate space for the local arrays

ALLOCATE(A0(MXLDA,MXCOL), X0(MXLDA),FACT0(MXLDA,MXCOL), RJ(N), &

RJ0(MXLDA), RES0(MXLDA), IPVT0(MXLDA))

! Map input arrays to the processor grid

CALL SCALAPACK_MAP(A, DESCA, A0)

! Call the factorization routine

CALL LFTDS (A0, FACT0)

! Set up the columns of the identity

! matrix one at a time in RJ

RJ = 0.0E0

DO 10 J=1, N

RJ(J) = 1.0

CALL SCALAPACK_MAP(RJ, DESCL, RJ0)

! RJ is the J-th column of the identity

! matrix so the following LFSDS

! reference computes the J-th column of

! the inverse of A

CALL LFSDS (FACT0, RJ0, X0)

RJ(J) = 0.0

CALL SCALAPACK_UNMAP(X0, DESCL, AINV(:,J))

10 CONTINUE

! Print results.

! Only Rank=0 has the solution, AINV.

IF(MP_RANK.EQ.0) CALL WRRRN (’AINV’, AINV)

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

DEALLOCATE(A0, FACT0, IPVT0, RJ, RJ0, RES0, X0)

! Exit ScaLAPACK usage

CALL SCALAPACK_EXIT(MP_ICTXT)

! Shut down MPI

MP_NPROCS = MP_SETUP(‘FINAL’)

END

Output

RCOND < 0.005

L1 Condition number < 875.0

AINV

1 2 3

1 35.00 8.00 -5.00

2 8.00 2.00 -1.00

3 -5.00 -1.00 1.00