octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #49559] Implementation of containers.Map


From: Rik
Subject: [Octave-bug-tracker] [bug #49559] Implementation of containers.Map
Date: Fri, 7 Apr 2017 12:46:56 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Follow-up Comment #20, bug #49559 (project octave):

I don't think it makes sense to keep a copy of the keys internally.  They are
already stored once as the fieldnames of the internal struct used for the
implementation.  And we use a struct for implementation, rather than just a
cell array of keys and a cell array of values, because the search time for a
key would be linear in a cell array, but is O(log2 (N)) for a struct which
maps internally to a C++ map.  At some point we could consider a true O(1)
containers.Map, but this would require mapping onto C++'s <unordered_map>.

It would be nice if we had a code coverage tool for m-files.  I found that the
BIST tests for Map were not exercising every line of the code.  In particular,
moving back to num2hex/hex2num had broken the values() function when using the
two-argument form of the function to extract particular keys.

I added yet more BIST tests, fixed values(), added support for horzcat,
changed check_types to check ValueType against the full list of allowed types,
and changed the calculation for allowed sizes.  The last bit needs checking.

In Matlab, could someone try


m = containers.Map ([1, 2], {magic(3), eye(3)})
m.ValueType


In Octave, this returns "double" because the objects are of the same type and
same size.  However, Matlab may have intended for this to be same type and
scalar.

The cset is here http://hg.savannah.gnu.org/hgweb/octave/rev/56c59b3f9172.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49559>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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