help-octave
[Top][All Lists]
Advanced

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

Sparse functions for octave


From: A+A Adler
Subject: Sparse functions for octave
Date: Mon, 18 Oct 1999 23:18:28 -0400 (EDT)

I suspect that only jwe can answer these questions, but
others may be interested, so I'm posting it here.

I've finally found some time to work on re-writing my
sparse functions using make_int.cc as a framework.

It took me a while to figure out what was going on,
   but I really like the functionality now. I've seen
   C++ abused so much that I needed to work on a project
   like this to convince me that C++ can actually be
   used to do nice work!

However, I have several questions:

1. I have a make_sparse that works fairly well, however, I
   can't get other *.oct files to talk to it.

   For example, I'm trying to define nnz.oct

      #include "make_sparse.h"   <- my sparse Class is defined here
      DEFUN_DLD (nnz, args, , "blah" ) {
         octave_value_list retval;
         string type_name = args(0).type_name();
         if (type_name == "scalar")
            nnz= (args(0).double_value() != 0.0);
         } else 
         if (type_name == "sparse") {
            octave_sparse S= args(0).sparse_value();
            nnz= S.nnz();
         } else 
            error("nnz: don't know how to nnz this type of variable");

   Compiling, I get the following error            
   nnz.cc: no matching function for call to `octave_value::sparse_value ()

   I have defined a sparse_value inside my octave_sparse Class, but
   I can't see how to get a sparse_value of an octave_value.

   I've tried to look in the sources for the Matrix classes, but
   can't figure out how the whole octave_value thing works.

   When you have a 1x1 matrix and take the double_value, then some
   conversion happens, but when you take the matrix_value of a 
   matrix, is it just a cast that happens?


2. Error handling
   Currently I'm using error("blurb") for 

   however, I see (*current_liboctave_error_handler) used
   in the source. Should I be using that?

3. I'd like to know how the memory management works - right
   now I'm sure I've got memory leaks, but I'll worry about
   this after I get the functionality working.

andy
______________________________________________________________
Andy Adler,                               address@hidden





---------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.  To ensure
that development continues, see www.che.wisc.edu/octave/giftform.html
Instructions for unsubscribing: www.che.wisc.edu/octave/archive.html
---------------------------------------------------------------------



reply via email to

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