octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #34351] Feature Request : rand[nep] should acc


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #34351] Feature Request : rand[nep] should accept a final "class" argument
Date: Thu, 22 Sep 2011 16:08:04 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0 Iceweasel/5.0

Follow-up Comment #2, bug #34351 (project octave):

I don't understand the details of the random number generator calculations so
I don't know how hard it would be to make them generate single precision
numbers properly.

But instead of doing the checks and conversions in each of the random
distribution functions, how about adding a private function to the
statistics/distributions directory that looks something like


  function m = gen_rand (fcn, sz, cls)
    m = fcn (sz);
    if (strcmp (cls, "single"))
      ## do appropriate conversion
     ..
    elseif (! strcmp (cls, "double"))
      error ("");
    endif
  endfunction


Then you can simplify the code in the distribution functions in approximately
the way that you would if we made the change you are suggesting:


  m = gen_rand (@randg, sz, class (n));



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?34351>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]