[Top][All Lists]

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

[Octave-bug-tracker] [bug #44193] whos "elements" count wrong for user-d

From: Colin Macdonald
Subject: [Octave-bug-tracker] [bug #44193] whos "elements" count wrong for user-defined class, capacity problem?
Date: Fri, 06 Feb 2015 10:34:54 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0

Follow-up Comment #5, bug #44193 (project octave):

Let's start again so its all in this bug instead of cross-linked to the other
one where @mtmiller pointed this out.  See attached class.

octave:1> x = A(rand(3,4))
class is: A
 with data:
   0.191086   0.658946   0.063937   0.394757
   0.285017   0.690299   0.827248   0.889642
   0.378245   0.180257   0.350445   0.330926
octave:2> y = A(42)
class is: A
 with data:
octave:3> z = 42
z =  42
octave:4> whos
Variables in the current scope:

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  ===== 
        x           3x4                         96  A
        y           1x1                          8  A
        z           1x1                          8  double

Total is 3 elements using 112 bytes

Note each x and y counts as only one "element" even though x reports numel(x)
-> 12 and size(x) -> [3 4].

I.e., the element calculation does not respect numel/size/etc for a
user-defined class.  From reading the code, the element count is done by
adding up the ".capacity".  That is as far as I've tracked it down.


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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