bugGNU Octave - Bugs: bug #39378, randperm cannot handle large...

 
 

bug #39378: randperm cannot handle large arguments

Submitted by:  Marco Caliari <caliari>
Submitted on:  Mon 01 Jul 2013 07:28:51 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.6.2Operating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Tue 15 Oct 2013 06:53:27 PM UTC, comment #8:

I have finally pushed my fix:

http://hg.savannah.gnu.org/hgweb/octave/rev/0b7f5c56f853

This should be part of the upcoming release.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Wed 17 Jul 2013 05:20:32 PM UTC, comment #7:

At the time I wrote my original comments, I was going off memory without reading the actual source code. Now that I look at it again, I realise that a slightly more sophisticated fix is required, first see if m will fit into an octave_idx_type, and if it doesn't then force a short shuffle.

It's a bit more than a one-liner right now, and at the moment I can't dedicate any time to this possibly easy problem.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Wed 17 Jul 2013 03:43:41 PM UTC, comment #6:

Jordi, can you apply this one-liner fix of yours or is there more testing to be done?

Rik <rik5>
Project Administrator
Wed 03 Jul 2013 02:01:50 PM UTC, comment #5:

Perfect.

Marco

Marco Caliari <caliari>
Project Member
Wed 03 Jul 2013 01:26:11 PM UTC, comment #4:

No, I meant double(n) > ..., rather. The problem is that if the full size of the vector is too big, then there's no hope that the "long" shuffle can work, because then line 1149 fails:

http://hg.savannah.gnu.org/hgweb/octave/file/76bd90f6ba65/libinterp/corefcn/rand.cc#l1147

In this case, we must do a short shuffle.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Wed 03 Jul 2013 08:25:28 AM UTC, comment #3:

Probably you mean

Marco

Marco Caliari <caliari>
Project Member
Tue 02 Jul 2013 07:40:12 PM UTC, comment #2:

I had some reason for capping the size of M. My reasoning was that if M was big enough, you might as well just allocate the full vector for speed. Perhaps a more sophisticated approach would be to do

?

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Tue 02 Jul 2013 02:02:49 PM UTC, comment #1:

The workaround is to change the "quick and dirty" test in rand.cc into

Marco

Marco Caliari <caliari>
Project Member
Mon 01 Jul 2013 07:28:51 AM UTC, original submission:

Dear all,

the following

gives me the "memory exhausted or requested size too large for range of Octave's index type" error. I think it should work since:

1) N < intmax
2) M < N/5 and so O(M) memory should be used (according to help)
3) Matlab works with such an example

Best regards,

Marco

Marco Caliari <caliari>
Project Member

 

(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 rik5 (Posted a comment)
  • -unavailable- added by jordigh (Updated the item)
  • -unavailable- added by caliari (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 15 Oct 2013 06:53:27 PM UTCjordighStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Wed 17 Jul 2013 05:20:32 PM UTCjordighStatusNone=>Confirmed
    Tue 02 Jul 2013 01:28:34 PM UTCjordighSummaryPossible bug in randperm=>randperm cannot handle large arguments

    Back to the top


    Powered by Savane 3.1-cleanup1