summaryrefslogtreecommitdiff
path: root/scipy/base/matrix.py
diff options
context:
space:
mode:
Diffstat (limited to 'scipy/base/matrix.py')
-rw-r--r--scipy/base/matrix.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/scipy/base/matrix.py b/scipy/base/matrix.py
index 34a4673c8..56fcefb74 100644
--- a/scipy/base/matrix.py
+++ b/scipy/base/matrix.py
@@ -55,7 +55,8 @@ class matrix(N.ndarray):
return data.astype(dtype)
if dtype is None:
- dtype = N.float
+ if isinstance(data, N.ndarray):
+ dtype = data.dtype
intype = N.obj2dtype(dtype)
if isinstance(data, types.StringType):
@@ -79,7 +80,7 @@ class matrix(N.ndarray):
if not (fortran or arr.flags['CONTIGUOUS']):
arr = arr.copy()
- ret = N.ndarray.__new__(matrix, shape, intype, buffer=arr,
+ ret = N.ndarray.__new__(matrix, shape, arr.dtype, buffer=arr,
fortran=fortran,
swap=(not arr.flags['NOTSWAPPED']))
return ret;