Q. Subsequent statements set every element of matrix?
Let a= [2,4,6,8,10], b=[1,3,5,7,9], c=[0,0,0,0,0]
Consider the subsequent program section
FORALL (i = 2:4)
a(i) = a(i-1)+a(i+1)
c(i) = b(i) *a(i+1).
END FORALL
The calculations would be:
a[2] =a[1]+a[3] =2+6=8
a[3] =a[2]+a[4] =4+8=12
a[4] =a[3]+a[5] = 6+10=16
c[2] = b[2] *a[3] = 3*12=36
c[3] = b[3] *a[4] = 5*16=80
c[4] = b[4] *a[5] =7*10=70
So output is
a= [2,8,12,16,10], b=[1,3,5,7,9], c=[0,36,80,70,0]