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

 
 

bug #31421: discrete_pdf uses unsorted values

Submitted by:  Muhali <muhali>
Submitted on:  Fri 22 Oct 2010 09:05:28 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedAssigned to: David Bateman <dbateman>
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

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>
Project MemberIn charge of this item.
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>
Project 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>
Project 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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dbateman (Posted a comment)
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by jwe
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by muhali (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 25 Oct 2010 07:35:55 PM UTCdbatemanOpen/ClosedOpen=>Closed
    Mon 25 Oct 2010 07:35:25 PM UTCdbatemanStatusNeed Info=>Fixed
      Assigned toNone=>dbateman
    Mon 25 Oct 2010 06:28:52 AM UTCjweCarbon-Copy-=>Added david bateman
    Sun 24 Oct 2010 07:12:59 PM UTCrik5StatusNone=>Need Info

    Back to the top


    Powered by Savane 3.1-cleanup1