double precision function amult(a,b,c,n,v,i) implicit none integer i,n real*8 a,b,c,v,sum dimension v(*) c *** Function multiplies banded tridiagonal matrix to formed by scalars c *** a (on diagonal), b (on subdiagonal) and c (on superdiag) and returns the c *** value of the i-th component of the product. sum = 0.d0 if(i.eq.1) then sum = sum + a*v(1) + c*v(2) endif if(i.gt.1.and.i.lt.n) then sum = sum + a*v(i) + + b*v(i-1)+c*v(i+1) endif if(i.eq.n) then sum = sum + a*v(n) + b*v(n-1) endif amult = sum return end