Solves a real system of linear equations in band storage mode without iterative refinement.
A (NLCA + NUCA + 1) by N array containing the N by N banded coefficient matrix in band storage mode. (Input)
NLCA Number of lower codiagonals of A. (Input)
NUCA Number of upper codiagonals of A. (Input)
B Vector of length N containing the right-hand side of the linear system. (Input)
X Vector of length N containing the solution to the linear system. (Output)
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 the
system AX=
B is
solved.
IPATH
= 2 means the system ATX = B is
solved.
Default: IPATH = 1.
Generic: CALL LSLRB (A, NLCA, NUCA, B, X [, ])
Specific: The specific interface names are S_LSLRB and D_LSLRB.
Single: CALL LSLRB (N, A, LDA, NLCA, NUCA, B, IPATH, X)
Double: The double precision name is DLSLRB.
Generic: CALL LSLRB (A0, NLCA, NUCA, B0, X0 [, ])
Specific: The specific interface names are S_LSLRB and D_LSLRB.
See the ScaLAPACK Usage Notes below for a description of the arguments for distributed computing.
Routine LSLRB solves a system of linear algebraic equations having a real banded coefficient matrix. It first uses the routine LFCRB to compute an LU factorization of the coefficient matrix and to estimate the condition number of the matrix. The solution of the linear system is then found using LFSRB. LSLRB fails if U, the upper triangular part of the factorization, has a zero diagonal element. This occurs only if A is singular or very close to a singular matrix. 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. If the coefficient matrix is ill-conditioned or poorly scaled, it is recommended that LSARB be used.
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.
1. Workspace may be explicitly provided, if desired, by use of L2LRB/DL2LRB. The reference is:
CALL L2LRB (N, A, LDA, NLCA, NUCA, B, IPATH, X, FACT, IPVT, WK)
The additional arguments are as follows:
FACT (2 Χ NLCA + NUCA + 1) Χ N containing the LU factorization of A on output. If A is not needed, A can share the first (NLCA + NUCA + 1) * N storage locations with FACT.
IPVT Work vector of length N containing the pivoting information for the LU factorization of A on output.
WK Work vector of length N.
2. Informational errors
Type Code
3 1 The input matrix is too ill-conditioned. The solution might not be accurate.
4 2 The input matrix is singular.
3. Integer Options with Chapter 11 Options Manager
16 This option uses
four values to solve memory bank conflict (access inefficiency) problems. In
routine L2LRB
the leading dimension of FACT
is increased by IVAL(3)
when N is a
multiple of IVAL(4).
The values IVAL(3)
and IVAL(4)
are temporarily replaced by IVAL(1)
and IVAL(2),
respectively, in LSLRB. Additional
memory allocation for FACT
and option value restoration are done automatically in LSLRB. Users directly
calling L2LRB
can allocate additional space for FACT and set IVAL(3)
and IVAL(4)
so that memory bank conflicts no longer cause inefficiencies. There is no
requirement that users change existing applications that use LSLRB or L2LRB. Default values
for the option are
IVAL(*) = 1, 16, 0, 1.
17 This option has two values that determine if the L1 condition number is to be computed. Routine LSLRB temporarily replaces IVAL(2) by IVAL(1). The routine L2CRB computes the condition number if IVAL(2) = 2. Otherwise L2CRB skips this computation. LSLRB restores the option. Default values for the option are IVAL(*) = 1, 2.
The arguments which differ from the standard version of this routine are:
A0 (2*NLCA + 2*NUCA+1) by MXCOL local matrix containing the local portions of the distributed matrix A. A contains the N by N banded coefficient matrix in band storage mode. (Input)
B0 Local vector of length MXCOL containing the local portions of the distributed vector B. B contains the right-hand side of the linear system. (Input)
X0 Local vector of length MXCOL containing the local portions of the distributed vector X. X contains the solution to the linear system. (Output)
All other arguments are global and are the same as described for the standard version of the routine. In the argument descriptions above, 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.
A system of four linear equations is solved. The coefficient matrix has real banded form with 1 upper and 1 lower codiagonal. The right-hand-side vector b has four elements.
USE
LSLRB_INT
USE WRRRN_INT
! Declare variables
INTEGER LDA, N, NLCA, NUCA
PARAMETER (LDA=3, N=4, NLCA=1, NUCA=1)
REAL A(LDA,N), B(N), X(N)
! Set values for A in band form, and B
!
! A = ( 0.0 -1.0 -2.0 2.0)
! ( 2.0 1.0 -1.0 1.0)
! ( -3.0 0.0 2.0 0.0)
!
! B = ( 3.0 1.0 11.0 -2.0)
!
DATA A/0.0, 2.0, -3.0, -1.0, 1.0, 0.0, -2.0, -1.0, 2.0,&
2.0, 1.0, 0.0/
DATA B/3.0, 1.0, 11.0, -2.0/
!
CALL LSLRB (A, NLCA, NUCA, B, X)
! Print results
CALL WRRRN (X, X, 1, N, 1)
!
END
X
1
2 3
4
2.000 1.000 -3.000 4.000
The same system of four linear equations is solved as a distributed computing example. The coefficient matrix has real banded form with 1 upper and 1 lower codiagonal. The right-hand-side vector b has four elements. SCALAPACK_MAP and SCALAPACK_UNMAP are IMSL utility routines (see 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
LSLRB_INT
USE
WRRRN_INT
USE
SCALAPACK_SUPPORT
IMPLICIT
NONE
INCLUDE mpif.h
! Declare variables
INTEGER LDA, M, N, NLCA, NUCA, NRA,
DESCA(9), DESCX(9)
INTEGER INFO, MXCOL,
MXLDA
REAL, ALLOCATABLE
:: A(:,:), B(:),
X(:)
REAL, ALLOCATABLE
:: A0(:,:), B0(:), X0(:)
PARAMETER (LDA=3, N=6, NLCA=1, NUCA=1)
! Set up for MPI
MP_NPROCS = MP_SETUP()
IF(MP_RANK .EQ. 0)
THEN
ALLOCATE
(A(LDA,N), B(N), X(N))
! Set values for A and B
A(1,:) =
(/ 0.0, 0.0, -3.0, 0.0, -1.0,
-3.0/)
A(2,:) = (/
10.0, 10.0, 15.0, 10.0, 1.0,
6.0/)
A(3,:) =
(/ 0.0, 0.0, 0.0, -5.0, 0.0,
0.0/)
!
B = (/ 10.0, 7.0, 45.0,
33.0, -34.0, 31.0/)
ENDIF
NRA = NLCA + NUCA + 1
M = 2*NLCA + 2*NUCA + 1
! Set up a 1D processor grid and define
! its context ID, MP_ICTXT
CALL SCALAPACK_SETUP(M, N, .FALSE., .TRUE.)
! Get the array descriptor entities MXLDA,
! and MXCOL
CALL SCALAPACK_GETDIM(M, N, MP_MB, MP_NB, MXLDA, MXCOL)
! Reset MXLDA to M
MXLDA = M
! Set up the array descriptors
CALL DESCINIT(DESCA,NRA,N,MP_MB, MP_NB, 0, 0, MP_ICTXT, MXLDA, INFO)
CALL DESCINIT(DESCX, 1, N, 1, MP_NB, 0, 0, MP_ICTXT, 1, INFO)
! Allocate space for the local arrays
ALLOCATE (A0(MXLDA,MXCOL), B0(MXCOL), X0(MXCOL))
! Map input arrays to the processor grid
CALL SCALAPACK_MAP(A, DESCA, A0)
CALL
SCALAPACK_MAP(B, DESCX, B0, 1, .FALSE.)
! Solve the system of equations
CALL LSLRB (A0, NLCA, NUCA, B0, X0)
! Unmap the results from the distributed
! arrays back to a non-distributed array.
! After the unmap, only Rank=0 has the full
! array.
CALL SCALAPACK_UNMAP(X0, DESCX, X, 1, .FALSE.)
! Print results.
! Only Rank=0 has the solution, X.
IF(MP_RANK .EQ. 0)CALL WRRRN (X, X, 1, N, 1)
IF (MP_RANK .EQ. 0) DEALLOCATE(A, B, X)
DEALLOCATE(A0, B0, X0)
! Exit ScaLAPACK usage
CALL SCALAPACK_EXIT(MP_ICTXT)
! Shut down MPI
MP_NPROCS = MP_SETUP(FINAL)
END
X
1
2 3
4
5 6
1.000 1.600
3.000 2.900 -4.000 5.167
PHONE: 713.784.3131 FAX:713.781.9260 |