octave-maintainers
[Top][All Lists]
Advanced

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

int octave_value::numel (void) const;


From: David Bateman
Subject: int octave_value::numel (void) const;
Date: Mon, 15 Nov 2004 15:20:06 +0100
User-agent: Mutt/1.4.1i

Is there any reason not to change the definition of numel is ov.h to
be a virtual function like

  virtual int numel (void) const
    { return rep->numel (); }

and then add to ov-base.h 

   int numel (void) const { return dims ().numel (); }

The reason is that the code in symtab.cc for whos uses the numel
function, which with the current code is based solely on the dimension
vector. However the numel for a sparse matrix should be the non-zero
elements only, and so the current behaviour is wrong. Making the above
change allows numel to be overloaded, with a sparse matrix specific
version.

The only problem I see is that oct-map.h includes its own version of 
numel. Issues might arise for the is_empty, and the value of numel
returned in whos for structures, though I'm not sure this is a problem
even in that case.

Regards
David


-- 
David Bateman                                address@hidden
Motorola CRM                                 +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 1 69 35 77 01 (Fax) 
91193 Gif-Sur-Yvette FRANCE

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

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