Skip to content

Commit 5bf81c9

Browse files
authored
docs: Added sparse.max docstring (#730)
1 parent ecf14ff commit 5bf81c9

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Please adhere to the following guidelines:
5353

5454
1. Start your pull request title with a [conventional commit](https://www.conventionalcommits.org/) tag. This helps us add your contribution to the right section of the changelog. We use "Type" from the [Angular convention](https://github.com/angular/angular/blob/22b96b9/CONTRIBUTING.md#type).<br>
5555
TLDR:<br>
56-
The PR title should start with any of these abbreviatons: `build`, `chore`, `ci`, `depr`,
56+
The PR title should start with any of these abbreviations: `build`, `chore`, `ci`, `depr`,
5757
`docs`, `feat`, `fix`, `perf`, `refactor`, `release`, `test`. Add a `!`at the end, if it is a breaking change. For example `refactor!`.
5858
2. This text will end up in the changelog.
5959
3. Please follow the instructions in the pull request form and submit.

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ markdown_extensions:
3030
- pymdownx.superfences
3131
- codehilite
3232
- toc:
33-
toc_depth: 2
33+
toc_depth: 3
3434
- pymdownx.arithmatex: # To display math content with KaTex
3535
generic: true
3636
- attr_list # To be able to link to a header on another page, use grids

sparse/numba_backend/_common.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,6 +2114,40 @@ def permute_dims(x, /, axes=None):
21142114

21152115

21162116
def max(x, /, *, axis=None, keepdims=False):
2117+
"""
2118+
Calculates the maximum value of the input array ``x``.
2119+
2120+
Parameters
2121+
----------
2122+
x: array
2123+
input array of a real-valued data type.
2124+
axis: Optional[Union[int, Tuple[int, ...]]]
2125+
axis or axes along which maximum values are computed.
2126+
By default, the maximum value are computed over the entire array.
2127+
If a tuple of integers, maximum values are computed over multiple axes. Default: ``None``.
2128+
keepdims: bool
2129+
If ``True``, the reduced axes (dimensions) are included in the result as singleton dimensions.
2130+
Accordingly, the result is compatible with the input array.
2131+
Otherwise, if ``False``, the reduced axes (dimensions) must not be included in the result. Default: ``False``.
2132+
2133+
Returns
2134+
-------
2135+
out: array
2136+
if the maximum value was computed over the entire array, a zero-dimensional array containing the maximum value.
2137+
Otherwise, a non-zero-dimensional array containing the maximum values.
2138+
The returned array has the same data type as ``x``.
2139+
2140+
Special Cases
2141+
-------------
2142+
For floating-point operands, if ``x_i`` is ``NaN``, the maximum value is ``NaN`` (i.e., ``NaN`` values propagate).
2143+
2144+
Examples
2145+
--------
2146+
>>> a = sparse.COO.from_numpy(np.array([[0, 1], [2, 0]]))
2147+
>>> o = sparse.max(a, axis=1)
2148+
>>> o.todense()
2149+
array([1, 2])
2150+
"""
21172151
return x.max(axis=axis, keepdims=keepdims)
21182152

21192153

0 commit comments

Comments
 (0)