[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Symbolic Toolbox
From: |
Andy Adler |
Subject: |
Re: Symbolic Toolbox |
Date: |
Sat, 24 Jun 2000 20:01:23 -0400 (EDT) |
On Thu, 22 Jun 2000, Ben Sapp wrote:
> Well, I would like to do it the "best" way, whatever that may be. :)
> Here is what I am currently thinking is best. However, I am open to
> suggestions. I think that if I implement it correctly as .oct files
> then it should not be very hard to add it into Octave as regular data
> types and interenal functions.
The approved way to add new data types to octave is shown in the
examples/make_int.cc. This functionality is really quite
powerful. You can override all the binary and unitary operators
( a+b, a-b a*b a.*b a\b a/b, -a a' a.' a(:) a(idx1,idx2) etc.
> But, I do not see how I could do this with out modifying the current
> Octave implementation of the internal sin function ... does any one
> else? Maybe I could change the name slightly like Sin and Cos instead
> of sin and cos? Is this a good idea?
I know of no way to override the built in functions. This would
be a really useful feature, but, (given my limited knowledge of
octave internals) I think it would be really hard to implement.
Currently, a *.oct file takes an octave_value_list& parameter,
and gives one back as output. So there seems no way to use
any kind of function overloading technique to select which
*oct file to use.
It may be possible to invent some kind of name mangling scheme
internally so that a DLD function can specify the acceptable
argument types. But then how do you write a function that
accepts all argument types?
> I am also a bit unsure of how to implement matrices of symbolic
> variables. I could use the matrix class provided in the GiNaC library,
> but I am a bit concerened that then we would have two types of matrix
> implementations in Octave. This seems sub optimal. Is it possible to
> use the templates in Octave on your own data types? I suspect that the
> answer is yes, but it is not clear to me how to do this.
Yes. This works well, and is fairly easy to do. If you look at
the sparse stuff I wrote it does essentially what you say. (ie.
linking to an external matrix library class)
__________________________________________
Andy Adler, address@hidden
-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.che.wisc.edu/octave/octave.html
How to fund new projects: http://www.che.wisc.edu/octave/funding.html
Subscription information: http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------