bugGNU Octave - Bugs: bug #39085, randg cannot be initialized

 
 

bug #39085: randg cannot be initialized

Submitted by:  Muhali <muhali>
Submitted on:  Mon 27 May 2013 05:40:51 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: Wont FixAssigned 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 03 Jun 2013 11:34:36 PM UTC, comment #3:

This has been discussed a number of times in the past. In matlab rand and randn are separator generators and are seeded separately. Thus

in both matlab and octave give different results for both calls to randn(). In Octave the generators rand, randn, rande, randg and randp are all separate whereas as in matlab rande, randg, randp are derived from rand and randn, and thus the difference between matlab and octave you observe

When I implemented these functions I asked on the list whether we should duplicate matlab behavior by sharing the state vectors between generators and the consensus at the time was that if we couldn't duplicate the exact sequences of the matlab generators from the same state vectors it was better to be able to reset these generators separately. So try instead

So yes this is a difference between matlab and octave, but no its not a bug, and yes you can "initialize" randg

D.

David Bateman <dbateman>
Project MemberIn charge of this item.
Mon 03 Jun 2013 08:32:50 PM UTC, comment #2:

You should try

from the shell to get identical results. The same doesn't hold for octave.

Muhali <muhali>
Mon 03 Jun 2013 02:00:29 PM UTC, comment #1:

Can't confirm this (octave 3.6.4 and matlab R2012b).

octave:1> foo
ans = 0.0018640
octave:2> foo
ans = 0.88730
octave:3> foo
ans = 0.53639
octave:4> foo
ans = 0.048427
octave:5> foo
ans = 0.073916
octave:6> foo
ans = 0.43173
octave:7> system('cat foo.m')
rand('state', 0.5) ;
randg(1)
ans = 0
octave:8> foo
ans = 1.0399

>> foo


ans =

0.9302

>> foo


ans =

0.1004

>> foo


ans =

2.1884

>> foo


ans =

2.1853

>> foo


ans =

0.6364

while:

octave:10> rand("state", 0.5); rand
ans = 0.84442
octave:11> rand("state", 0.5); rand
ans = 0.84442
octave:12> rand("state", 0.5); rand
ans = 0.84442

>> rand('state', 0.5); rand


ans =

0.9501

>> rand('state', 0.5); rand


ans =

0.9501

>> rand('state', 0.5); rand


ans =

0.9501

Anonymous
Mon 27 May 2013 05:40:51 PM UTC, original submission:

A script

should return identical results if executed twice (as octave foo.m). This holds for ML but not for octave (not even for the stable version).

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 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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 03 Jun 2013 11:34:36 PM UTCdbatemanStatusNone=>Wont Fix
      Assigned toNone=>dbateman
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1