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

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

[Octave-bug-tracker] [bug #65478] hist produces nonconformtant arguments


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #65478] hist produces nonconformtant arguments error when input has ndims > 2
Date: Sun, 17 Mar 2024 23:07:42 -0400 (EDT)

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

                 Summary: hist produces nonconformtant arguments error when
input has ndims > 2
                   Group: GNU Octave
               Submitter: nrjank
               Submitted: Sun 17 Mar 2024 11:07:41 PM EDT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error or Warning
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sun 17 Mar 2024 11:07:41 PM EDT By: Nicholas Jankowski <nrjank>
in Matlab 2023b, 

[a,b] = hist([1:5;2:6;3:7;4:8]')

and 

[a,b] = hist(permute([1:5;2:6;3:7;4:8]',[1 3 2]))


produce the same output:



a =

     1     0     0     0
     1     1     0     0
     1     1     1     0
     0     0     0     0
     1     1     1     1
     1     1     1     1
     0     0     0     0
     0     1     1     1
     0     0     1     1
     0     0     0     1


b =

    1.3500
    2.0500
    2.7500
    3.4500
    4.1500
    4.8500
    5.5500
    6.2500
    6.9500
    7.6500


  (it behaves as if all columns are reshaped into dim2)


Octave produces an unexpected error:

>> [a,b] = hist(permute([1:5;2:6;3:7;4:8]',[1 3 2]))
error: =: nonconformant arguments (op1 is 1x1, op2 is 1x1)
error: called from
    hist at line 204 column 20


The matlab docs do describe the input x to hist as being a vector or matrix.
so supporting x being an array is undocumented, but hist in general has been
around and unchanged in matlab for quite some time.  they've not created an
object oriented `histogram` they recommend for use over hist, that octave has
not yet implemented, and that function accepts n-D arrays for input.  

It seems like it shouldn't be too difficult for hist to also handle n-D
arrays.  At a minimum, if that is discouraged, it should give a meaningful
error message.







    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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