Hello,

Thank you all for your kind reply to my questions! Your replys are really
helpful to me.

I am sorry that some things were unclear in my questions. I will clarify
them here.

1. I intentionally use "a" on both the left and right side and use the
average value for a(i-1) to compute the value for a(i). I want to see if J has
any convenient way to implement this kind of recursively defined arrays.

2. Somebody already pointed out that this subroutine defines a simple
convolution. This one actually does not have any practical use. In practice
we use more complicated convolutions such as the Markovian Convolution in Time, 
which is basically similar to this one. If this simple convolution can be 
implemented in J, I believe that the Markovian convolution and other 
convolution tools we use
can also be implemented in J.

3. The program convolves in the first dimension, which represents the time
dimension. Suppose that I always want to convolve in the time dimension,
but the time dimension might be different dimensions in arrays. For example,
the following code shows the program that does the convolution in the 2nd 
dimension for a 2 dimensional array.

subroutine avg1d(T, a)
  integer :: T
  real, dimension (1:100, 0:T) :: a
  integer :: t
  integer :: i1
  do i1 = 1, 100
    do t = 1, T-1
      a(i1,t) = (a(i1,t-1)+a(i1,t)+a(i1,t+1))/3
    end do
  end do
end subroutine avg1d

I am wondering if the program can be implemented in J that is generic with 
respect
to the position of the time dimension.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to