Dear Sven and Allin,
Thanks for the reply. I am not sure whether I understood your comments
correctly.
Let me post some more stuff of the code:
----------------------------------------------
function matrix mplier(scalar a, matrix b, matrix varphi, matrix vpi,
scalar l, scalar h, scalar k)
vphi = zeros(1,l)
vphi[1] = 1 + a + varphi[1]
loop for (i=2; i=l-1; i+=1)
vphi[i] = varphi[i] - varphi[i-1]
endloop
vphi[l] = -varphi[l-1]
mtheta = zeros(l+1,k)
mtheta[1,] = vpi[1,]
mtheta[2,] = vpi[2,] - vpi[1,] + b
loop for (i=3; i=l; i+=1)
mtheta[i,] = vpi[i,] - vpi[i-1,]
endloop
mtheta[l+1,] = -vpi[l-1,]
mpsi = zeros(h,k)
mpsi[1,] = mtheta[1,]
loop for (i=1; i=l; i+=1)
mpsi[1+i,] = vphi[1:i]*mpsi[i:1,] + mtheta[1+i,]
endloop
mpsi[1+1,] = vphi[1:1]*mpsi[1:1,] + mtheta[1+1,] #run the loop manually
mpsi[2+1,] = vphi[1:2]*mpsi[2:1,] + mtheta[2+1,] #run the loop manually
mpsi[3+1,] = vphi[1:3]*mpsi[3:1,] + mtheta[3+1,] #run the loop manually
loop for (i=l+1; i=h-1; i+=1)
mpsi[i+1,] = vphi*mpsi[i:i-l+1,]
endloop
end function
-----------------------------------------------
The first two blocks run fine and I obtain the same results as in
gauss. The third block makes trouble. The corresponding Gauss code -
which works fine - for the third block is:
GAUSS-------------------------------
mpsi = zeros(h,k) ;
mpsi[1,.] = mtheta[1,.] ;
for i (1,l,1) ;
mpsi[i+1,.] = vphi[1:i]*mpsi[i:1,.] + mtheta[i+1,.] ;
endfor ;
for i (l+1,h-1,1) ;
mpsi[i+1,.] = vphi*mpsi[i:i-l+1,.] ;
endfor ;
----------------------------------------
There I dont obtain an error running the loop. I am really not sure
how to translate the GAUSSian code lines into proper gretl-language.
The mreverse command did not help really.
Best,
Artur