diff options
author | Julian Taylor <juliantaylor108@gmail.com> | 2014-07-29 22:48:35 +0200 |
---|---|---|
committer | Julian Taylor <juliantaylor108@gmail.com> | 2014-07-29 22:48:35 +0200 |
commit | 2ad538899928c249af456d93f250ebbd7535dcff (patch) | |
tree | bdac30c97cecbb3b8b65ec91b352eeade7a41c0c /numpy/lib/twodim_base.py | |
parent | c50a2da70b4a5b5d23636c454b04d8afa7642d36 (diff) | |
parent | a7c788c2dfcc9e44bab1ca69c1473785f31e3f70 (diff) | |
download | numpy-2ad538899928c249af456d93f250ebbd7535dcff.tar.gz |
Merge pull request #4916 from yotam/triu-dtype-fix
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 |