def imag(self): dtype = self.dtype if issubclass(self.dtype.type, np.complexfloating): from pytools import match_precision real_dtype = match_precision(np.dtype(np.float64), dtype) result = self._new_like_me(dtype=real_dtype) func = elementwise.get_imag_kernel(dtype, real_dtype) func.set_block_shape(*self._block) func.prepared_async_call(self._grid, None, self.gpudata, result.gpudata, self.mem_size) return result else: return zeros_like(self)
def imag(self): dtype = self.dtype if issubclass(self.dtype.type, numpy.complexfloating): from pytools import match_precision real_dtype = match_precision(numpy.dtype(numpy.float64), dtype) result = self._new_like_me(dtype=real_dtype) func = elementwise.get_imag_kernel(dtype, real_dtype) func.set_block_shape(*self._block) func.prepared_async_call(self._grid, None, self.gpudata, result.gpudata, self.mem_size) return result else: return zeros_like(self)
def imag(self): dtype = self.dtype if issubclass(self.dtype.type, np.complexfloating): if not self.flags.forc: raise RuntimeError("only contiguous arrays may " "be used as arguments to this operation") from pytools import match_precision real_dtype = match_precision(np.dtype(np.float64), dtype) result = self._new_like_me(dtype=real_dtype) func = elementwise.get_imag_kernel(dtype, real_dtype) func.prepared_async_call(self._grid, self._block, None, self.gpudata, result.gpudata, self.mem_size) return result else: return zeros_like(self)