diff options
Diffstat (limited to 'numpy/oldnumeric')
-rw-r--r-- | numpy/oldnumeric/compat.py | 5 | ||||
-rw-r--r-- | numpy/oldnumeric/random_array.py | 48 |
2 files changed, 25 insertions, 28 deletions
diff --git a/numpy/oldnumeric/compat.py b/numpy/oldnumeric/compat.py index 1d376dd12..369fa5000 100644 --- a/numpy/oldnumeric/compat.py +++ b/numpy/oldnumeric/compat.py @@ -11,13 +11,10 @@ __all__ = ['NewAxis', import numpy.core.multiarray as multiarray import numpy.core.umath as um -from numpy.core.numeric import array, correlate, outer, cross -from numpy.core.umath import sign, absolute, multiply +from numpy.core.numeric import array, correlate import functions import sys -import types - from cPickle import dump, dumps mu = multiarray diff --git a/numpy/oldnumeric/random_array.py b/numpy/oldnumeric/random_array.py index 84e923e13..0b06ee959 100644 --- a/numpy/oldnumeric/random_array.py +++ b/numpy/oldnumeric/random_array.py @@ -72,30 +72,30 @@ def standard_normal(shape=[]): return mt.standard_normal(shape) def normal(mean, std, shape=[]): - """normal(mean, std, n) or normal(mean, std, [n, m, ...]) returns - array of random numbers randomly distributed with specified mean and - standard deviation""" - if shape == []: - shape = None - return mt.normal(mean, std, shape) + """normal(mean, std, n) or normal(mean, std, [n, m, ...]) returns + array of random numbers randomly distributed with specified mean and + standard deviation""" + if shape == []: + shape = None + return mt.normal(mean, std, shape) def multivariate_normal(mean, cov, shape=[]): - """multivariate_normal(mean, cov) or multivariate_normal(mean, cov, [m, n, ...]) - returns an array containing multivariate normally distributed random numbers - with specified mean and covariance. - - mean must be a 1 dimensional array. cov must be a square two dimensional - array with the same number of rows and columns as mean has elements. - - The first form returns a single 1-D array containing a multivariate - normal. - - The second form returns an array of shape (m, n, ..., cov.shape[0]). - In this case, output[i,j,...,:] is a 1-D array containing a multivariate - normal.""" - if shape == []: - shape = None - return mt.multivariate_normal(mean, cov, shape) + """multivariate_normal(mean, cov) or multivariate_normal(mean, cov, [m, n, ...]) + returns an array containing multivariate normally distributed random numbers + with specified mean and covariance. + + mean must be a 1 dimensional array. cov must be a square two dimensional + array with the same number of rows and columns as mean has elements. + + The first form returns a single 1-D array containing a multivariate + normal. + + The second form returns an array of shape (m, n, ..., cov.shape[0]). + In this case, output[i,j,...,:] is a 1-D array containing a multivariate + normal.""" + if shape == []: + shape = None + return mt.multivariate_normal(mean, cov, shape) def exponential(mean, shape=[]): """exponential(mean, n) or exponential(mean, [n, m, ...]) returns array @@ -195,8 +195,8 @@ def mean_var_test(x, type, mean, var, skew=[]): print "(should be about ", mean, "):", x_mean print "Variance of those random numbers (should be about ", var, "):", x_var if skew != []: - x_skew = (Numeric.sum(x_minus_mean*x_minus_mean*x_minus_mean,axis=0)/9998.)/x_var**(3./2.) - print "Skewness of those random numbers (should be about ", skew, "):", x_skew + x_skew = (Numeric.sum(x_minus_mean*x_minus_mean*x_minus_mean,axis=0)/9998.)/x_var**(3./2.) + print "Skewness of those random numbers (should be about ", skew, "):", x_skew def test(): obj = mt.get_state() |