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

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

[Octave-bug-tracker] [bug #63698] sum behavior when second argument is a


From: Michele Ginesi
Subject: [Octave-bug-tracker] [bug #63698] sum behavior when second argument is a vector
Date: Tue, 24 Jan 2023 11:21:28 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?63698>

                 Summary: sum behavior when second argument is a vector
                 Project: GNU Octave
               Submitter: m_ginesi
               Submitted: Tue 24 Jan 2023 04:21:26 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: stable
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Tue 24 Jan 2023 04:21:26 PM UTC By: Michele Ginesi <m_ginesi>
In Matlab, it is possible to compress sums over multiple dimensions of a
matrix by giving a vector as the second argument so that, for instance,


sum(A, [1,2])


is equivalent to


sum(sum(A, 1), 2)


In octave, this is not true, and only the first entry of the second argument
is considered.
Consider this minimal example:


A = reshape(1:9, [3,3]);
sum(A, [1,2]);


in Matlab it gives 45, in octave it gives [6 15 24].

Also, Matlab allows the syntax


sum(A,'all')


while octave doesn't







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?63698>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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