def __rdiv__(self, other):
"""
Being divided
other / self
Parameters
----------
other: scalar or Pitcharray
Returns
-------
out : PitchArray
A new PitchArray
"""
"""
# this part it not necessary
if isinstance(other, PitchArray):
if self.shape != other.shape:
raise ValueError("array dimension misaligned")
result = self._new_like_me(_get_common_dtype(self, other))
if self.size:
if self.M == 1:
func = pu.get_divarray_function(
other.dtype, self.dtype, result.dtype, pitch = False)
func.prepared_call(
self._grid, self._block, result.gpudata,
other.gpudata, self.gpudata, self.size)
else:
func = pu.get_divarray_function(
other.dtype, self.dtype, result.dtype, pitch = True)
func.prepared_call(
self._grid, self._block, self.M, self.N,
result.gpudata, result.ld, other.gpudata,
other.ld, self.gpudata, self.ld)
return result
"""
if issubclass(type(other), (float, int, complex, np.integer,
np.floating, np.complexfloating)):
dtype = _get_common_dtype_with_scalar(other, self)
result = self._new_like_me(dtype)
if self.size:
if self.M == 1:
func = pu.get_scalardiv_function(
self.dtype, dtype, pitch = False)
func.prepared_call(
self._grid, self._block, result.gpudata,
self.gpudata, other, self.size)
else:
func = pu.get_scalardiv_function(
self.dtype, dtype, pitch = True)
func.prepared_call(
self._grid, self._block, self.M, self.N,
result.gpudata, result.ld, self.gpudata,
self.ld, other)
return result
else:
raise TypeError("type of object to be divided from"
"is not supported")
评论列表
文章目录