[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: int octave_value::numel (void) const;
From: |
David Bateman |
Subject: |
Re: int octave_value::numel (void) const; |
Date: |
Tue, 16 Nov 2004 20:30:52 +0100 |
User-agent: |
Mutt/1.4.1i |
> I had assumed that numel would always be equivalent to
>
> prod (size ())
Its not true for the sparse class, in fact see what happens for
a= speye(1e6);
whos a
*** local user variables:
Prot Name Size Bytes Class
==== ==== ==== ===== =====
rwd a 1000000x1000000 0 sparse
Total is 3567587328 elements using 0 bytes
or with the new sparse class gives
*** local user variables:
Prot Name Size Bytes Class
==== ==== ==== ===== =====
rwd a 1000000x1000000 16000004 sparse matrix
Total is 3567587328 elements using 16000004 bytes
Which is clearly wrong due to an overflow in the the integer calculation
prod(size(a))... Which is probably why matlab chose to only count the
non-zero elements in numel...
>
> but if it is not, then it is fine with me to change the definition of
> numel so that it can be defined differently in derived classses.
Ok, I'll submit a patch then..
Cheers
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