def __pow__(self, other): """Exponentiation by a scalar or elementwise by another :class:`Array`. """ if isinstance(other, Array): assert self.shape == other.shape result = self._new_like_me(_get_common_dtype(self, other)) knl = elementwise.get_pow_array_kernel(self.context, self.dtype, other.dtype, result.dtype) knl(self.queue, self._global_size, self._local_size, self.data, other.data, result.data, self.mem_size) return result else: result = self._new_like_me() knl(self.queue, self._global_size, self._local_size, other, self.data, result.data, self.mem_size) return result
def _pow_array(result, base, exponent): return elementwise.get_pow_array_kernel( result.context, base.dtype, exponent.dtype, result.dtype)