[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: overloaded functions
From: |
Andy Adler |
Subject: |
Re: overloaded functions |
Date: |
Sun, 12 Jan 2003 19:59:48 -0500 (EST) |
That's a really useful function, Paul.
Does it add any significant overhead?
Andy
On Sun, 12 Jan 2003, Paul Kienzle wrote:
> I've added dispatch.cc to octave-forge/main/miscellaneous.
> This adds the ability to overload functions in octave.
>
> E.g.,
>
> mark_as_command dispatch
> dispatch sin string g
> function g,'g',end
> sin('x')
> # ==> g
> sin(3)
> # ==> 0.14112
> dispatch min string g
> min([1 2 3])
> # ==> 1
> min('x')
> # ==> g
> dispatch reshape string g
> reshape(1:6,2,3)
> # ==> [1 3 5; 2 4 6 ]
> reshape('x',2,3)
> # ==> g
> help sin
> # ==>
> sin is a builtin function
> - Mapping Function: sin (X)
> Compute the sin of each element of X.
> Overloaded function string:g
>
> If you are using octave 2.1.40 compile it with mkoctfile -DOCTAVE2140
> dispatch.cc, otherwise use octave 2.1.43.
>
> Now we need PKG_ADD to contain the appropriate dispatch functions
> for octave forge, such as "dispatch find sparse spfind".
>
> Paul Kienzle
> address@hidden
>
>