Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vtavana committed Sep 14, 2023
1 parent 3b4a35c commit 43e66cc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions dpnp/dpnp_algo/dpnp_elementwise_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down Expand Up @@ -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.
"""
Expand Down
8 changes: 5 additions & 3 deletions dpnp/dpnp_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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):
"""
Expand Down Expand Up @@ -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)
Expand Down
18 changes: 12 additions & 6 deletions dpnp/dpnp_iface_mathematical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
"""

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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.)
Expand Down

0 comments on commit 43e66cc

Please sign in to comment.