program bande c implicit none integer MMAX parameter (MMAX=100) integer i,j,M double precision AB(MMAX+1,MMAX*MMAX), B(MMAX*MMAX) integer NRHS,N,KD,LDAB,INFO c c initialisations c M=5 NRHS=1 N=M*M KD=M LDAB=MMAX+1 c c remplissage de la matrice : mise a zero c do 10 i=1,N do 10 j=1,M+1 AB(j,i) = 0. 10 continue c c remplissage des 3 diagonales c do 20 i=1,N AB(1,i) = 4. AB(2,i) = -1. AB(M+1,i)= -1. 20 continue c c mise a zero des coefficients dans la 2e diagonale c do 30 i=1,M AB(2,i*M) = 0. 30 continue c c remplissage du second membre c do 40 i=1,N B(i) = 0. 40 continue do 50 i=1,M B(i) = B(i) + i 50 continue do 60 i=1,M B(M*(i-1)+1) = B(M*(i-1)+1) + i 60 continue do 70 i=1,M B(M*(i-1)+M) = B(M*(i-1)+M) + M+1+i 70 continue do 80 i=1,M B(M*(M-1)+i) = B(M*(M-1)+i) + i+M+1 80 continue c c appel de DPBSV c call DPBSV('L', N, KD, NRHS, AB, LDAB, B, N, INFO) c c impression du resultat c do 90 i=1,M do 90 j=1,M write(*,1000)M*(i-1)+j,B(M*(i-1)+j),B(M*(i-1)+j)-(i+j) 90 continue 1000 format('index: ',i5,' computed: ',F9.6,' error: ',E15.6) endVoilà le résultat du programme :
index: 1 computed: 2.000000 error: -0.444089E-15 index: 2 computed: 3.000000 error: -0.888178E-15 index: 3 computed: 4.000000 error: -0.888178E-15 index: 4 computed: 5.000000 error: -0.888178E-15 index: 5 computed: 6.000000 error: 0.000000E+00 index: 6 computed: 3.000000 error: -0.888178E-15 index: 7 computed: 4.000000 error: -0.444089E-15 index: 8 computed: 5.000000 error: -0.177636E-14 index: 9 computed: 6.000000 error: 0.000000E+00 index: 10 computed: 7.000000 error: -0.888178E-15 index: 11 computed: 4.000000 error: -0.444089E-15 index: 12 computed: 5.000000 error: -0.888178E-15 index: 13 computed: 6.000000 error: -0.888178E-15 index: 14 computed: 7.000000 error: 0.888178E-15 index: 15 computed: 8.000000 error: -0.888178E-15 index: 16 computed: 5.000000 error: 0.888178E-15 index: 17 computed: 6.000000 error: 0.000000E+00 index: 18 computed: 7.000000 error: -0.177636E-14 index: 19 computed: 8.000000 error: -0.177636E-14 index: 20 computed: 9.000000 error: 0.000000E+00 index: 21 computed: 6.000000 error: -0.888178E-15 index: 22 computed: 7.000000 error: -0.888178E-15 index: 23 computed: 8.000000 error: -0.177636E-14 index: 24 computed: 9.000000 error: -0.177636E-14 index: 25 computed: 10.000000 error: 0.000000E+00EPFL-IACS-ASN