bugGNU Octave - Bugs: bug #44987, statistics: hist3 should pad...

 
 

bug #44987: statistics: hist3 should pad output when called with centers larger than data

Submitter:  ederag <ederag>
Submitted:  Fri 01 May 2015 09:17:23 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * other Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 13 Aug 2015 01:59:42 AM UTC, comment #2: 

I can confirm this bug and that this is a regression caused by http://hg.code.sf.net/p/octave/statistics/rev/51b09dcd0aa7 by the change "replaced 'sparse' with 'accumarray', which avoids the superfluous creation and conversion of sparse matrices".

Replacing the use of accumarray back to sparse, fixes the issue. (pushed fix http://hg.code.sf.net/p/octave/statistics/rev/4ce359e8d1de )

A simple example, using "Edges" (which is my use case and was working fine 2 years ago):


octave> hist3 ([1:10; 1:5:50]', "Edges", {linspace(0, 10, 10), linspace(0, 50, 10)})
error: surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)
error: called from


The error comes surface but that's because hist3 is passing the wrong data to it.  This can be shown by getting the data instead of displaying. Note how the size of the output changes with random data, even though the bin edges are defined always the same:


octave> for i=1:10
  h_size(:, i) = size (hist3 (rand (10, 2), "Edges", {[0:0.2:1]; [0:.2:1]}));
endfor
octave> h_size
h_size =

   5   3   5   5   5   4   5   5   4   5
   5   5   5   5   5   5   5   5   5   5



Carnë Draug <carandraug>
Group Member
Tue 02 Jun 2015 04:52:39 PM UTC, comment #1: 

Retagging release from 4.0.0-rc4 to 4.0.0.

John W. Eaton <jwe>
Group administrator
Fri 01 May 2015 09:17:23 PM UTC, original submission:  

With statistics-1.2.4 package, when hist3 is called with centers higher than any of the given data, the N output is not padded with 0 as it should.
For instance:


D = [1 1; 3 1; 3 3; 3 1]
D =

   1   1
   3   1
   3   3
   3   1


hist3(D, {0:4, 0:4})

error: surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)


The solution is to add a size argument to accumarray. Patch attached.

ederag <ederag>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #33863:  hist3.m.patch added by ederag (644B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by carandraug (Arno Onken - maintainer of the statistics package)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by ederag (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-08-13 carandraug StatusNone Fixed
        Open/ClosedOpen Closed
        Release4.0.0 other
        Summaryhist3 should pad output when called with centers larger than data statistics: hist3 should pad output when called with centers larger than data
    2015-06-02 carandraug Carbon-Copy- Added -email is unavailable-
    2015-06-02 jwe Release4.0.0-rc4 4.0.0
    2015-05-01 ederag Attached File- Added hist3.m.patch, #33863

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code