octave-maintainers
[Top][All Lists]
Advanced

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

Re: Dispatch function


From: pritika malhotra
Subject: Re: Dispatch function
Date: Sun, 15 May 2016 14:31:02 +0530

On 14 May 2016 at 22:28, John W. Eaton <address@hidden> wrote:
>
> On 05/14/2016 12:38 PM, pritika malhotra wrote:

<snip>

>
>
> Create a directory called @double somewhere in your loadpath and define 
> something like the following function there:
>
>   function r = sin (a)
>     if (issparse (a))
>       r = ...;  ## your special definition for sparse matrices
>     else
>       r = builtin ('sin', a);
>     endif
>   endfunction
>
> You can only overload on class name, not the specific types as reported by 
> the typeinfo function.  The specific type names like "sparse matrix" are not 
> classes in the interpreter.  The class for sparse matrices is either double 
> or logical.
>
> Overloading for operators is not yet implemented, so defining a function 
> called "plus" won't overload the + operator (for example).
>
> jwe
>
 Thanks alot.

-- 
Pritika Malhotra



reply via email to

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