bugGNU Octave - Bugs: bug #39789, Error while indexing certain cell...


bug #39789: Error while indexing certain cell expressions

Submitted by:  None
Submitted on:  Thu 15 Aug 2013 08:24:47 AM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Alexander Mamonov Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  3.6.4
Operating System:  Microsoft Windows

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 18 Jan 2016 05:03:01 PM UTC, comment #5:

@Lachlan: I checked in your fix for indexing cell expressions here (http://hg.savannah.gnu.org/hgweb/octave/rev/99d373870017). I benchmarked before/after and I couldn't detect a performance difference. One thing I did was add regression tests for this bug and bug #35841 to index.tst so that we don't accidentally re-introduce this bug if we optimize things in the future.

Rik <rik5>
Project Administrator
Wed 16 Dec 2015 01:18:23 AM UTC, comment #4:

It is even easier to resolve, although I'm not sure if the resolution is correct :)

For some reason, the function

Array<T>::index (const Array<idx_vector>& ia, bool resize_ok, const T& rfv) const

had two checks that the dimension of ia matches that of this. First, it correctly expands trailing singletons, but in the second check it doesn't.

My current work-around is to do the second test only if a resize occurs, but since I'm not sure why the test is needed at all, that may not be the right response.

This also avoids the problem of bug #35841 directly, and so the attached changeset backs that fix out (while keeping the changes to tests).

(file #35756)

Lachlan Andrew <lachlan>
Thu 26 Nov 2015 05:42:03 PM UTC, comment #3:

@Lachlan: Adding you to the CC list for this bug about cell indexing with trailing singleton dimensions. This looks awfully similar to bug #35841 which dealt with the assignment to structs with trailing singleton dimensions. You prepared the changeset for that here http://hg.savannah.gnu.org/hgweb/octave/rev/96163bdd2ea1. Could you take a look and see if it is equally easy to resolve?

Rik <rik5>
Project Administrator
Sun 25 Aug 2013 08:33:40 AM UTC, comment #2:

Looks like the issue is with octave failing to allow the second level of indexing in this case. In matlab:
in octave:

Ben Kurtz <bkurtz>
Tue 20 Aug 2013 05:08:25 AM UTC, comment #1:

Confirmed on a recent development tip (hg id bc924baa2c4e). The issue is with how trailing dimensions are treated, and it would be useful to know how Matlab behaves for the same code input if you have access to it.

The code

does not create a 1x1x1 cell array. In Octave and Matlab trailing singleton dimensions are usually removed so this becomes

This can be checked with

Your code sample works if the cell array is truly 3-dimensional.

Rik <rik5>
Project Administrator
Thu 15 Aug 2013 08:24:47 AM UTC, original submission:

When executing the following cell assignment

Octave gives an error:

error: a cs-list cannot be further indexed
error: assignment failed, or no method for 'cell = range'

Expected behavior is for c{1,1,1} to assume value
[1, 0; 1, 0; 1, 0; 1, 0; 1, 0]

If this bug is fixed, please add a relevant test to the test suite.



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

Attach Files:

Attached Files
file #35756:  bug_39789.cset added by lachlan (3KiB - application/octet-stream)
file #28848:  testcell111.m added by None (64B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by lachlan (Updated the item)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-01-18 rik5 StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
    2015-12-16 lachlan Attached File- => Added bug_39789.cset, #35756
    2015-11-26 rik5 Carbon-Copy- => Added lachlan
    2013-08-20 rik5 StatusNone => Confirmed
    2013-08-15 None Attached File- => Added testcell111.m, #28848

    Back to the top

    Powered by Savane 3.3