help-octave
[Top][All Lists]
Advanced

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

Re: MATLAB COMPATIBILITY (sparse matrices)


From: John W. Eaton
Subject: Re: MATLAB COMPATIBILITY (sparse matrices)
Date: Thu, 29 Jan 1998 02:57:30 -0600

On 19-Jan-1998, Andy Adler <address@hidden> wrote:

| Therefore, in order to do this right, it would be necessary
| to write a sparse data type in Octave.
| 
| John, how hard would that be?

Adding a new data type is fairly easy.  The hard part is what to do
about functions like inv(), svd(), and other functions that might need
to work on the new data type.

One solution is to modify every function that needs to handle the new
data type, and add a case for it.  This is not a very elegant
solution, since it requires modifying existing code whenever new
things are added, but it is relatively straightforward.  Octave
currently handles things like svd() and inv() for real and complex
matrices (take a look at any of the matrix factorizations, for
example).

Another solution is to handle the problem using some kind of virtual
function technique.  This would be relatively easy for functions that
only take one or two arguments but becomes more difficult (but still
possible) to handle functions that accept any number of arguments.
For added fun, add automatic type conversions, and make it all work
for M-files and dynamically auto-loaded functions in addition to
built-in functions.  Octave currently uses this technique for handling
operators (+, -, *, \, etc.).  (It works for dynamically loaded data
types, but they are not auto-loaded -- you have to call a function to
load any new data types at run time.)

If anyone out there has expertise in this area and is interested in
helping to improve Octave's system for managing data types, please
contact me!

Thanks,

jwe







reply via email to

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