octave-maintainers
[Top][All Lists]
Advanced

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

overloaded functions


From: Paul Kienzle
Subject: overloaded functions
Date: Sun, 12 Jan 2003 02:08:39 -0500
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2.1) Gecko/20021130

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



reply via email to

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