[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: User Defined Data Types
From: |
Carlo De Falco |
Subject: |
Re: User Defined Data Types |
Date: |
Tue, 21 Apr 2015 11:32:34 +0000 |
On 21 Apr 2015, at 13:17, Alexander Barth <address@hidden> wrote:
>
>
> On Mon, Apr 20, 2015 at 8:23 AM, shravan61 <address@hidden> wrote:
> Hi,
> I am new to Octave. I want to define a new data type (For ex:
> fixed-point data type). I have searched the archive. There was only one
> post related to User-defined data type in year 2000. Not much information
> available in that post. After that there are no posts related to it.
>
> May I know if there is a tutorial related to creating User-defined data
> types. If not, it would be great if some one can reply to this post with
> steps to follow to create User-defined data types.
>
> Dear Shravan,
>
> Have a look in the octave manual under object oriented programming:
>
> https://www.gnu.org/software/octave/doc/interpreter/Object-Oriented-Programming.html#Object-Oriented-Programming
>
> in particular in the operator overloading section:
>
> https://www.gnu.org/software/octave/doc/interpreter/Operator-Overloading.html#Operator-Overloading
>
> The "polynomial" example included in octave might also be helpful.
> http://hg.savannah.gnu.org/hgweb/octave/file/82b4fb8b8a28/examples/code/%40polynomial
>
> If performance is important, you might need to implement the class method in
> C++.
>
> Best regards,
> Alex
>
If you want to define the new class directly from C++
you may look at the example "make_int.cc" included in octave:
http://hg.savannah.gnu.org/hgweb/octave/file/tip/examples/code/make_int.cc
or the example package "triangular" in Octave-Forge:
http://sourceforge.net/p/octave/code/HEAD/tree/trunk/octave-forge/extra/triangular/
there is also a very very very short example in this presentation
from Oct-Conf 2013:
http://wiki.octave.org/OctConf_2013#Octave_overview
HTH,
c.