bugGNU Octave - Bugs: bug #59607, containers.Map values method fails...

 
 

bug #59607: containers.Map values method fails with "." notation and cellstr indexing

Submitter:  A.R. Burgers <arb>
Submitted:  Wed 02 Dec 2020 10:04:30 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 04 Dec 2020 10:29:40 PM UTC, comment #4: 

works for me now in dev.

A.R. Burgers <arb>
Thu 03 Dec 2020 04:13:12 AM UTC, comment #3: 

There were several problems with the subsref function for +containers.Map.  I believe I've fixed them in this changeset: http://hg.savannah.gnu.org/hgweb/octave/rev/fd8e536d166e.

Marking as "Ready for Test".

Rik <rik5>
Group administrator
Wed 02 Dec 2020 10:52:03 PM UTC, comment #2: 

A potential fix:


--- a/scripts/+containers/Map.m Mon Nov 23 16:11:46 2020 +0900
+++ b/scripts/+containers/Map.m Wed Dec 02 22:49:19 2020 +0000
@@ -379,7 +379,12 @@
             case "keys"
               sref = keys (this);
             case "values"
-              sref = values (this);
+              if (numel (s) > 1 && strcmp (s(2).type, "()"))
+                sref = values (this, s(2).subs{1});
+                s(2) = [];
+              else
+                sref = values (this);
+              end
             case "size"
               sref = size (this);
             case "length"


Guillaume <gyom>
Wed 02 Dec 2020 10:33:06 PM UTC, comment #1: 

Confirmed.  Changing Item Group to "Matlab Compatibility".

Rik <rik5>
Group administrator
Wed 02 Dec 2020 10:04:30 PM UTC, original submission:  

In the example below M.values(keySet) fails, while values(M, keySet) succeeds, in all of octave 5.2, 6.1, 7.0. In matlab both forms work.

Apparently in octave first v=M.values is evaluated, and then v(keySet) fails.


months = {'Jan', 'Feb', 'Mar', 'Apr'};
Tamb = [10, 11, 15, 18];
M = containers.Map(months, Tamb);
keySet = {'Jan', 'Feb'};
valueSet = values(M, keySet)
valueSet = M.values(keySet)


output:


valueSet =
{
  [1,1] =  10
  [1,2] =  11
}

error: index (<cell>): subscripts must be either integers 1 to (2^31)-1 or logicals
error: called from
    subsref at line 399 column 14
    xx at line 6 column 10


A.R. Burgers <arb>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gyom (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by arb (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-12-04 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-12-03 rik5 StatusConfirmed Ready For Test
    2020-12-02 rik5 Item GroupUnexpected Error or Warning Matlab Compatibility
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code