Martin Larsen on Sun, 13 Nov 2005 17:31:41 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Little problems |
Yes, I also suspected the looping method - but wouldn't it be more intuitive to have j as inner loop?This is because we first loop on i and then on j: Try instead: matrix(6,6,j,i,a[i+1,j+1]=a[i,j]+3*a[i,j+1]+2*a[i,j+2])~ With matrix(6,6,i,j,a[i+1,j+1]=a[i,j]+3*a[i,j+1]+2*a[i,j+2]), we do: a[2,2]=a[1,1]+3*a[1,2]+2*a[1,3] a[3,2]=a[2,1]+3*a[2,2]+2*a[2,3] a[4,2]=a[3,1]+3*a[3,2]+2*a[3,3] a[5,2]=a[4,1]+3*a[4,2]+2*a[4,3] a[6,2]=a[5,1]+3*a[5,2]+2*a[5,3] a[7,2]=a[6,1]+3*a[6,2]+2*a[6,3] a[2,3]=a[1,2]+3*a[1,3]+2*a[1,4] a[3,3]=a[2,2]+3*a[2,3]+2*a[2,4] So a[3,2] depends on a[2,3] which will be computer after. Does it explain your problem ?
Cheers Martin