bugGNU Octave - Bugs: bug #31421, discrete_pdf uses unsorted values

 
 

bug #31421: discrete_pdf uses unsorted values

Submitter:  Muhali <muhali>
Submitted:  Fri 22 Oct 2010 09:05:28 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  dbateman
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 25 Oct 2010 07:35:25 PM UTC, comment #4: 

The change I made gave a significant speed improvement to this function. However Muhali is right the values have to be sorted before using the lookup function. A trivial changeset is applied in

http://hg.savannah.gnu.org/hgweb/octave/rev/83da69c6e7be

that fixes this problem

D.

David Bateman <dbateman>
Group Member
Mon 25 Oct 2010 06:28:52 AM UTC, comment #3: 

OK, I think these changesets are the ones that caused the problem:

  http://hg.savannah.gnu.org/hgweb/octave/rev/1c6ff93c025a
  http://hg.savannah.gnu.org/hgweb/octave/rev/f6959aff84ca

I'm adding a CC to David Bateman since he made the changes.

John W. Eaton <jwe>
Group administrator
Mon 25 Oct 2010 12:36:55 AM UTC, comment #2: 

This seems to be caused after octave-3.2.3. The diff to my version 3.3.52+ is this:

60c56
<     pdf (k) = ((x(k) ones (1, m)) == (ones (n, 1) v)) * p;
---

>     pdf (k) = p (lookup (v, x(k), 'm'));


With the newer version below (using 'lookup') you easily generate the error by issuing

discrete_pdf(2, [2 1 3], [1 1 1]/3)

M.

Muhali <muhali>
Sun 24 Oct 2010 07:12:59 PM UTC, comment #1: 

Could you post a test case? 

This will make it easier to see what error you are encountering. It also give developers a chance to verify any fix by running it on your test case and having it pass.

Rik <rik5>
Group administrator
Fri 22 Oct 2010 09:05:28 PM UTC, original submission:  

The function discrete_pdf uses unsorted values for the subsequent table loopkup, creating the following error.

error: discrete_pdf: subscript indices must be either positive integers or logicals.
error: called from:
error:   /usr/local/octave-3.4/share/octave/3.3.52+/m/statistics/distributions/discrete_pdf.m at line 56, column 13

Like in dicrete_cdf the values should be sorted before the lookup call.

Muhali <muhali>

 

(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 dbateman (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by jwe
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by muhali (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
    2010-10-25 dbateman Open/ClosedOpen Closed
    2010-10-25 dbateman StatusNeed Info Fixed
        Assigned toNone dbateman
    2010-10-25 jwe Carbon-Copy- Added david bateman <dbateman@free.fr>
    2010-10-24 rik5 StatusNone Need Info

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code