help-octave
[Top][All Lists]
Advanced

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

Using functions from octave_base_value on class defined in .m files ?


From: CdeMills
Subject: Using functions from octave_base_value on class defined in .m files ?
Date: Tue, 23 Nov 2010 00:05:55 -0800 (PST)

Hello,
the dataframe class made substantial progress, I have now an overloaded
'sum', 'sumsq', and 'sort' functions. This way, basic statistic functions
like 'mean', 'median', and 'var' can be used directly on dataframes. 

Now I'm stuck with 'std', which requires to take the square root of the
variance. As a dataframe mimics as far as it can a matrix, is it possible to
get the set of functions from class octave_base_value (sin, sqrt, ...) to be
applied on a dataframe without having to redefine a wrapper such as
@dataframe/sin.m for each of them ?
Basically, the body of the overloaded function should be like:
function resu = sin(df)
  resu = df;
    for indi = 1:resu._cnt(2),
       resu._data{indi} = builtin('sin', df._data{indi})
   endfor
endfunction
Now, it is possible to make this approach generic AND to define all the
mapping at once, instead of having a lot of small .m files ? I already
looked at 'dispatch' doc. Also, how to call a specific function from the
dataframe class, I mean a function which is not overloading something else ?

Regards

Pascal
-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/Using-functions-from-octave-base-value-on-class-defined-in-m-files-tp3054965p3054965.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

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