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

 
 

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

Submitter:  Willem Atsma <tanglebridge>
Submitted:  Fri 16 Jan 2015 11:56:14 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * other Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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:


q = quaternion(1);
q(2) = quaternion(2)


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 Files:
   
   
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
  • -email is unavailable- added by mtmiller (Updated the item)
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by tanglebridge (Maintainer)
  • -email is unavailable- added by tanglebridge (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
    2018-05-01 mtmiller Release3.8.2 other
    2017-08-13 jwe SummaryAssign new quaternion outside current range / interaction subsasgn and cellfun [octave forge] (quaternion) Assign new quaternion outside current range / interaction subsasgn and cellfun
    2015-01-17 tanglebridge Carbon-Copy- Added -email is unavailable-
    2015-01-16 tanglebridge Attached File- Added cellfun_subsasgn_bug.diff, #32854

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code