summaryrefslogtreecommitdiff
path: root/numpy/lib/twodim_base.py
diff options
context:
space:
mode:
authorFabian Pedregosa <fabian.pedregosa@inria.fr>2011-08-31 18:16:26 +0200
committerRalf Gommers <ralf.gommers@googlemail.com>2011-08-31 18:37:37 +0200
commit1af2f37eae78986b370e2d44df6c5156945d69d8 (patch)
treecafc7b5261da2873beae793182e72d96a7d14208 /numpy/lib/twodim_base.py
parentf3e70d9c0ea5db74033be9f437bb8e275839c9dc (diff)
downloadnumpy-1af2f37eae78986b370e2d44df6c5156945d69d8.tar.gz
FIX: Make tril/triu return the same dtype as the original array.
This should fix: * http://projects.scipy.org/numpy/ticket/1848 * http://projects.scipy.org/scipy/ticket/1449
Diffstat (limited to 'numpy/lib/twodim_base.py')
-rw-r--r--numpy/lib/twodim_base.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/lib/twodim_base.py b/numpy/lib/twodim_base.py
index 12bba99a6..6fb348275 100644
--- a/numpy/lib/twodim_base.py
+++ b/numpy/lib/twodim_base.py
@@ -413,7 +413,7 @@ def tril(m, k=0):
"""
m = asanyarray(m)
- out = multiply(tri(m.shape[0], m.shape[1], k=k, dtype=int),m)
+ out = multiply(tri(m.shape[0], m.shape[1], k=k, dtype=m.dtype),m)
return out
def triu(m, k=0):
@@ -439,7 +439,7 @@ def triu(m, k=0):
"""
m = asanyarray(m)
- out = multiply((1 - tri(m.shape[0], m.shape[1], k - 1, int)), m)
+ out = multiply((1 - tri(m.shape[0], m.shape[1], k - 1, dtype=m.dtype)), m)
return out
# borrowed from John Hunter and matplotlib