diff options
author | Yotam Doron <doron.yotam@googlemail.com> | 2014-07-29 15:59:26 +0100 |
---|---|---|
committer | Yotam Doron <doron.yotam@googlemail.com> | 2014-07-29 19:43:08 +0100 |
commit | a7c788c2dfcc9e44bab1ca69c1473785f31e3f70 (patch) | |
tree | d99e4f477a7fd0bc5f5b7d62c8d4451884c2a31a /numpy/lib/twodim_base.py | |
parent | d61ee81e0220318ebe9404f0381c7fdfe189f647 (diff) | |
download | numpy-a7c788c2dfcc9e44bab1ca69c1473785f31e3f70.tar.gz |
BUG: Avoid type promotion in tril and triu.
Diffstat (limited to 'numpy/lib/twodim_base.py')
-rw-r--r-- | numpy/lib/twodim_base.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/lib/twodim_base.py b/numpy/lib/twodim_base.py index f26ff0619..7670da1ed 100644 --- a/numpy/lib/twodim_base.py +++ b/numpy/lib/twodim_base.py @@ -453,7 +453,7 @@ def tril(m, k=0): m = asanyarray(m) mask = tri(*m.shape[-2:], k=k, dtype=bool) - return where(mask, m, 0) + return where(mask, m, zeros(1, m.dtype)) def triu(m, k=0): @@ -481,7 +481,7 @@ def triu(m, k=0): m = asanyarray(m) mask = tri(*m.shape[-2:], k=k-1, dtype=bool) - return where(mask, 0, m) + return where(mask, zeros(1, m.dtype), m) # Originally borrowed from John Hunter and matplotlib |