[Numpy-svn] r2966 - trunk/numpy/oldnumeric

numpy-svn at scipy.org numpy-svn at scipy.org
Sat Aug 5 03:05:13 CDT 2006


Author: oliphant
Date: 2006-08-05 03:05:11 -0500 (Sat, 05 Aug 2006)
New Revision: 2966

Modified:
   trunk/numpy/oldnumeric/mlab.py
Log:
Update eye and tri to take dtype in mlab

Modified: trunk/numpy/oldnumeric/mlab.py
===================================================================
--- trunk/numpy/oldnumeric/mlab.py	2006-08-05 07:50:50 UTC (rev 2965)
+++ trunk/numpy/oldnumeric/mlab.py	2006-08-05 08:05:11 UTC (rev 2966)
@@ -13,23 +13,23 @@
 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:



More information about the Numpy-svn mailing list