[Top][All Lists]

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

confusion about dld's

From: John W. Eaton
Subject: confusion about dld's
Date: Sat, 13 Apr 2002 21:33:47 -0500

On 13-Apr-2002, Heber Farnsworth <address@hidden> wrote:

| I have written several dld functions in the past but now I'm faced with 
| having to write a quite complex one and I'm bumping up against my 
| ignorance.  I'm no C++ wiz and I'm getting confused about 
| octave_values.  I was trying to compile my function and I was surprised 
| to find that it appears that something like A*B*C, where A and C are 
| matrices and B is a diagonal matrix, gives an octave_value and not a 
| Matrix.  Perhaps I'm misinterpretting the messages I'm getting from gcc.

If you actually have

  Matrix A, C;
  DiagMatrix B;

then the expression "A * B * C" should produce a Matrix object.  But
I'm not sure there are very many (any?) ways to actually produce a
DiagMatrix object in Octave (.m) code.

It's hard to know exactly what is causing the problem without seeing
the actual code you are working with.  If you can post some complete
examples that demonstrate the problems you're having, maybe someone
could offer more specific help.

| In the past when I write dld functions I take the octave_value_list args 
| and pick out the components and make them either Matrices, vectors, or 
| doubles as seems appropriate.  Then I convert the object to be return in 
| to octave_values.  In the middle of the program I've never dealt with 
| octave_values.  Do I have to?

Not usually, though some operations on Matrix objects do produce
octave_value objects because the results can be different types
depending of the values of the arguments.

| It seems like this is not an easy thing 
| to deal with.  Things like sums, inverses, transposes, etc. don't seem 
| to work on them.   Is that right?

Some operations are implemented, but most are not.  Part of the reason
for this is that it isn't really useful to have operations on
octave_value objects available in the core Octave code, so I didn't
bother to take the time to implement them.  Because an octave_value
object can hold any kind of value, an expression like

  A * D * B.inverse ();

in which all the operands are octave_value objects would require
significant overhead to decode and extract the types before the
operations could actually be performed.  You would probably see some
speed improvement over Octave (.m) code, but not as much as you are
probably hoping for.


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]