summaryrefslogtreecommitdiff
path: root/numpy/oldnumeric/mlab.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-08-05 08:05:11 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-08-05 08:05:11 +0000
commit1a83cc8b5cfc71b5a7f01a5dcefcd4de4e306cfd (patch)
tree0b060887ba2345a57a73dfcacc83f185da41e340 /numpy/oldnumeric/mlab.py
parentd372798ae6bf88c3a4414027341d2b0322941c68 (diff)
downloadnumpy-1a83cc8b5cfc71b5a7f01a5dcefcd4de4e306cfd.tar.gz
Update eye and tri to take dtype in mlab
Diffstat (limited to 'numpy/oldnumeric/mlab.py')
-rw-r--r--numpy/oldnumeric/mlab.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/oldnumeric/mlab.py b/numpy/oldnumeric/mlab.py
index 5ef48d61a..3d39ef0a9 100644
--- a/numpy/oldnumeric/mlab.py
+++ b/numpy/oldnumeric/mlab.py
@@ -13,23 +13,23 @@ from numpy import tril, trapz as _Ntrapz, hanning, rot90, triu, diff, \
from numpy.linalg import eig, svd
from numpy.random import rand, randn
-from typeconv import oldtype2dtype as o2d
+from typeconv import convtypecode
-def eye(N, M=None, k=0, typecode=None):
+def eye(N, M=None, k=0, typecode=None, dtype=None):
""" eye returns a N-by-M 2-d array where the k-th diagonal is all ones,
and everything else is zeros.
"""
- dtype = o2d[typecode]
+ dtype = convtypecode(typecode, dtype)
if M is None: M = N
m = nn.equal(nn.subtract.outer(nn.arange(N), nn.arange(M)),-k)
if m.dtype != dtype:
return m.astype(dtype)
-def tri(N, M=None, k=0, typecode=None):
+def tri(N, M=None, k=0, typecode=None, dtype=None):
""" returns a N-by-M array where all the diagonals starting from
lower left corner up to the k-th are all ones.
"""
- dtype = o2d[typecode]
+ dtype = convtypecode(typecode, dtype)
if M is None: M = N
m = nn.greater_equal(nn.subtract.outer(nn.arange(N), nn.arange(M)),-k)
if m.dtype != dtype: