# [Scipy-svn] r3430 - trunk/scipy/sparse

scipy-svn@scip... scipy-svn@scip...
Tue Oct 9 19:33:52 CDT 2007

```Author: stefan
Date: 2007-10-09 19:33:40 -0500 (Tue, 09 Oct 2007)
New Revision: 3430

Modified:
trunk/scipy/sparse/sparse.py
Log:
Remove type checking from sparse array constructor.

Modified: trunk/scipy/sparse/sparse.py
===================================================================
--- trunk/scipy/sparse/sparse.py	2007-10-10 00:02:53 UTC (rev 3429)
+++ trunk/scipy/sparse/sparse.py	2007-10-10 00:33:40 UTC (rev 3430)
@@ -272,7 +272,7 @@

def __imul__(self, other):
raise NotImplementedError
-
+
def __idiv__(self, other):
return self.__itruediv__(other)

@@ -635,7 +635,7 @@
return self._binopt(other,fn)
else:
raise NotImplementedError
-
+
def __itruediv__(self, other): #self *= other
if isscalarlike(other):
recip = 1.0 / other
@@ -779,7 +779,7 @@
i1 = num + i1

return i0, i1
-
+
elif isscalar( sl ):
if sl < 0:
sl += num
@@ -1933,7 +1933,7 @@
except AttributeError:
tr = asarray(other).transpose()
return self.transpose().dot(tr).transpose()
-
+
def __truediv__(self, other):           # self * other
if isscalarlike(other):
new = dok_matrix(self.shape, dtype=self.dtype)
@@ -1945,7 +1945,7 @@
else:
return self.tocsr() / other

-
+
def __itruediv__(self, other):           # self * other
if isscalarlike(other):
# Multiply this scalar by every element.
@@ -2788,12 +2788,6 @@
else:
newdtype = numpy.dtype(dtype)

-    allowed = 'fdFD'
-    if newdtype.char not in allowed:
-        if default is None or canCast:
-            newdtype = numpy.dtype( 'd' )
-        else:
-            raise TypeError, "dtype must be one of 'fdFD'"
return newdtype

```

More information about the Scipy-svn mailing list