From maintainers-request at octave dot org Mon Nov 15 08:21:59 2004 Subject: int octave_value::numel (void) const; From: David Bateman To: maintainers at octave dot org Date: Mon, 15 Nov 2004 15:20:06 +0100 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 David dot Bateman at motorola dot com 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