[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Vectorization question



Liam E. Gumley <Liam.Gumley@ssec.wisc.edu> wrote in message
39C1179A.EF9CA04E@ssec.wisc.edu">news:39C1179A.EF9CA04E@ssec.wisc.edu...
> c ...  This is the routine which does the work.
> c ...  The arguments are defined exactly the same as in the
> c ...  call_external procedure call in IDL.
>        subroutine vecadd1(a, na, x, nx, b)
>        integer*4 na, nx
>        real*4 a(na), b(nx)
>        integer*4 x(nx), i
>        do i = 1, nx
>          a(x(i)) = a(x(i)) + b(i)
>        end do
>        end

I forgot FORTRAN uses 1-based indices by default. What I *meant* to say was:

        subroutine vecadd1(a, na, x, nx, b)
        integer*4 na, nx
        real*4 a(0:na-1), b(0:nx-1)
        integer*4 x(0:nx-1), i
        do i = 0, nx - 1
          a(x(i)) = a(x(i)) + b(i)
        end do
        end

Cheers,
Liam.