bugGNU Octave - Bugs: bug #32296, matlabbatch: equivalent subscript...

 
 

bug #32296: matlabbatch: equivalent subscript assignments produce unequal results

Submitted by:  Volkmar Glauche <glauche>
Submitted on:  Sun 30 Jan 2011 09:16:59 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: ConfirmedAssigned to: None
Originator Name: Open/Closed: Open
Release: devOperating System: GNU/Linux

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Tue 21 Jan 2014 01:59:50 PM UTC, comment #7:

Thanks for proofing, trying again:

Mike Miller <mtmiller>
Project Member
Tue 21 Jan 2014 08:28:09 AM UTC, comment #6:

The code excerpt given is from a batch configuration and job management system used e.g. by Statistical Parametric Mapping (SPM), a MATLAB software that is used widely in brain imaging and data analysis. While development is focused on MATLAB, SPM developers would like to support Octave as well. Most of the algorithms implemented in SPM run fine on Octave, but the batch system as a major part of the command line user interface to SPM does not.

I understand that there seems to be an incompatibility between MATLAB and Octave when dispatching to the correct subsasgn/subsref methods for @-objects. MATLAB also has difficulties there, which have been resolved by the cfg_callbuiltin.m function.

For SPM, it would be necessary to get the same subsasgn/subsref behaviour in both MATLAB and Octave. If this can't be fixed easily in Octave itself, I would be open to suggestions to work around this problem.

Best, Volkmar

PS@Mike:

your comment #5 seems to be truncated on the web page for this bug compared to the email.

Volkmar Glauche <glauche>
Tue 21 Jan 2014 07:06:54 AM UTC, comment #5:

Yes, the example with the provided class definitions still shows the reported problem in the current development version. Here's another way of looking at the symptom:

Mike Miller <mtmiller>
Project Member
Mon 20 Jan 2014 09:28:20 AM UTC, comment #4:

I've compiled an excerpt from my original project containing the relevant .m files only. See matlabbatch_extract.tgz attached. Although there are multiple classes (cfg_repeat, cfg_exbranch, cfg_branch) derived from cfg_item, all share the same subsasgn/subsref logic.

Things seem to go wrong whenever one of the class subsasgn/subsref methods call cfg_callbuiltin to dispatch subscript reference/assignment calls.

The example code from the original submission still produces this problem in octave 3.6.4.

Steps to test:

1. Unpack matlabbatch_extract.tgz into new folder
2. add this folder to octave's path
3. run the code lines from the original bug submission

cr and cr1 should have the same contents, especially the cfg_exbranch objects in cr.values{1} and cr1.values{1} should have the same contents. cr is the reference object, information is lost when assigning cr1.values{1}.tag.

I did not yet try octave 3.8 or a current developer release, but would be happy to do so if there might be a chance that the problem has been resolved.

(file #30316)

Volkmar Glauche <glauche>
Mon 20 Jan 2014 12:15:02 AM UTC, comment #3:

It would be nice if there was a simple example pasted or attached to this report to reproduce this error. Setting status to "need info" for now, I don't know how to test if this still affects the current development version.

Mike Miller <mtmiller>
Project Member
Mon 31 Jan 2011 11:17:58 AM UTC, comment #2:

Calling subsasgn via builtin is actually required by MATLAB to figure out correctly which method to call.
Anecdotally, the way this is done (outside any object method using the static cfg_callbuiltin) works around a problem in MATLAB, where builtin() called from an object method does not determine the correct subsasgn method as well...

Volkmar Glauche <glauche>
Mon 31 Jan 2011 10:48:58 AM UTC, comment #1:

Jaroslav, I'm copying you on this report because you have worked on this part of Octave much more than I have lately, so I'm hoping you will have some insight here.

It seems that this problem is related to the following change:

http://hg.savannah.gnu.org/hgweb/octave/rev/b2b8ed43b922

which was made in response to the following bug report:

https://mailman.cae.wisc.edu/pipermail/help-octave/2009-April/034731.html

The change added a check to see whether octave_value::subsasgn was called from the "builtin" function, and if so, the subsasgn method lookup is skipped. Maybe this was not the right fix, but it avoided the reported problem.

In your case, the cfg_repeat and cfg_exbranch subsasgns call subsasgn using the "builtin" function, but they should perform the method lookup, and if they do, I think Octave does the right thing for your code.

However, simply removing the check for called_from_builtin in subsasgn brings back the earlier problem.

So I don't know how to solve both problems at the same time. What is the appropriate check that should be made here to avoid the recursion in one case and to allow the method lookup when it is needed?

John W. Eaton <jwe>
Project Administrator
Sun 30 Jan 2011 09:16:59 PM UTC, original submission:

Using matlabbatch (see bug #32261) objects, the following commands should produce two identical objects cr and cr1:

The only difference is that the contents of cr.values{1} is created as a separate object in workspace before it is assigned, while the contents of cr1.values{1} is assigned 'on-the-fly'. In MATLAB,

returns true, while octave returns false. Octave should return true as well. As far as I can tell, cr is the correct result, while cr1 is not created correctly.

Volkmar Glauche <glauche>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #30316:  matlabbatch_extract.tgz added by glauche (14kB - application/x-gtar)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by jwe
  • -unavailable- added by glauche (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 21 Jan 2014 07:06:54 AM UTCmtmillerStatusNeed Info=>Confirmed
    Mon 20 Jan 2014 09:28:20 AM UTCglaucheAttached File-=>Added matlabbatch_extract.tgz, #30316
    Mon 20 Jan 2014 12:15:02 AM UTCmtmillerCategoryNone=>Octave Function
      StatusNone=>Need Info
    Mon 31 Jan 2011 10:48:58 AM UTCjweCarbon-Copy-=>Added highegg

    Back to the top


    Powered by Savane 3.1-cleanup