-
Notifications
You must be signed in to change notification settings - Fork 23
Update dpnp.ndarray
docstrings
#2422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
f292bb6
Add a blank line prior Default
antonwolfy fafb86f
Enable pylink hook
antonwolfy 88c9a2c
Add missing docstrings to methods and attributes
antonwolfy e0b0868
Add links to missing attriburtes and methods on reference page
antonwolfy bf1489b
Reorder methods by lexicographical order
antonwolfy 3ac22b8
Add docstring to a file
antonwolfy 3eb1ff9
Add inplace ignoring of flake8 warnings
antonwolfy ad46975
Fix typos in the docstrings
antonwolfy ec8d389
Use \text command in math
antonwolfy 53b1a36
Correct link towards operator.index() in docs
antonwolfy 873b6b5
Add description to axis, dtype and out keyword
antonwolfy 8345a05
Add missing :nosignatures:
antonwolfy 3ae8eff
Align signature of methods with numpy.ndarray
antonwolfy 7b59ad6
Update test to pass out as a keyword only argument
antonwolfy 199c4f9
Replace "Returns" word with "Return" in the docstring
antonwolfy 06e9984
Add a page with constants documented and set a proper reference on dp…
antonwolfy 6be05db
Add PR to the changelog
antonwolfy a571c9a
Apply suggestions from code review
antonwolfy 694b969
Update CHANGELOG.md
antonwolfy e8127d4
Aligned examples per review comment
antonwolfy aae481a
Clarify common description of out keyword
antonwolfy 649f01f
Update dpnp/dpnp_array.py
antonwolfy 77b8529
Return NotImplemented when non-default mod is passed to __pow__ and _…
antonwolfy 844d4ed
Merge branch 'master' into update-ndarray-docstrings
vtavana File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
Constants | ||
================================= | ||
antonwolfy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
DPNP includes several constants: | ||
|
||
.. currentmodule:: dpnp | ||
|
||
.. autodata:: DLDeviceType | ||
|
||
.. data:: e | ||
|
||
Euler's constant, base of natural logarithms, Napier's constant. | ||
|
||
``e = 2.71828182845904523536028747135266249775724709369995...`` | ||
|
||
.. rubric:: See Also | ||
|
||
:func:`exp` : Exponential function | ||
|
||
:func:`log` : Natural logarithm | ||
|
||
.. rubric:: References | ||
|
||
https://en.wikipedia.org/wiki/E_%28mathematical_constant%29 | ||
|
||
|
||
.. data:: euler_gamma | ||
|
||
``γ = 0.5772156649015328606065120900824024310421...`` | ||
|
||
.. rubric:: References | ||
|
||
https://en.wikipedia.org/wiki/Euler%27s_constant | ||
|
||
|
||
.. data:: inf | ||
|
||
IEEE 754 floating point representation of (positive) infinity. | ||
|
||
.. rubric:: Returns | ||
|
||
y : float | ||
A floating point representation of positive infinity. | ||
|
||
.. rubric:: See Also | ||
|
||
:func:`isinf` : Shows which elements are positive or negative infinity | ||
|
||
:func:`isposinf` : Shows which elements are positive infinity | ||
|
||
:func:`isneginf` : Shows which elements are negative infinity | ||
|
||
:func:`isnan` : Shows which elements are Not a Number | ||
|
||
:func:`isfinite` : Shows which elements are finite (not one of Not a Number, | ||
positive infinity and negative infinity) | ||
|
||
.. rubric:: Notes | ||
|
||
DPNP uses the IEEE Standard for Binary Floating-Point for Arithmetic | ||
(IEEE 754). This means that Not a Number is not equivalent to infinity. | ||
Also that positive infinity is not equivalent to negative infinity. But | ||
infinity is equivalent to positive infinity. | ||
|
||
.. rubric:: Examples | ||
|
||
.. code-block:: python | ||
>>> import dpnp as np | ||
>>> np.inf | ||
inf | ||
>>> np.array([1]) / 0.0 | ||
array([inf]) | ||
.. data:: nan | ||
|
||
IEEE 754 floating point representation of Not a Number (NaN). | ||
|
||
.. rubric:: Returns | ||
|
||
y : A floating point representation of Not a Number. | ||
|
||
.. rubric:: See Also | ||
|
||
:func:`isnan` : Shows which elements are Not a Number | ||
|
||
:func:`isfinite` : Shows which elements are finite (not one of Not a Number, | ||
positive infinity and negative infinity) | ||
|
||
.. rubric:: Notes | ||
|
||
DPNP uses the IEEE Standard for Binary Floating-Point for Arithmetic | ||
(IEEE 754). This means that Not a Number is not equivalent to infinity. | ||
|
||
.. rubric:: Examples | ||
|
||
.. code-block:: python | ||
>>> import dpnp as np | ||
>>> np.nan | ||
nan | ||
>>> np.log(np.array(-1)) | ||
array(nan) | ||
>>> np.log(np.array([-1, 1, 2])) | ||
array([ nan, 0. , 0.69314718]) | ||
.. data:: newaxis | ||
|
||
A convenient alias for *None*, useful for indexing arrays. | ||
|
||
.. rubric:: Examples | ||
|
||
.. code-block:: python | ||
>>> import dpnp as np | ||
>>> np.newaxis is None | ||
True | ||
>>> x = np.arange(3) | ||
>>> x | ||
array([0, 1, 2]) | ||
>>> x[:, np.newaxis] | ||
array([[0], | ||
[1], | ||
[2]]) | ||
antonwolfy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
>>> x[:, np.newaxis, np.newaxis] | ||
array([[[0]], | ||
[[1]], | ||
[[2]]]) | ||
>>> x[:, np.newaxis] * x | ||
array([[0, 0, 0], | ||
[0, 1, 2], | ||
[0, 2, 4]]) | ||
Outer product, same as ``outer(x, y)``: | ||
>>> y = np.arange(3, 6) | ||
>>> x[:, np.newaxis] * y | ||
array([[ 0, 0, 0], | ||
[ 3, 4, 5], | ||
[ 6, 8, 10]]) | ||
``x[np.newaxis, :]`` is equivalent to ``x[np.newaxis]`` and ``x[None]``: | ||
>>> x[np.newaxis, :].shape | ||
(1, 3) | ||
>>> x[np.newaxis].shape | ||
(1, 3) | ||
>>> x[None].shape | ||
(1, 3) | ||
>>> x[:, np.newaxis].shape | ||
(3, 1) | ||
.. data:: pi | ||
|
||
``pi = 3.1415926535897932384626433...`` | ||
|
||
.. rubric:: References | ||
|
||
https://en.wikipedia.org/wiki/Pi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.