diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-06-09 19:50:46 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-06-09 19:50:46 +0000 |
commit | 13c9eeff4ee39555967f05be054111a695bd7cfc (patch) | |
tree | 79efb812ad58c78da0c40f774bf384cf0a1afa1e /numpy/random | |
parent | a5b115b97ffed88cd7d159d944105bb748d44cf6 (diff) | |
download | numpy-13c9eeff4ee39555967f05be054111a695bd7cfc.tar.gz |
Use dot instead of matrixmultiply
Diffstat (limited to 'numpy/random')
-rw-r--r-- | numpy/random/mtrand/mtrand.pyx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index b01055d83..600cd9321 100644 --- a/numpy/random/mtrand/mtrand.pyx +++ b/numpy/random/mtrand/mtrand.pyx @@ -820,11 +820,11 @@ cdef class RandomState: else: shape = size if len(mean.shape) != 1: - raise ArgumentError("mean must be 1 dimensional") + raise ValueError("mean must be 1 dimensional") if (len(cov.shape) != 2) or (cov.shape[0] != cov.shape[1]): - raise ArgumentError("cov must be 2 dimensional and square") + raise ValueError("cov must be 2 dimensional and square") if mean.shape[0] != cov.shape[0]: - raise ArgumentError("mean and cov must have same length") + raise ValueError("mean and cov must have same length") # Compute shape of output if isinstance(shape, int): shape = [shape] @@ -838,7 +838,7 @@ cdef class RandomState: mean.shape[0]) # Transform matrix of standard normals into matrix where each row # contains multivariate normals with the desired covariance. - # Compute A such that matrixmultiply(transpose(A),A) == cov. + # Compute A such that dot(transpose(A),A) == cov. # Then the matrix products of the rows of x and A has the desired # covariance. Note that sqrt(s)*v where (u,s,v) is the singular value # decomposition of cov is such an A. @@ -846,7 +846,7 @@ cdef class RandomState: from numpy.dual import svd # XXX: we really should be doing this by Cholesky decomposition (u,s,v) = svd(cov) - x = _sp.matrixmultiply(x*_sp.sqrt(s),v) + x = _sp.dot(x*_sp.sqrt(s),v) # The rows of x now have the correct covariance but mean 0. Add # mean to each row. Then each row will have mean mean. _sp.add(mean,x,x) |