diff options
| author | Travis Oliphant <oliphant@enthought.com> | 2006-06-02 17:38:54 +0000 |
|---|---|---|
| committer | Travis Oliphant <oliphant@enthought.com> | 2006-06-02 17:38:54 +0000 |
| commit | ebc3848e61739bea11645168bd4725b5760fa741 (patch) | |
| tree | b586a3035ad3cdd90cdacfe472d019e46b6d1801 /numpy | |
| parent | ce9414d3007101af1c18d674bd162cdef48c564d (diff) | |
| download | numpy-ebc3848e61739bea11645168bd4725b5760fa741.tar.gz | |
Remove deprecated names from ma and tests.
Diffstat (limited to 'numpy')
| -rw-r--r-- | numpy/core/ma.py | 24 | ||||
| -rw-r--r-- | numpy/core/tests/test_ma.py | 8 | ||||
| -rw-r--r-- | numpy/lib/shape_base.py | 4 | ||||
| -rw-r--r-- | numpy/linalg/linalg.py | 2 |
4 files changed, 21 insertions, 17 deletions
diff --git a/numpy/core/ma.py b/numpy/core/ma.py index 74fa08ac3..b17c5d256 100644 --- a/numpy/core/ma.py +++ b/numpy/core/ma.py @@ -1477,13 +1477,13 @@ def masked_object (data, value, copy=1): dm = make_mask(umath.equal(d, value), flag=1) return array(d, mask=dm, copy=copy, fill_value=value) -def arrayrange(start, stop=None, step=1, dtype=None): +def arange(start, stop=None, step=1, dtype=None): """Just like range() except it returns a array whose type can be specified by the keyword argument dtype. """ - return array(numeric.arrayrange(start, stop, step, dtype)) + return array(numeric.arange(start, stop, step, dtype)) -arange = arrayrange +arrayrange = arange def fromstring (s, t): "Construct a masked array from a string. Result will have no mask." @@ -1893,8 +1893,8 @@ def putmask(a, mask, values): a.unshare_mask() numeric.putmask(a.raw_mask(), mask, 0) -def innerproduct(a, b): - """innerproduct(a,b) returns the dot product of two arrays, which has +def inner(a, b): + """inner(a,b) returns the dot product of two arrays, which has shape a.shape[:-1] + b.shape[:-1] with elements computed by summing the product of the elements from the last dimensions of a and b. Masked elements are replace by zeros. @@ -1903,22 +1903,26 @@ def innerproduct(a, b): fb = filled(b, 0) if len(fa.shape) == 0: fa.shape = (1,) if len(fb.shape) == 0: fb.shape = (1,) - return masked_array(numeric.innerproduct(fa, fb)) + return masked_array(numeric.inner(fa, fb)) -def outerproduct(a, b): - """outerproduct(a,b) = {a[i]*b[j]}, has shape (len(a),len(b))""" +innerproduct = inner + +def outer(a, b): + """outer(a,b) = {a[i]*b[j]}, has shape (len(a),len(b))""" fa = filled(a, 0).ravel() fb = filled(b, 0).ravel() - d = numeric.outerproduct(fa, fb) + d = numeric.outer(fa, fb) ma = getmask(a) mb = getmask(b) if ma is nomask and mb is nomask: return masked_array(d) ma = getmaskarray(a) mb = getmaskarray(b) - m = make_mask(1-numeric.outerproduct(1-ma, 1-mb), copy=0) + m = make_mask(1-numeric.outer(1-ma, 1-mb), copy=0) return masked_array(d, m) +outerproduct = outer + def dot(a, b): """dot(a,b) returns matrix-multiplication between a and b. The product-sum is over the last dimension of a and the second-to-last dimension of b. diff --git a/numpy/core/tests/test_ma.py b/numpy/core/tests/test_ma.py index 0f503b3e1..fe8864e91 100644 --- a/numpy/core/tests/test_ma.py +++ b/numpy/core/tests/test_ma.py @@ -424,10 +424,10 @@ class test_ma(ScipyTestCase): y=y.reshape(2,3,4) assert eq(numpy.transpose(y,(2,0,1)), transpose(x,(2,0,1))) assert eq(numpy.take(y, (2,0,1), 1), take(x, (2,0,1), 1)) - assert eq(numpy.innerproduct(filled(x,0),filled(y,0)), - innerproduct(x, y)) - assert eq(numpy.outerproduct(filled(x,0),filled(y,0)), - outerproduct(x, y)) + assert eq(numpy.inner(filled(x,0),filled(y,0)), + inner(x, y)) + assert eq(numpy.outer(filled(x,0),filled(y,0)), + outer(x, y)) y = array(['abc', 1, 'def', 2, 3], object) y[2] = masked t = take(y,[0,3,4]) diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index a5dd21dce..aae57f984 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -4,7 +4,7 @@ __all__ = ['atleast_1d','atleast_2d','atleast_3d','vstack','hstack', 'apply_along_axis', 'repmat', 'kron'] import numpy.core.numeric as _nx -from numpy.core.numeric import asarray, zeros, newaxis, outerproduct, \ +from numpy.core.numeric import asarray, zeros, newaxis, outer, \ concatenate, isscalar, array, asanyarray from numpy.core.oldnumeric import product, reshape @@ -576,7 +576,7 @@ def kron(a,b): a = reshape(a, a.shape) if not b.flags.contiguous: b = reshape(b, b.shape) - o = outerproduct(a,b) + o = outer(a,b) o=o.reshape(a.shape + b.shape) result = concatenate(concatenate(o, axis=1), axis=1) if wrapper is not None: diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py index 35f8d469c..4e787b26c 100644 --- a/numpy/linalg/linalg.py +++ b/numpy/linalg/linalg.py @@ -417,7 +417,7 @@ def det(a): lapack_routine = lapack_lite.dgetrf pivots = zeros((n,), 'i') results = lapack_routine(n, n, a, n, pivots, 0) - sign = add.reduce(not_equal(pivots, arrayrange(1, n+1))) % 2 + sign = add.reduce(not_equal(pivots, arange(1, n+1))) % 2 return (1.-2.*sign)*multiply.reduce(diagonal(a),axis=-1) # Linear Least Squares |
