[SciPy-dev] Re: [Numpy-discussion] Release of scipycorebetawillhappen next week.

Robert Kern rkern at ucsd.edu
Wed Sep 28 00:50:28 CDT 2005


Travis Oliphant wrote:

> I presume we need to convert all of the pdfs from RNG and random_lite now?

No, not really.

mtrand.pyx:
261:    def seed(self, seed=None):
282:    def set_state(self, state):
293:    def get_state(self):
303:    def random_sample(self, size=None):
310:    def tomaxint(self, size=None):
318:    def randint(self, low, high=None, size=None):
352:    def bytes(self, unsigned int length):
364:    def uniform(self, double low=0.0, double high=1.0, size=None):
372:    def standard_normal(self, size=None):
379:    def normal(self, double loc=0.0, double scale=1.0, size=None):
388:    def beta(self, double a, double b, size=None):
399:    def exponential(self, double scale=1.0, size=None):
408:    def standard_exponential(self, size=None):
415:    def standard_gamma(self, double shape, size=None):
424:    def gamma(self, double shape, double scale=1.0, size=None):
435:    def f(self, double dfnum, double dfden, size=None):
446:    def noncentral_f(self, double dfnum, double dfden, double nonc,
size=None):
460:    def chisquare(self, double df, size=None):
469:    def noncentral_chisquare(self, double df, double nonc, size=None):
481:    def standard_cauchy(self, size=None):
488:    def standard_t(self, double df, size=None):
497:    def vonmises(self, double mu, double kappa, size=None):
507:    def pareto(self, double a, size=None):
516:    def weibull(self, double a, size=None):
525:    def power(self, double a, size=None):
534:    def binomial(self, long n, double p, size=None):
547:    def negative_binomial(self, long n, double p, size=None):
561:    def poisson(self, double lam=1.0, size=None):
570:    def multinomial(self, long n, object pvals, size=None):
620:    def shuffle(self, object x):
635:    def permutation(self, object x):

Okay, I guess I missed lognormal, but that's just a transformation of
normal variates. Easy.

I originally wrote this to replace the PRNG in the old scipy.stats, not
RandomArray or RNG. Here are the incompatibilities:

* The RNG interface isn't there at all
* Some small name differences:
  - F, noncentral_F -> f, noncentral_f
  - the "shape" argument -> "size" (following the convention in the old
scipy.stats distributions)
* I haven't carried over mean_var_test() since it doesn't belong there
as an exposed API
* Some changes in the naming of arguments
* seed(x, y) -> seed([x, y]) if you must
* get_seed() has nothing to correspond to (except maybe get_state(), but
you can't pass that to seed(); well you could, but it won't get you what
you want)

Does anyone use the RNG interface? It's terribly limited. I *am*
concerned about carrying over interfaces that no one is going to use.
The missing bits of RNG (ignoring the generator itself) could easily be
replicated by a small Python file. We could keep that for a release or
two, suitably marked as deprecated via warnings.warn(). Then we can
remove it.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Scipy-dev mailing list