[Top][All Lists]

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

Re: Operator overloading

From: David Bateman
Subject: Re: Operator overloading
Date: Wed, 14 May 2003 14:29:13 +0200
User-agent: Mutt/1.3.28i


According to Suvendra Nath Dutta <address@hidden> (on 05/14/03):
> Is there some way to overload operators in Octave. Ideally I'd like to 
> define my own objects (like structs) and overload the *, + and other 
> operators.

This is pretty much what I recently did for a Galois Field GF(2^M) class
in octave-forge (see octave-forge/main/comm). For the operator overloading
you'll have to create a new type with its own replacement operators. If
you want to see an example of how to do this you code look at my Galois
field code, or the sparse matrix code in octave-forge. However, in
octave-forge/extra/linear-algerbra there is a smaller example with the
factorization of triangular matrices that will probably be an easier starting
point :-)

As for overloading functions you should look at the dispatch function 
(octave-forge/main/miscallaneous), that I also extensively used in 
the Galois field code. If you use the PKG_ADD command you can even have
these function overloads automatically included at startup..


David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 25 00 (Ph)
Espace Technologique, Commune de St Aubin    +33 1 69 35 25 01 (Fax)
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

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