program appel_dgtsv implicit double precision (a-h,o-z) parameter (nmax=1000) dimension dl(nmax-1),d(nmax),du(nmax-1),b(nmax) c c initialisations c n=10 do 10 i=1,n-1 dl(i) =-1. d(i) = 2. du(i) =-1. b(i) = 1. 10 continue d(n) =2. b(n) =1. c c appel de DGTSV (LAPACK) c call dgtsv(n,1,dl,d,du,b,n,info) c c resultats c if (info.eq.0) then do 20 i=1,n print*,' i ',i,' b(i) ',b(i),' erreur ',b(i)-i*(n+1-i)/2. 20 continue end if endVoilà le résultat du programme :
i 1 b(i) 4.999999999999999 erreur -8.8817841970012523E-16 i 2 b(i) 8.999999999999998 erreur -1.7763568394002505E-15 i 3 b(i) 12.00000000000000 erreur -1.7763568394002505E-15 i 4 b(i) 14.00000000000000 erreur 0.0000000000000000E+00 i 5 b(i) 15.00000000000000 erreur 0.0000000000000000E+00 i 6 b(i) 15.00000000000000 erreur 1.7763568394002505E-15 i 7 b(i) 14.00000000000000 erreur 0.0000000000000000E+00 i 8 b(i) 12.00000000000000 erreur 0.0000000000000000E+00 i 9 b(i) 9.000000000000000 erreur 0.0000000000000000E+00 i 10 b(i) 5.000000000000000 erreur 0.0000000000000000E+00
EPFL-IACS-ASN