diff --git a/dpnp/dpnp_algo/dpnp_elementwise_common.py b/dpnp/dpnp_algo/dpnp_elementwise_common.py index 926caeec73c..9c9276d3376 100644 --- a/dpnp/dpnp_algo/dpnp_elementwise_common.py +++ b/dpnp/dpnp_algo/dpnp_elementwise_common.py @@ -1279,7 +1279,7 @@ def dpnp_greater_equal(x1, x2, out=None, order="K"): dpnp.ndarray: An array containing the element-wise imaginary component of input. If the input is a real-valued data type, the returned array has - the same datat type. If the input is a complex floating-point + the same data type. If the input is a complex floating-point data type, the returned array has a floating-point data type with the same floating-point precision as complex input. """ @@ -2081,7 +2081,7 @@ def dpnp_proj(x, out=None, order="K"): dpnp.ndarray: An array containing the element-wise real component of input. If the input is a real-valued data type, the returned array has - the same datat type. If the input is a complex floating-point + the same data type. If the input is a complex floating-point data type, the returned array has a floating-point data type with the same floating-point precision as complex input. """ diff --git a/dpnp/dpnp_array.py b/dpnp/dpnp_array.py index fae6e98af91..185644e9b84 100644 --- a/dpnp/dpnp_array.py +++ b/dpnp/dpnp_array.py @@ -832,7 +832,8 @@ def imag(self): >>> import dpnp as np >>> x = np.sqrt(np.array([1+0j, 0+1j])) >>> x.imag - array([ 0. , 0.70710678]) + array([0. , 0.70710677]) + """ return dpnp.imag(self) @@ -841,7 +842,7 @@ def imag(self, value): if dpnp.issubsctype(self.dtype, dpnp.complexfloating): dpnp.copyto(self._array_obj.imag, value) else: - raise TypeError("dpnp.ndarray does not have imaginary part to set") + raise TypeError("array does not have imaginary part to set") def item(self, id=None): """ @@ -1010,7 +1011,8 @@ def real(self): >>> import dpnp as np >>> x = np.sqrt(np.array([1+0j, 0+1j])) >>> x.real - array([ 1. , 0.70710678]) + array([1. , 0.70710677]) + """ if dpnp.issubsctype(self.dtype, dpnp.complexfloating): return dpnp.real(self) diff --git a/dpnp/dpnp_iface_mathematical.py b/dpnp/dpnp_iface_mathematical.py index 4138ee4f309..3ca44b7c5cd 100644 --- a/dpnp/dpnp_iface_mathematical.py +++ b/dpnp/dpnp_iface_mathematical.py @@ -1206,12 +1206,14 @@ def imag( >>> import dpnp as np >>> a = np.array([1+2j, 3+4j, 5+6j]) >>> a.imag - array([2., 4., 6.]) + array([2., 4., 6.]) + >>> a.imag = np.array([8, 10, 12]) >>> a - array([1.+8.j, 3.+10.j, 5.+12.j]) + array([1. +8.j, 3.+10.j, 5.+12.j]) + >>> np.imag(np.array(1 + 1j)) - array(1.0) + array(1.) """ @@ -2000,6 +2002,7 @@ def proj( >>> np.proj(np.array([complex(1,np.inf), complex(1,-np.inf), complex(np.inf,-1),])) array([inf+0.j, inf-0.j, inf-0.j]) + """ return check_nd_call_func( @@ -2055,13 +2058,16 @@ def real( >>> import dpnp as np >>> a = np.array([1+2j, 3+4j, 5+6j]) >>> a.real - array([1., 3., 5.]) + array([1., 3., 5.]) + >>> a.real = 9 >>> a - array([9.+2.j, 9.+4.j, 9.+6.j]) + array([9.+2.j, 9.+4.j, 9.+6.j]) + >>> a.real = np.array([9, 8, 7]) >>> a - array([9.+2.j, 8.+4.j, 7.+6.j]) + array([9.+2.j, 8.+4.j, 7.+6.j]) + >>> np.real(np.array(1 + 1j)) array(1.)