octave-maintainers
[Top][All Lists]
Advanced

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

Re: octave "Most Wanted" feature


From: John W. Eaton
Subject: Re: octave "Most Wanted" feature
Date: Tue, 28 Nov 2006 16:15:35 -0500

I don't really have time for this discussion at the moment, but I
would like to point out that it in Fortran, it is possible to write

      program foo
      real x(11)         ! It goes to 11!
      do i = 1, 101
        x(i) = i
      enddo
      call bar (x)
      end
      subroutine bar (x)
      real x(-5:5)
      do i = -5, 5
        print *, i, x(i)
      enddo
      return
      end

The output of running the program is soemthing like this:

   -5  1.
   -4  2.
   -3  3.
   -2  4.
   -1  5.
   0  6.
   1  7.
   2  8.
   3  9.
   4  10.
   5  11.


You definitely do NOT want to set a global index base, but I think it
would be acceptable to set a local index base for a given variable,
the same as it works in Fortran.  In that case, yes, you can have
different index bases for each dimension of a multidimensional array.
It makes perfect sense to be able to do this kind of thing (think
about points on a grid going from x_min to x_max and y_min to y_max).
I don't see how changing the index base could cause trouble since the
change in indexing would only affect the variable in the local scope.
The default value would remain 1.  But even so, I've not given it a
lot of thought, and suspect there would be some problems in the
details of implementing a feature like this.

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]