octave-maintainers
[Top][All Lists]
Advanced

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

classes issues with core functions


From: CdeMills
Subject: classes issues with core functions
Date: Sat, 13 Jul 2013 01:16:18 -0700 (PDT)

Hello,

as discussed in the previous days, I ported the mptoolbox to Octave, this is
now the multi-precision package.
Up to now, simple algorithms do work, I f.i. computed one thousand decimals
of pi.

Things complicate when trying to use more generic core functions. A few
examples:
a)
- x = zeros([1 mp(5)]) creates a 1x5 matrix, using @mp/zeros.m which is an
overloaded function
- x = zeros([1 5], 'mp') fails with error: zeros: invalid data type
specified
b)
x = filter([1 2 3], 1, mp([4 5 6])
error: octave_base_value::array_value(): wrong type argument 'class'
c)
for ii = (1:mp(4)) disp(ii); end
error: invalid type in for loop expression

For a), the issue is that the core "zeros" does not try to dispatch the
handling to @mp/zeros. For b), there is a working 'subsref' For c), there is
a 'colon' implementation which returns a mp, but it can't be used as loop
value. 

I also spotted an issue with 'diag' not working on struct arrays

I guess the solution is to create the mp object inside C++ code and register
this new type to make it a full rank, well-behaved Octave citizen ? Are
there examples of code using this approach that I can use as a source of
inspiration ?
But this also opens a new issue. "mp" is a struct above mpfr_t objects.
Should I keep the actual representation as struct array, or move everything
to mpfr_t objects (and rewrite all the glue code) ?

TIA

Pascal



--
View this message in context: 
http://octave.1599824.n4.nabble.com/classes-issues-with-core-functions-tp4655581.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.


reply via email to

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