bugGNU Octave - Bugs: bug #44027, [octave forge] (quaternion) Assign...

 
 

bug #44027: [octave forge] (quaternion) Assign new quaternion outside current range / interaction subsasgn and cellfun

Submitted by:  Willem Atsma <tanglebridge>
Submitted on:  Fri 16 Jan 2015 11:56:14 PM UTC  
 
Category: Octave Forge PackageSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: NoneAssigned to: None
Originator Name: Open/Closed: Open
Release: 3.8.2Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 16 Jan 2015 11:56:14 PM UTC, original submission:

This relates to the quaternion toolbox, both 2.2.2 release and the current branch head.

This following fails:

Note that the absence of the ";" at the end of the 2nd line is important. This reason is complicated and originates with the use of cellfun in all cat functions and a few others.

When using cellfun the system first calls the constructor on the arguments as desired. Next it calls subsasgn to handle asignment.The LHS argument "q" ends up being a cs-list (with two empty elements) to match the uniform output list to be created.
This is a problem because the quaternion class stores its data as matrices assigned to fields, and not as arrays of structs.

To fix this I would have to concatenate each field in turn (e.g. q.w = [q.w]) but this is basically a circular argument since I need a cat function to make the use of cellfun work in a cat function.

The attached patch implements a fix which avoids the cs-list by selecting non-uniform output, and the first line simply ensures all arguments are quaternions. A number of test cases was added to various functions. Updates were made to:
@quaternion/blkdiag.m
@quaternion/cat.m
@quaternion/horzcat.m
@quaternion/plus.m
@quaternion/size.m
@quaternion/subsasgn.m
@quaternion/vertcat.m
test_quaternion.m

Willem Atsma <tanglebridge>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #32854:  cellfun_subsasgn_bug.diff added by tanglebridge (13KiB - text/x-patch - Patch with fix)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Updated the item)
  • -unavailable- added by tanglebridge (Maintainer)
  • -unavailable- added by tanglebridge (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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 13 Aug 2017 01:34:07 PM UTCjweSummaryAssign new quaternion outside current range / interaction subsasgn and cellfun=>[octave forge] (quaternion) Assign new quaternion outside current range / interaction subsasgn and cellfun
    Sat 17 Jan 2015 06:17:45 PM UTCtanglebridgeCarbon-Copy-=>Added -unavailable-
    Fri 16 Jan 2015 11:56:14 PM UTCtanglebridgeAttached File-=>Added cellfun_subsasgn_bug.diff, #32854

    Back to the top


    Powered by Savane 3.1-cleanup1