Skip to content

Commit e33a4db

Browse files
committed
address comments
1 parent 988f2fc commit e33a4db

File tree

3 files changed

+19
-47
lines changed

3 files changed

+19
-47
lines changed

dpnp/backend/extensions/vm/types_matrix.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ template <typename T>
5353
struct AbsOutputType
5454
{
5555
using value_type = typename std::disjunction<
56+
// TODO: Add complex type here after updating the dispatching to allow
57+
// output type to be different than input
5658
dpctl_td_ns::TypeMapResultEntry<T, double>,
5759
dpctl_td_ns::TypeMapResultEntry<T, float>,
5860
dpctl_td_ns::DefaultResultEntry<void>>::result_type;

dpnp/backend/extensions/vm/vm_py.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ PYBIND11_MODULE(_vm_impl, m)
114114
};
115115
m.def("_abs", abs_pyapi,
116116
"Call `abs` function from OneMKL VM library to compute "
117-
"the absolute of vector elements",
117+
"the absolute value of vector elements",
118118
py::arg("sycl_queue"), py::arg("src"), py::arg("dst"),
119119
py::arg("depends") = py::list());
120120

dpnp/dpnp_iface_mathematical.py

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -127,46 +127,6 @@
127127
]
128128

129129

130-
def abs(
131-
x,
132-
/,
133-
out=None,
134-
*,
135-
order="K",
136-
where=True,
137-
dtype=None,
138-
subok=True,
139-
**kwargs,
140-
):
141-
"""
142-
Calculate the absolute value element-wise.
143-
144-
For full documentation refer to :obj:`numpy.absolute`.
145-
146-
Notes
147-
-----
148-
:obj:`dpnp.abs` is a shorthand for :obj:`dpnp.absolute`.
149-
150-
Examples
151-
--------
152-
>>> import dpnp as np
153-
>>> a = np.array([-1.2, 1.2])
154-
>>> np.abs(a)
155-
array([1.2, 1.2])
156-
157-
"""
158-
159-
return dpnp.absolute(
160-
x,
161-
out,
162-
order="K",
163-
where=where,
164-
dtype=dtype,
165-
subok=subok,
166-
**kwargs,
167-
)
168-
169-
170130
def absolute(
171131
x,
172132
/,
@@ -198,16 +158,23 @@ def absolute(
198158
199159
See Also
200160
--------
201-
:obj:`dpnp.abs` : is a shorthand for this function..
202161
:obj:`dpnp.fabs` : Calculate the absolute value element-wise excluding complex types.
203162
163+
Notes
164+
-----
165+
``dpnp.abs`` is a shorthand for this function.
166+
204167
Examples
205168
--------
206-
>>> import dpnp as dp
207-
>>> a = dp.array([-1.2, 1.2])
208-
>>> dp.absolute(a)
169+
>>> import dpnp as np
170+
>>> a = np.array([-1.2, 1.2])
171+
>>> np.absolute(a)
209172
array([1.2, 1.2])
210173
174+
>>> a = np.array(1.2 + 1j)
175+
>>> np.absolute(a)
176+
array(1.5620499351813308)
177+
211178
"""
212179

213180
return check_nd_call_func(
@@ -223,6 +190,9 @@ def absolute(
223190
)
224191

225192

193+
abs = absolute
194+
195+
226196
def add(
227197
x1,
228198
x2,
@@ -835,7 +805,7 @@ def fabs(x1, **kwargs):
835805
836806
See Also
837807
--------
838-
:obj:`dpnp.abs` : Calculate the absolute value element-wise.
808+
:obj:`dpnp.absolute` : Calculate the absolute value element-wise.
839809
840810
Examples
841811
--------
@@ -2152,7 +2122,7 @@ def proj(
21522122
21532123
See Also
21542124
--------
2155-
:obj:`dpnp.abs` : Returns the magnitude of a complex number, element-wise.
2125+
:obj:`dpnp.absolute` : Returns the magnitude of a complex number, element-wise.
21562126
:obj:`dpnp.conj` : Return the complex conjugate, element-wise.
21572127
21582128
Examples

0 commit comments

Comments
 (0)