bugGNU Octave - Bugs: bug #53603, 'find' incompatible with ML

 
 

bug #53603: 'find' incompatible with ML

Submitter:  Muhali <muhali>
Submitted:  Tue 10 Apr 2018 11:23:55 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.3.90 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Tue 10 Apr 2018 07:31:39 PM UTC, comment #10: 

Checked and the fix works.  Closing report.

Rik <rik5>
Group administrator
Tue 10 Apr 2018 07:09:33 PM UTC, comment #9: 

The bisect produced this cset


changeset:   23386:f1ea44e92df8
user:        John W. Eaton <jwe@octave.org>
date:        Wed Apr 12 10:04:05 2017 -0400
summary:     improve compatibility for single index indexing (bug #50776)


as you had already determined.

I started at 9:32 a.m. and finished at 12:07 a.m. so very nearly the 150 minutes I assumed.

Rik <rik5>
Group administrator
Tue 10 Apr 2018 05:43:24 PM UTC, comment #8: 

Rik: finding the cause looking at diffs was fairly fast.  It was the change in the idx_vector constructor to use make_nd_vector.  It took more time to decide what to do, and discovering a bunch of failed tests after my first attempt.  That reminded me that find (row_vector) produces a row vector, not a column.  Too many special cases!

John W. Eaton <jwe>
Group administrator
Tue 10 Apr 2018 05:42:20 PM UTC, comment #7: 

The human wins!  I'm going to continue the hg bisect for my own edification.

Rik <rik5>
Group administrator
Tue 10 Apr 2018 05:38:22 PM UTC, comment #6: 

It looks like I broke it when trying to fix this bug:

https://savannah.gnu.org/bugs/?50776

I pushed this change to fix it on stable and then merged with default:

http://hg.savannah.gnu.org/hgweb/octave/rev/2f0c0c0652d5

John W. Eaton <jwe>
Group administrator
Tue 10 Apr 2018 04:45:26 PM UTC, comment #5: 

I figured it wouldn't be that easy.  I've kicked off an hg bisect search.  It will be interesting to see which approach, brute force or human intelligence, can find the problem more quickly.

According to hg bisect it will take approximately 10 compile attempts to find the errant cset.  If I have to compile each time from scratch it will be about 30 minutes or 300 minutes total.  If I can find items in ccache then it should take 3 minutes per compile or 30 minutes total.  Those are the bounds.  As the algorithm narrows in there are fewer changes and ccache generally has most of them available so I would expect maybe 150 minutes total.

Rik <rik5>
Group administrator
Tue 10 Apr 2018 04:16:21 PM UTC, comment #4: 

I think jwe might be looking into this.

I only got as far as seeing that this bug falls in the special case for logical matrices commented in find.cc:


      else if (nargout <= 1 && n_to_find == -1 && direction == 1)
        {
          // This case is equivalent to extracting indices from a logical
          // matrix.  Try to reuse the possibly cached index vector.

          // No need to catch index_exception, since arg is bool.
          // Out-of-range errors have already set pos, and will be caught later.
          retval(0) = arg.index_vector ().unmask ();
        }


So the change is not in find.cc but maybe in octave_value::index_vector or in the idx_vector class.

Mike Miller <mtmiller>
Group Member
Tue 10 Apr 2018 04:00:33 PM UTC, comment #3: 

The find function is located in find.cc.  Using 'hlog -k find.cc' I can find the changesets which touched the file, but none of them look like they obviously would have had this effect.  The list is attached.


changeset:   25054:6652d3823428
branch:      stable
user:        John W. Eaton <jwe@octave.org>
date:        Fri Mar 30 09:19:05 2018 -0400
summary:     maint: Update copyright dates in all source files.

changeset:   24564:194eb4bd202b
user:        Rik <rik@octave.org>
date:        Sat Jan 06 07:57:19 2018 -0800
summary:     maint: Update punctuation for GPL v3 license text.

changeset:   23933:d69021d58a61
user:        John W. Eaton <jwe@octave.org>
date:        Wed Aug 02 17:16:19 2017 -0400
summary:     avoid fallthrough warnings

changeset:   23912:90689bdbe048
user:        Rik <rik@octave.org>
date:        Fri Jul 28 10:34:33 2017 -0700
summary:     Use C++11 raw string literals to avoid escaping double quotes.

changeset:   23701:b7747a2c88b2
user:        Rik <rik@octave.org>
date:        Tue Jun 13 08:24:42 2017 -0700
summary:     maint: Deprecate is_sparse_type and replace with issparse.

changeset:   23700:0cc2011d800e
user:        Rik <rik@octave.org>
date:        Tue Jun 13 07:53:53 2017 -0700
summary:     maint: Deprecate is_real_type and replace with isreal.

changeset:   23699:c3075ae020e1
user:        Rik <rik@octave.org>
date:        Mon Jun 12 21:18:23 2017 -0700
summary:     maint: Deprecate is_complex_type and replace with iscomplex.

changeset:   23698:2230f9e10fb3
user:        Rik <rik@octave.org>
date:        Mon Jun 12 17:53:28 2017 -0700
summary:     maint: Deprecate is_integer_type and replace with isinteger.

changeset:   23697:c20a0fa91c0c
user:        Rik <rik@octave.org>
date:        Mon Jun 12 17:24:08 2017 -0700
summary:     maint: Deprecate is_bool_type and replace with islogical.

changeset:   23695:80c42f4cca13
user:        Rik <rik@octave.org>
date:        Sun Jun 11 22:14:09 2017 -0700
summary:     maint: Deprecate is_empty and replace with isempty.

changeset:   23694:00e518162fda
user:        Rik <rik@octave.org>
date:        Sun Jun 11 15:35:21 2017 -0700
summary:     maint: Deprecate is_cell and replace with iscell.

changeset:   23584:30b6eccd6708
user:        John W. Eaton <jwe@octave.org>
date:        Fri Apr 28 13:52:02 2017 -0400
summary:     use builtin-defun-decls.h to ensure declarations of interpreter functions

changeset:   23580:855122b993da
user:        Rik <rik@octave.org>
date:        Thu Apr 27 17:33:10 2017 -0700
summary:     maint: Wrap tertiary operator in parentheses "(COND ? x : y)".

changeset:   23383:092078913d54
parent:      23382:95a9d6ffaecc
parent:      23119:3ac9f9ecfae5
user:        John W. Eaton <jwe@octave.org>
date:        Wed Feb 22 12:58:07 2017 -0500
summary:     maint: Merge stable to default.

changeset:   23285:ef4d915df748
parent:      23284:7485462a6924
parent:      23081:e9a0469dedd9
user:        John W. Eaton <jwe@octave.org>
date:        Mon Jan 23 14:27:48 2017 -0500
summary:     maint: Merge stable to default.



Rik <rik5>
Group administrator
Tue 10 Apr 2018 03:51:00 PM UTC, comment #2: 

Breaking this in to steps to try and isolate the issue, it is clearly find which is the problem.  Note that indexing does return a 3-D array.

Octave-4.2.1


>> x = ones (2,2,2);
>> y = x(1,2,:)
y =

ans(:,:,1) =  1
ans(:,:,2) =  1

>> find (y > 0)
ans =

   1
   2

>>


Octave-4.3.90


octave:2> x = ones (2,2,2);
octave:3> y = x(1,2,:)
y =

ans(:,:,1) =  1
ans(:,:,2) =  1

octave:4> find (y > 0)
ans =

ans(:,:,1) =  1
ans(:,:,2) =  2



Rik <rik5>
Group administrator
Tue 10 Apr 2018 03:15:00 PM UTC, comment #1: 

Octave 4.2 and earlier returned [2 1], so this is a regression in the find function from previous versions of Octave.

Mike Miller <mtmiller>
Group Member
Tue 10 Apr 2018 11:23:55 AM UTC, original submission:  

executing


x = ones(2,2,2) ;
y = find(x(1,2,:) > 0) ;
size(y)


gives different results between octave (ans=[1 1 2]) and Matlab (ans=[2 1]).

Muhali <muhali>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by muhali (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-10 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2018-04-10 jwe StatusConfirmed Ready For Test
    2018-04-10 mtmiller CategoryNone Octave Function
        Item GroupNone Regression
        StatusNone Confirmed
        Releasedev 4.3.90

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code