[Top][All Lists]

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

Re: lists and cell arrays ?

From: taltman
Subject: Re: lists and cell arrays ?
Date: Thu, 20 Nov 2003 19:23:43 +0000 (UTC)

Hi David,

I'm not (yet) that much of a Octave C++ hacker. For now, I'll just be
whipping up my own abstract data types as I go, and write VHL
functions to access & mutate them. Sorry, but I just don't see the
point it up in C++ if it is such a domain-specific application, as
opposed to a general type of universal applicability ( unless, of
course, speed/time is of the essence ). Please retort if I've opined
something myopic. :-}


On Nov 20, 2003 at 11:21am, David Bateman wrote:

David. >Date: Thu, 20 Nov 2003 11:21:40 +0100
David. >From: David Bateman <address@hidden>
David. >To: address@hidden
David. >Cc: David Bateman <address@hidden>,
David. >     Michael Creel <address@hidden>,
David. >     address@hidden
David. >Subject: Re: lists and cell arrays ?
David. >
David. >Tomer,
David. >
David. >See my code in octave-forge/main/comm which introduces a Galois Field 
David. >The problem can be seen in the example
David. >
David. >octave:1> a = gf(0,3); b= gf(1,3);
David. >octave:2> c = [a, b];
David. >octave:3> whos
David. >
David. >*** local user variables:
David. >
David. >prot  type                       rows   cols  name
David. >====  ====                       ====   ====  ====
David. > rwd  galois                        1      1  a
David. > rwd  galois                        1      1  b
David. > rwd  matrix                        1      2  c
David. >
David. >"galois" is a real octave type, not a data structure. But as a type
David. >introduced in an oct-file, it is in the unprivledged position of not
David. >having access to the concatenation operator, or the load/save functions
David. >in the current scheme under Octave. This is why I was cheering John's
David. >statement on introducing the "horizcat" and "vertcat" functions.
David. >
David. >I've been thinking on how to fix up the load/save issue as well, and I
David. >think this could also be fixed fairly easily by introducing into 
David. >
David. >void * oct_ascii_load (void);
David. >void * oct_ascii_save (void);
David. >void * oct_binary_load (void);
David. >void * oct_binary_save (void);
David. >
David. >bool have_oct_ascii_load { return false; }
David. >bool have_oct_ascii_save { return false; }
David. >bool have_oct_binary_load { return false; }
David. >bool have_oct_binary_save { return false; }
David. >
David. >and appropriate virtual functions in ov.h. Then modify 
David. >to do something like
David. >
David. >bool
David. >save_ascii_data ......
David. >
David. >{
David. >  if (val_arg->have_oct_ascii_save()) {
David. >     val_arg->oct_ascii_save();
David. >  } else
David. >    // The old version of the code
David. >  }
David. >}
David. >
David. >bool
David. >load_ascii_data ......
David. >
David. >{
David. >  if (val_arg->have_oct_ascii_load()) {
David. >     val_arg->oct_ascii_load();
David. >  } else
David. >    // The old version of the code
David. >  }
David. >}
David. >
David. >The the user type can overload the oct_* methods and setup the
David. >have_oct_* functions appropriately. Similar things could also be done
David. >for the Matlab and HDF file formats. This seems a means to get
David. >load/save functionality for user type with the least pain. Eventually
David. >all types could be converted to do load/save via this technique, but
David. >there are cases which will need special attention, in that they 
David. >don't have their own load/save (notably boolMatrix, etc).
David. >
David. >Would such a change be acceptable? If so I wouldn't might coding it 
David. >
David. >Regards 
David. >David
David. >
David. >According to address@hidden <address@hidden> (on 11/19/03):
David. >> Please see my comments below:
David. >> 
David. >> On Nov 18, 2003 at 5:06pm, David Bateman wrote:
David. >> 
David. >> David. >Date: Tue, 18 Nov 2003 17:06:31 +0100
David. >> David. >This is one of my pet peeves with octave, in that user 
defined types can't
David. >> David. >use concatenation. So I vote for a generic concatenation 
code. I just
David. >> 
David. >> I think you're talking about two things here. Built-in types
David. >> vs. user-defined data structures. Octave's data types, namely,
David. >> strings, matrices, cell-arrays, (deprecated) lists, and
David. >> associative-arrays (aka "structs"), should have high-level syntax for
David. >> concatenation & other useful functions. I don't believe that it's
David. >> possible for a programming language to have standard operators for
David. >> user-defined abstract data structures, since a wily user can create
David. >> all sorts of crazy data schemes. :-)
David. >> 
David. >> ~Tomer
David. >
David. >

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]