help-octave
[Top][All Lists]
Advanced

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

Re: How to implement IPT strel.m ?


From: David Bateman
Subject: Re: How to implement IPT strel.m ?
Date: Tue, 3 Aug 2004 10:07:21 +0200
User-agent: Mutt/1.4.1i

According to Josep Monés i Teixidor <address@hidden> (on 08/02/04):
> Hello!
> 
> I wanted to implement octave equivalents to strel.m [1] from image
> processing toolbox, which returns a strel object.
> 
> How can I reproduce that in octave. Has it got classes?

Octave doesn't have classes. The fact is in discussion with Paul
Kienzle, I've thought about the problem a bit. Implementing all of the
infrastructure for classes in octave is pretty easy with the code that
already exists.  What seems to me to be the hard bit is modifiying
Octave itself so that the directory "@class" is interpret as a private
directory that contains all of the functions specific to the class.

I'm not sure I understand all that would have to change within Octave
to support private directories and so don't won't to tackle this
problem, until I either completely understand how to implement private
directories or someone has already done it.

> Can structs have member functions?

Octave supports function handles. I presume something like

octave:1> f.f1 = @sin; f.f2 = @cos
f =
{
  f1 = @sin
  f2 = @cos
}

is what you mean. Note that the funtion handle stuff had some
bugs. Not sure if they are there in 2.1.57, but there was certainly
one fixed in the CVS yesterday, that is essentially to be able to use
them.

> Can I do it defining a custom type in C++?

Sure. This is pretty much a continuation of the classes issue
above. Its about as much effort to implement your custom type in C++
as it would be to implement classes, except for that issue of a
private directory. You avoid the private directory issue by doing a
custom type in C++.

There are plenty of examples in the octave-forge tree of how to do
it. Look in

main/sparse
main/comms
main/fixed

or for the very very simpliest example, look in

extra/linear-algebra/ov-re-tri.{cc,h}

Cheer
David

-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 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:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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