CRGRB
Converts a real general matrix to a matrix in band storage mode.
Required Arguments
A — Real N by N matrix. (Input)
NLC — Number of lower codiagonals in B. (Input)
NUC — Number of upper codiagonals in B. (Input)
B — Real (NUC + 1 + NLC) by N array containing the band matrix in band storage mode. (Output)
Optional Arguments
N — Order of the matrices A and B. (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).
FORTRAN 90 Interface
Generic: CALL CRGRB (A, NLC, NUC, B [])
Specific: The specific interface names are S_CRGRB and D_CRGRB.
FORTRAN 77 Interface
Single: CALL CRGRB (N, A, LDA, NLC, NUC, B, LDB)
Double: The double precision name is DCRGRB.
Description
The routine CRGRB converts the real general N × N matrix A with mu = NUC upper codiagonals and ml = NLC lower codiagonals into the real band matrix B of order N. The first mu rows of B then contain the upper codiagonals of A, the next row contains the main diagonal of A, and the last ml rows of B contain the lower codiagonals of A.
Example
A real 4 × 4 matrix with one upper codiagonal and three lower codiagonals is copied to a real band matrix of order 4 in band storage mode.
 
USE CRGRB_INT
USE WRRRN_INT
 
IMPLICIT NONE
! Declare variables
INTEGER LDA, LDB, N, NLC, NUC
PARAMETER (LDA=4, LDB=5, N=4, NLC=3, NUC=1)
!
REAL A(LDA,N), B(LDB,N)
! Set values for A
! A = ( 1.0 2.0 0.0 0.0)
! ( -2.0 1.0 3.0 0.0)
! ( 0.0 -3.0 1.0 4.0)
! ( -7.0 0.0 -4.0 1.0)
!
DATA A/1.0, -2.0, 0.0, -7.0, 2.0, 1.0, -3.0, 0.0, 0.0, 3.0, 1.0, &
-4.0, 0.0, 0.0, 4.0, 1.0/
! Convert A to band matrix B
CALL CRGRB (A, NLC, NUC, B)
! Print results
CALL WRRRN ('B', B)
END
Output
 
B
1 2 3 4
1 0.000 2.000 3.000 4.000
2 1.000 1.000 1.000 1.000
3 -2.000 -3.000 -4.000 0.000
4 0.000 0.000 0.000 0.000
5 -7.000 0.000 0.000 0.000