Skip to content

Commit a53cfb8

Browse files
committed
API: make mean private
1 parent 28e6f86 commit a53cfb8

File tree

1 file changed

+3
-40
lines changed

1 file changed

+3
-40
lines changed

src/array_api_extra/_funcs.py

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def cov(m: Array, /, *, xp: ModuleType) -> Array:
116116
m = atleast_nd(m, ndim=2, xp=xp)
117117
m = xp.astype(m, dtype)
118118

119-
avg = mean(m, axis=1, xp=xp)
119+
avg = _mean(m, axis=1, xp=xp)
120120
fact = m.shape[1] - 1
121121

122122
if fact <= 0:
@@ -133,7 +133,7 @@ def cov(m: Array, /, *, xp: ModuleType) -> Array:
133133
return xp.squeeze(c, axis=axes)
134134

135135

136-
def mean(
136+
def _mean(
137137
x: Array,
138138
/,
139139
*,
@@ -142,44 +142,7 @@ def mean(
142142
xp: ModuleType,
143143
) -> Array:
144144
"""
145-
Calculates the arithmetic mean of the input array ``x``.
146-
147-
In addition to the standard ``mean``, this function supports complex-valued input.
148-
149-
Parameters
150-
----------
151-
x: array
152-
input array. Should have a floating-point data type.
153-
axis: int or tuple of ints, optional
154-
axis or axes along which arithmetic means must be computed.
155-
By default, the mean must be computed over the entire array.
156-
If a tuple of integers, arithmetic means must be computed over multiple axes.
157-
Default: ``None``.
158-
keepdims: bool, optional
159-
if ``True``, the reduced axes (dimensions) must be included in the result as
160-
singleton dimensions, and, accordingly, the result must be compatible with
161-
the input array (see :ref:`broadcasting`).
162-
Otherwise, if ``False``, the reduced axes (dimensions) must not be included
163-
in the result. Default: ``False``.
164-
165-
Returns
166-
-------
167-
out: array
168-
if the arithmetic mean was computed over the entire array,
169-
a zero-dimensional array containing the arithmetic mean;
170-
otherwise, a non-zero-dimensional array containing the arithmetic means.
171-
The returned array must have the same data type as ``x``.
172-
173-
Notes
174-
-----
175-
176-
**Special Cases**
177-
178-
Let ``N`` equal the number of elements over which to compute the arithmetic mean.
179-
180-
- If ``N`` is ``0``, the arithmetic mean is ``NaN``.
181-
- If ``x_i`` is ``NaN``, the arithmetic mean is ``NaN``
182-
(i.e., ``NaN`` values propagate).
145+
Complex mean, https://github.com/data-apis/array-api/issues/846.
183146
"""
184147
if xp.isdtype(x.dtype, "complex floating"):
185148
x_real = xp.real(x)

0 commit comments

Comments
 (0)