help-octave
[Top][All Lists]
Advanced

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

Re: classdef ready for testing with qtfm (quaternions for matlab)?


From: Michael Goffioul
Subject: Re: classdef ready for testing with qtfm (quaternions for matlab)?
Date: Thu, 18 Dec 2014 08:02:38 -0500

On Sun, Dec 14, 2014 at 11:51 AM, Wolfgang Rosner <address@hidden> wrote:
Dear developers,

I am looking for a hypercomplex library for octave.

there is a matlab-package here
http://qtfm.sourceforge.net/

but it uses the evil "classdef"  syntax.

I tried with octave 4.1.0+ from
http://hg.savannah.gnu.org/hgweb/octave/branches
download 2014-12-13

but could not get qtfm working.
Using the new gui (great :-) ) debugger, it looks to me like new quaternions
were constructed as intended, but upon leaving the constructor, the hidden
private variables (w, x, y, z) appear to be forgotten.

I can inspect q.x etc while debugging in the constructor.
I cannot inspect them in the caller.
whos reports a object size of 0 after leaving the caller


snippet from test log
--------8<----------------------------------------------------

9: q = quaternion(1, 0, 0);
debug>
class: quaternion
method block
constructor: quaternion
property block
property: w
property default:
property: x
property default:
property: y
property default:
property: z
property default:
constructor
deleting quaternion object (value)
ans = quaternion object
>> whos
Variables in the current scope:

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  =====
        ans         1x1                          0  quaternion

Total is 1 element using 0 bytes

--------8<----------------------------------------------------


I have only basic experience in octave / OO Programming, so this may well be a
beginners mistake.
Or did I jump right in the middle of a running process of classdef
development, with still a long way to go for maturity?
I can contribute by feedback my testing experience, if there is a reasonable
chance for success.
If so, can you give me a pointer to start?

People have been asking for funding development. I can't afford to pay all the
development, but I could contribute to some kind of crowdfunding pool.

The alternative is to rewrite the classdef stuff to well-tried octave syntax.
Is there a kind of howto -like receipe?
There are only 2 directories @octonion and @quaternion.
So do I only have to rewrite the two constructors there
@octonion/octonion.m
and
@quaternion/quaternion.m
can all the other methods stay in place?
What about private subdirectories?

Any help appreciated.
I promise to share my experience if it works.


From the session output above, it looks like you're using an older version of the classdef code. Did you use the "classdef" branch by any chance? The classdef branch has been merged into the default one, so you should use that one instead. I've tried the qtfm toolbox in my current octave and the object is created successfully. However, you'll face other problems as qtfm uses constructs that are not supported yet [1].

[1] The class has both a property and a method called 'x',  the method simply returning "q.x", leading to an max recursion depth error. While executing the "x" method, octave will resolve "q.x" to the method, and not to the property. Personally, I find the construct error-prone: it would have been better to make the property public, but read-only.


reply via email to

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