!**************************************************************************** !* This program tests the subroutine CGBSV which computes the solution * !* to a complex band system of linear equations * !* A * X = B, * !* where A is an N-by-N matrix and X and B are N-by-NRHS matrices. * !* ------------------------------------------------------------------------ * !* SAMPLE RUN: * !* Solve the complex banded linear system of size 4: * !* ( 0, 0) ( 0,0) ( 0, 0) ( 0, 0) ( 629,988) * !* ( 0, 0) ( 62,5) (-102, 91) (25, 1) X = (-180,825) * !* (47,-15) (-17,3) ( 41, 7) (58,-30) ( 877,441) * !* ( 6, 14) ( 32,8) ( 12,-82) ( 0, 0) ( 734,-88) * !* * !* Linear system banded matrix * !* Super-, Main-, Subdiagonals (in lines): * !* 0.000, 0.000 0.000, 0.000 0.000, 0.000 0.000, 0.000 * !* 0.000, 0.000 62.000, 5.000 -102.000, 91.000 25.000, 1.000 * !* 47.000, -15.000 -17.000, 3.000 41.000, 7.000 58.000, -30.000 * !* 6.000, 14.000 32.000, 8.000 12.000, -82.000 0.000, 0.000 * !* Second member: * !* 629.000 988.000 * !*-180.000 825.000 * !* 877.000 441.000 * !* 734.000 -88.000 * !* Solution Matrix X: * !* -5.055462 7.810161 * !* 12.714298 7.766436 * !* 3.504684 -6.116430 * !* 14.314973 12.107421 * !* ERROR CODE (must be zero): 0 * !* ------------------------------------------------------------------------ * !* Ref.: LAPACK Fortran 77 Library, University of Tennessee, University * !* of California Berkeley, NAG Ltd., Courant Institute, Argonne * !* National Lab, and Rice University, March 31, 1993 [BIBLI 17]. * !* * !* Fortran 90 Test Program By J.-P. Moreau, Paris. * !* (www.jpmoreau.fr) * !**************************************************************************** PROGRAM TEST03 USE LAPACK3, ONLY : CGBSV PARAMETER(LDC=10,LDB=5) COMPLEX C(LDC,5), B(LDC,1) INTEGER IPIV(5) N=4 NRHS=1 C=(0.d0,0.d0) B=(0.d0,0.d0) ! define complex banded linear system (here real coefficients) ! upper subdiagonal: C(2,2)=CMPLX(62.d0,5.d0); C(2,3)=CMPLX(-102.d0,91.d0); C(2,4)=CMPLX(25.d0, 1.d0) ! main diagonal: C(3,1)=CMPLX(47.d0,-15.d0); C(3,2)=CMPLX(-17.d0,3.d0); C(3,3)=CMPLX(41.d0,7.d0) C(3,4)=CMPLX(58.d0,-30.d0) ! lower diagonal: C(4,1)=CMPLX(6.d0,14.d0); C(4,2)=CMPLX(32.d0,8.d0); C(4,3)=CMPLX(12.d0,-82.d0) ! define second member (here also real coefficients) B(1,1)=CMPLX( 629.d0,988.d0) B(2,1)=CMPLX(-180.d0,825.d0) B(3,1)=CMPLX( 877.d0,441.d0) B(4,1)=CMPLX( 734.d0,-88.d0) print *, ' Linear System Banded Matrix' print *, ' Super-, Main-, Subdiagonals (in lines):' write(*,10) ((C(i,j),j=1,N), i=1,N) print *, ' Second member:' write(*,11) ((B(i,j),j=1,NRHS), i=1,N) CALL CGBSV(N,1,1,NRHS,C,LDC,IPIV,B,LDB,INFO) IF (INFO.EQ.0) THEN print *, ' Solution Matrix X:' write(*,15) ((B(i,j),j=1,NRHS), i=1,N) END IF print *, 'ERROR CODE (must be zero): ', INFO 10 format(8F9.3) 11 format(2F9.3) 15 format(2F12.6) stop END !end of file tcgbsv.f90