[Scipy-svn] r3752 - in trunk/scipy/sparse: . tests
scipy-svn at scipy.org
scipy-svn at scipy.org
Mon Dec 31 16:17:40 EST 2007
Author: wnbell
Date: 2007-12-31 15:17:31 -0600 (Mon, 31 Dec 2007)
New Revision: 3752
Modified:
trunk/scipy/sparse/sputils.py
trunk/scipy/sparse/tests/test_base.py
trunk/scipy/sparse/tests/test_sputils.py
Log:
float96 -> longdouble
should address #575
Modified: trunk/scipy/sparse/sputils.py
===================================================================
--- trunk/scipy/sparse/sputils.py 2007-12-31 08:51:39 UTC (rev 3751)
+++ trunk/scipy/sparse/sputils.py 2007-12-31 21:17:31 UTC (rev 3752)
@@ -7,9 +7,12 @@
import numpy
# keep this list syncronized with sparsetools
-supported_dtypes = ['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32',
- 'int64', 'uint64', 'float32', 'float64', 'float96',
- 'complex64', 'complex128', 'complex192']
+#supported_dtypes = ['int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32',
+# 'int64', 'uint64', 'float32', 'float64',
+# 'complex64', 'complex128']
+supported_dtypes = ['int8','uint8','short','ushort','intc','uintc',
+ 'longlong','ulonglong','single','double','longdouble',
+ 'csingle','cdouble','clongdouble']
supported_dtypes = [ numpy.typeDict[x] for x in supported_dtypes]
def upcast(*args):
Modified: trunk/scipy/sparse/tests/test_base.py
===================================================================
--- trunk/scipy/sparse/tests/test_base.py 2007-12-31 08:51:39 UTC (rev 3751)
+++ trunk/scipy/sparse/tests/test_base.py 2007-12-31 21:17:31 UTC (rev 3752)
@@ -23,6 +23,7 @@
from scipy.sparse import csc_matrix, csr_matrix, dok_matrix, \
coo_matrix, lil_matrix, dia_matrix, bsr_matrix, \
extract_diagonal, speye, spkron, SparseEfficiencyWarning
+from scipy.sparse.sputils import supported_dtypes
from scipy.linsolve import splu
restore_path()
@@ -302,7 +303,7 @@
assert_equal( result.shape, (4,2) )
assert_equal( result, dot(a,b) )
- def check_conversions(self):
+ def check_formatconversions(self):
A = spkron([[1,0,1],[0,1,1],[1,0,0]], [[1,1],[0,1]] )
D = A.todense()
A = self.spmatrix(A)
@@ -657,16 +658,11 @@
self.Asp = self.spmatrix(self.A)
self.Bsp = self.spmatrix(self.B)
- #supported types
- self.dtypes = ['int8','uint8','int16','uint16','int32','uint32',
- 'int64','uint64','float32','float64','float96',
- 'complex64','complex128','complex192']
-
- def check_conversion(self):
+ def check_astype(self):
self.arith_init()
#check whether dtype and value is preserved in conversion
- for x in self.dtypes:
+ for x in supported_dtypes:
A = self.A.astype(x)
B = self.B.astype(x)
@@ -684,10 +680,10 @@
assert_array_equal((self.Asp+self.Bsp).todense(),self.A+self.B)
#check conversions
- for x in self.dtypes:
+ for x in supported_dtypes:
A = self.A.astype(x)
Asp = self.spmatrix(A)
- for y in self.dtypes:
+ for y in supported_dtypes:
B = self.B.astype(y)
Bsp = self.spmatrix(B)
@@ -716,10 +712,10 @@
#basic tests
assert_array_equal((self.Asp*self.Bsp.T).todense(),self.A*self.B.T)
- for x in self.dtypes:
+ for x in supported_dtypes:
A = self.A.astype(x)
Asp = self.spmatrix(A)
- for y in self.dtypes:
+ for y in supported_dtypes:
B = self.B.astype(y)
Bsp = self.spmatrix(B)
Modified: trunk/scipy/sparse/tests/test_sputils.py
===================================================================
--- trunk/scipy/sparse/tests/test_sputils.py 2007-12-31 08:51:39 UTC (rev 3751)
+++ trunk/scipy/sparse/tests/test_sputils.py 2007-12-31 21:17:31 UTC (rev 3752)
@@ -12,7 +12,7 @@
class TestSparseUtils(NumpyTestCase):
def check_upcast(self):
- assert_equal(upcast('int32'),numpy.int32)
+ assert_equal(upcast('intc'),numpy.intc)
assert_equal(upcast('int32','float32'),numpy.float64)
assert_equal(upcast('bool',complex,float),numpy.complex128)
assert_equal(upcast('i','d'),numpy.float64)
More information about the Scipy-svn
mailing list