From octave-maintainers-request at bevo dot che dot wisc dot edu Sun Jan 12 19:04:19 2003 Subject: Re: overloaded functions From: Andy Adler To: Paul Kienzle cc: octave-maintainers at bevo dot che dot wisc dot edu 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 > pkienzle at users dot sf dot net > >