| |
(1) |
A subroutine for two-dimensional filtering is cinlof()
from PVI.
That subroutine handles any number of columns
so we would limit it to two columns by making the choice a2=2.
This routine is overly general for the task at hand,
but it is a well tested starting place.
With cinlof()
the filter stops before it runs off the end of the data
so there are no edge transients and as a necessary byproduct,
the output space is somewhat smaller than the input space.
Also, the output aligns with the input under the coefficient
that is constrained (in autoregression) to unity.
# CINLOF -- Convolution INternal with Lags. Output is conjugate with FILTER.
#
subroutine cinlof( conj, add, lag1,lag2, n1,n2,xx, nb1,nb2,bb, yy)
integer conj, add, lag1,lag2, n1,n2, nb1,nb2
real xx(n1,n2), bb(nb1,nb2), yy(n1,n2)
integer y1,y2, x1,x2, b1, b2
call conjnull( conj, add, bb,nb1*nb2, yy,n1*n2)
if( conj == 0 )
do b2=1,nb2 { do y2= 1+nb2-lag2, n2-lag2+1 { x2= y2 - b2 + lag2
do b1=1,nb1 { do y1= 1+nb1-lag1, n1-lag1+1 { x1= y1 - b1 + lag1
yy(y1,y2) = yy(y1,y2) + bb(b1,b2) * xx(x1,x2)
}} }}
else
do b2=1,nb2 { do y2= 1+nb2-lag2, n2-lag2+1 { x2= y2 - b2 + lag2
do b1=1,nb1 { do y1= 1+nb1-lag1, n1-lag1+1 { x1= y1 - b1 + lag1
bb(b1,b2) = bb(b1,b2) + yy(y1,y2) * xx(x1,x2)
}} }}
return; end