ARBRB

Adds two band matrices, both in band storage mode.

Required Arguments

AN by N band matrix with NLCA lower codiagonals and NUCA upper codiagonals stored in band mode with dimension (NLCA + NUCA + 1) by N. (Input)

NLCA — Number of lower codiagonals of A. (Input)

NUCA — Number of upper codiagonals of A. (Input)

BN by N band matrix with NLCB lower codiagonals and NUCB upper codiagonals stored in band mode with dimension (NLCB + NUCB + 1) by N. (Input)

NLCB — Number of lower codiagonals of B. (Input)

NUCB — Number of upper codiagonals of B. (Input)

CN by N band matrix with NLCC lower codiagonals and NUCC upper codiagonals containing the sum A + B in band mode with dimension (NLCC + NUCC + 1) by N. (Output)

NLCC — Number of lower codiagonals of C. (Input)
NLCC must be at least as large as max(NLCA, NLCB).

NUCC — Number of upper codiagonals of C. (Input)
NUCC must be at least as large as max(NUCA, NUCB).

Optional Arguments

N — Order of the matrices A, B and C. (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).

LDB — Leading dimension of B exactly as specified in the dimension statement of the calling program. (Input)
Default: LDB = SIZE (B,1).

LDC — Leading dimension of C exactly as specified in the dimension statement of the calling program. (Input)
Default: LDC = SIZE (C,1).

FORTRAN 90 Interface

Generic: CALL ARBRB (A, NLCA, NUCA, B, NLCB, NUCB, C, NLCC, NUCC [])

Specific: The specific interface names are S_ARBRB and D_ARBRB.

FORTRAN 77 Interface

Single: CALL ARBRB (N, A, LDA, NLCA, NUCA, B, LDB, NLCB, NUCB, C, LDC, NLCC, NUCC)

Double: The double precision name is DARBRB.

Description

The routine ARBRB adds two real matrices stored in band mode, returning a real matrix stored in band mode.

Example

Add two real matrices of order 4 stored in band mode. Matrix A has one upper codiagonal and one lower codiagonal. Matrix B has no upper codiagonals and two lower codiagonals. The output matrix C, has one upper codiagonal and two lower codiagonals.

 

USE ARBRB_INT

USE WRRRN_INT

 

IMPLICIT NONE

! Declare variables

INTEGER LDA, LDB, LDC, N, NLCA, NLCB, NLCC, NUCA, NUCB, NUCC

PARAMETER (LDA=3, LDB=3, LDC=4, N=4, NLCA=1, NLCB=2, NLCC=2, &

NUCA=1, NUCB=0, NUCC=1)

!

REAL A(LDA,N), B(LDB,N), C(LDC,N)

! Set values for A (in band mode)

! A = ( 0.0 2.0 3.0 -1.0)

! ( 1.0 1.0 1.0 1.0)

! ( 0.0 3.0 4.0 0.0)

!

! Set values for B (in band mode)

! B = ( 3.0 3.0 3.0 3.0)

! ( 1.0 -2.0 1.0 0.0)

! ( -1.0 2.0 0.0 0.0)

!

DATA A/0.0, 1.0, 0.0, 2.0, 1.0, 3.0, 3.0, 1.0, 4.0, -1.0, 1.0, &

0.0/

DATA B/3.0, 1.0, -1.0, 3.0, -2.0, 2.0, 3.0, 1.0, 0.0, 3.0, 0.0, &

0.0/

! Add A and B to obtain C (in band

! mode)

CALL ARBRB (A, NLCA, NUCA, B, NLCB, NUCB, C, NLCC, NUCC)

! Print results

CALL WRRRN ('C = A+B', C)

END

Output

 

C = A+B

1 2 3 4

1 0.000 2.000 3.000 -1.000

2 4.000 4.000 4.000 4.000

3 1.000 1.000 5.000 0.000

4 -1.000 2.000 0.000 0.000