octave-maintainers
[Top][All Lists]
Advanced

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

Re: indexing improvements - advice wanted


From: John W. Eaton
Subject: Re: indexing improvements - advice wanted
Date: Wed, 29 Oct 2008 13:54:14 -0400

On 28-Oct-2008, Jaroslav Hajek wrote:

| The updated patch is uploaded, this time passing the test suite.
| There were no flawed tests, after all - they were all bugs in my code.
| So, the only changes in tests are caused by the different error
| messages.

I don't care about error messages changing from one version to the
next.

I have some more things to try, but so far these changes seem to be
producing the same results as the older code.

| Of course, the presented speed-up numbers do still hold.

Those are impressive speedups, and the code looks much cleaner.

| Unless anyone objects, I'd like to apply this after 3.2.x is forked.

Is there any objection to applying it now?  I don't expect 3.2 will be
released before making a number of snapshots, and we would likely get
feedback about any indexing problems before the release.  From the
looks of things, it would probably be easier to fix any indexing bugs
in the new code than it was in the old.

You have the following comments in the Array<T>::index (const
Array<idx_vector>& ia) const function:

  // FIXME: is this dispatching necessary?
  if (ial == 1)
    retval = index (ia(0));
  else if (ial == 2)
    retval = index (ia(0), ia(1));

and a similar one in the Array<T>::assign (const Array<idx_vector>&
ia, const Array<T>& rhs, const T& rfv) function:

  // FIXME: is this dispatching necessary / desirable?
  if (ial == 1)
    assign (ia(0), rhs, rfv);
  else if (ial == 2)
    assign (ia(0), ia(1), rhs, rfv);
  else if (ial > 0)

What is the speed comparison for one- and two-index expressions when
handled with the generic N-index function?  Unless there is a major
slowdown, I would be in favor of having only one function to do the
actual indexing, though we could preserve specialized one- and
two-index functions for backward compatibility.

Maybe we should also introduce some functions like

  Array<T>
  Array<T>::operator () (const idx_vector& i) const;

  Array<T>
  Array<T>::operator () (const idx_vector& i, const idx_vector& j) const;

  ...

so that we can write things like

  Array<T> ra1 (...);
  octave_idx_type i, j;
  ...
  Array<T> ra2 = ra1(i,j);

?

jwe


reply via email to

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