octave-maintainers
[Top][All Lists]
Advanced

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

Re: purpose of 10486:4e64fbbd5c58


From: John W. Eaton
Subject: Re: purpose of 10486:4e64fbbd5c58
Date: Fri, 7 May 2010 17:36:39 -0400

I thought I sent the following message yesterday, but found it in an
Emacs buffer, apparently unsent.


  On  6-May-2010, Jaroslav Hajek wrote:

  | Now I'm getting this:
  | 
  | octave:1> (1:10)(1.1:10.1)
  | error: rounding non-integer range used as index to nearest integer
  | 
  | This error message is really confusing.

  OK, I agree.  I've changed it as you suggested.

  | Further, the following no longer works:
  | 
  | a = rand (1, 10);
  | idx = 1.1:10.1;
  | 
  | try
  |   b = a(idx);
  | catch
  |   [err, id] = lasterr ();
  |   if (any (strcmp (id, {"Octave:invalid-index", 
"Octave:index-out-of-bounds"})))
  |     disp ("indexing error occured");
  |   else
  |     rethrow (lasterror);
  |   endif
  | end_try_catch

  What is special about these two error IDs that they are the only two
  which can indicate an indexing error?

  | I think my original solution was better in that it left the normal
  | behavior intact. If you really insist on the warning ID solution, I
  | think the message should be just "non-integer range used as index".
  | 
  | I propose to revert 10605:1834132fb50b and apply the patch I sent
  | earlier (after completing it).

  What was left to do to complete it?

  The reason I chose the warning ID solution was that I thought it would
  have the same effect but would avoid introducing a new internal
  variable.

  jwe


Also, you mentioned the performance of isindex.  Is the isindex
function often used in places where performance is critical?

In any case, now I've added the new internal variable, so it should be
fast again.

jwe


reply via email to

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