bugGNU Octave - Bugs: bug #61098, Many functions should now accept...

 
 

bug #61098: Many functions should now accept vector dimension argument

Submitted by:  Kai Torben Ohlhus <siko1056>
Submitted on:  Wed 01 Sep 2021 05:35:13 AM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Patch Submitted Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Fri 24 Sep 2021 08:27:11 PM UTC, comment #6: 

I'm attaching a patch for the originally reported issue of the size function not allowing multiple dimensions to be queried at once.  Would someone like to look at adding a set of tests for this new feature?  If that turns up additional problems, I'll try to fix and then commit a changeset.

(file #51959)

John W. Eaton <jwe>
Project Administrator
Thu 02 Sep 2021 03:56:55 PM UTC, comment #5: 

i think we could probably combine.  This one started about size, bug #58089 is about sum, bug #56153 covers any/all. None have had any work done yet. I would maybe also combining with bug #58116 which pointed out that "all" was added as a DIM option at the same time as vector dims to a number of functions.  seems similar enough to lump together as a single 'handle all the new dimension stuff in these functions' report.

Nicholas Jankowski <nrjank>
Project Member
Wed 01 Sep 2021 05:07:55 PM UTC, comment #4: 

Should we merge these bug reports or keep this one just about the size function?

The problem with size should be easy to fix since it is just about reporting some info that is easily accessible.

It will be somewhat harder to fix the other functions that now accept vectors of dimensions because we have to do computations over all the listed dimensions.

Still changing this back to a feature request since it is a new feature.

John W. Eaton <jwe>
Project Administrator
Wed 01 Sep 2021 04:43:59 PM UTC, comment #3: 

The other functions are also listed in bug #58089.

Guillaume <gyom>
Wed 01 Sep 2021 04:31:04 PM UTC, comment #2: 

in addition to size, this change apparently affects other functions as well.

looking through release notes going back to 2018:
https://www.mathworks.com/help/matlab/release-notes.html

2018b

Vector Dimension Argument: Operate on multiple dimensions at a time for selected reduction functions
These functions now accept a vector dimension argument to specify multiple operating dimensions at a time, as well as the option 'all' to specify all dimensions of an array.

all        min
any        mode
bounds        prod
max        std
mean        sum
median        var

2019b

You can now use a vector dimension argument to query multiple array dimension lengths at a time with the size function.

A quick google search for vecdim shows it also applies to many other functions (zscore, range, quantile, skewness, etc...) but unsure if this is the same implementation as for the ones above.

Nicholas Jankowski <nrjank>
Project Member
Wed 01 Sep 2021 04:27:17 PM UTC, comment #1: 

I'm also marking this as a feature request since it is really a new feature in Matlab, not something that we already have in Octave with reasonable but different behavior.

I expect this should be a fairly easy feature to add.

John W. Eaton <jwe>
Project Administrator
Wed 01 Sep 2021 05:35:13 AM UTC, original submission:  

The `size` function can be called in new ways since Matlab R2019b:

> Starting in R2019b, you can also specify dim as a vector of positive integers to query multiple dimension lengths at a time. For example, size(A,[2 3]) returns the lengths of the second and third dimensions of A in the 1-by-2 row vector szdim.


https://www.mathworks.com/help/matlab/ref/size.html

sz = size(A)
szdim = size(A,dim)
szdim = size(A,dim1,dim2,…,dimN)
[sz1,...,szN] = size(___)

This change seems reasonable to me and mostly backward compatible.

Non-existing dimensions get filled up with "1"s, as the example illustates:

>> A = eye (3);
>> size (A, 4,2,3,1)

ans =

     1     3     1     3

>> size (A, [4,2,3,1])

ans =

     1     3     1     3

However this is a very elementary function and Octave should adapt soon.

Kai Torben Ohlhus <siko1056>
Project Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #51959:  size-diffs.txt added by jwe (4KiB - text/plain)

 

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 nrjank (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by siko1056 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-09-24 jwe Attached File- => Added size-diffs.txt, #51959
        StatusConfirmed => Patch Submitted
    2021-09-01 jwe Item GroupMatlab Compatibility => Feature Request
    2021-09-01 nrjank SummaryFunction `size` changed in Matlab R2019b => Many functions should now accept vector dimension argument
    2021-09-01 nrjank Item GroupFeature Request => Matlab Compatibility
    2021-09-01 jwe Item GroupMatlab Compatibility => Feature Request
    2021-09-01 rik5 Severity4 - Important => 3 - Normal

    Back to the top


    Powered by Savane 3.6