bugGNU Octave - Bugs: bug #32591, matrix type confusion in cellfun

 
 

bug #32591: matrix type confusion in cellfun

Submitter:  Thorsten Meyer <tmeyier>
Submitted:  Thu 24 Feb 2011 08:36:01 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Thorsten Meyer Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 13 Dec 2011 09:39:02 PM UTC, comment #4: 

I've just built octave freshly fetched from mercurial. I also cannot reproduce the original problem. Apparently, it has been fixed meanwhile. I'm closing this bug.

thanks.

Thorsten

Thorsten Meyer <tmeyier>
Tue 13 Dec 2011 06:50:28 PM UTC, comment #3: 

Can you re-verify the problem behavior with a recent development tip?  I tried the original problem code


y=[1,2,3;4,5,6;7,8,9];
cellfun(@(x) y(x,1), {1,2,3}, "uniformoutput", false)


and it works without error.  This is with the following Mercurial tip:

parent: 14042:57e19c30b7d6 tip
 assume "all" "on" if "all" is not present in warning_state structure (bug #35050)
branch: stable


Rik <rik5>
Group administrator
Wed 06 Apr 2011 02:47:55 PM UTC, comment #2: 

And the problem is around line 1846 in src/ov-fcn-handle.cc


if (head_id->is_defined ())
   root_val = head_id->rvalue1 ();


If you give up the optimization and put


if (head_id->is_defined ())
   bad = true;


then everything works again. I hope this helps someone else to make a proper fix.

Marco

Marco Caliari <caliari>
Group Member
Wed 06 Apr 2011 07:27:07 AM UTC, comment #1: 

I confirm the bug. I'm pretty sure it is due to binders optimization (changeset http://hg.savannah.gnu.org/hgweb/octave/rev/409ceee18acc), but my knowledge of C/C++ is not enough to fix it.

Marco

Marco Caliari <caliari>
Group Member
Thu 24 Feb 2011 08:36:01 PM UTC, original submission:  

Hi,

I found the following bug in cellfun:

y=[1,2,3;4,5,6;7,8,9];
cellfun(@(x) y(x,1), {1,2,3}, "uniformoutput", false)

gives the error message:
"error: can't perform indexing operations for matrix type"

Strangely, these two lines work nicely:

cellfun(@(x) y(x(1),1), {1,2,3}, "uniformoutput", false)
cellfun(@(x) y(x*1,1), {1,2,3}, "uniformoutput", false)


Also, these two lines give the same result (3 cell rows of "scalar"):

cellfun(@(x) typeinfo(x), {1,2,3}, "uniformoutput", false)
cellfun(@(x) typeinfo(1*x), {1,2,3}, "uniformoutput", false)


The bug must have been introduced sometime between july 2010 and october 2010 (based on old development builds I still happen to have around).

regards

Thorsten


Thorsten Meyer <tmeyier>

 

(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 rik5 (Posted a comment)
  • -email is unavailable- added by jordigh (Updated the item)
  • -email is unavailable- added by caliari (Posted a comment)
  • -email is unavailable- added by tmeyier (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-12-13 tmeyier StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2011-12-13 rik5 StatusPatch Submitted Need Info
    2011-04-06 jordigh StatusNone Patch Submitted

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code