Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated __abs__ so that it returns the correct dtype for int dtypes a…

…nd does not promote to float
  • Loading branch information...
commit 1bbc9d6017ec4fae9e98a433f4f88815d0f3b590 1 parent 3f890ca
@ahnitz ahnitz authored committed
Showing with 6 additions and 3 deletions.
  1. +6 −3 pycuda/gpuarray.py
View
9 pycuda/gpuarray.py
@@ -564,9 +564,12 @@ def __abs__(self):
else:
fname = "abs"
- from pytools import match_precision
- out_dtype = match_precision(np.dtype(np.float64), self.dtype)
- result = self._new_like_me(out_dtype)
+ if issubclass(self.dtype.type, np.complexfloating):
+ from pytools import match_precision
+ out_dtype = match_precision(np.dtype(np.float64), self.dtype)
+ result = self._new_like_me(out_dtype)
+ else:
+ out_dtype = self.dtype
func = elementwise.get_unary_func_kernel(fname, self.dtype,
out_dtype=out_dtype)
Please sign in to comment.
Something went wrong with that request. Please try again.