octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #44027] Assign new quaternion outside current


From: Willem Atsma
Subject: [Octave-bug-tracker] [bug #44027] Assign new quaternion outside current range / interaction subsasgn and cellfun
Date: Fri, 16 Jan 2015 23:56:15 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0

URL:
  <http://savannah.gnu.org/bugs/?44027>

                 Summary: Assign new quaternion outside current range /
interaction subsasgn and cellfun
                 Project: GNU Octave
            Submitted by: tanglebridge
            Submitted on: Fri 16 Jan 2015 11:56:14 PM GMT
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.8.2
        Operating System: GNU/Linux

    _______________________________________________________

Details:

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




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 16 Jan 2015 11:56:14 PM GMT  Name: cellfun_subsasgn_bug.diff  Size:
13kB   By: tanglebridge
Patch with fix
<http://savannah.gnu.org/bugs/download.php?file_id=32854>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?44027>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]