Skip to content

Add complex number support to log10 #536

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 1 commit into from
Dec 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add complex number support to log10
  • Loading branch information
kgryte committed Dec 1, 2022
commit 6acda34e1eebd518ba9e8d682f2d85c77ffa59db
20 changes: 15 additions & 5 deletions spec/API_specification/array_api/elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -983,28 +983,38 @@ def log2(x: array, /) -> array:
"""

def log10(x: array, /) -> array:
"""
Calculates an implementation-dependent approximation to the base ``10`` logarithm, having domain ``[0, +infinity]`` and codomain ``[-infinity, +infinity]``, for each element ``x_i`` of the input array ``x``.
r"""
Calculates an implementation-dependent approximation to the base ``10`` logarithm for each element ``x_i`` of the input array ``x``.

**Special cases**

For floating-point operands,
For real-valued floating-point operands,

- If ``x_i`` is ``NaN``, the result is ``NaN``.
- If ``x_i`` is less than ``0``, the result is ``NaN``.
- If ``x_i`` is either ``+0`` or ``-0``, the result is ``-infinity``.
- If ``x_i`` is ``1``, the result is ``+0``.
- If ``x_i`` is ``+infinity``, the result is ``+infinity``.

For complex floating-point operands, special cases must be handled as if the operation is implemented using the standard change of base formula

.. math::
\log_{10} x = \frac{\log_{e} x}{\log_{e} 10}

where :math:`\log_{e}` is the natural logarithm, as implemented by :func:`~array_api.log`.

.. note::
For complex floating-point operands, ``log10(conj(x))`` must equal ``conj(log10(x))``.

Parameters
----------
x: array
input array. Should have a real-valued floating-point data type.
input array. Should have a floating-point data type.

Returns
-------
out: array
an array containing the evaluated base ``10`` logarithm for each element in ``x``. The returned array must have a real-valued floating-point data type determined by :ref:`type-promotion`.
an array containing the evaluated base ``10`` logarithm for each element in ``x``. The returned array must have a floating-point data type determined by :ref:`type-promotion`.
"""

def logaddexp(x1: array, x2: array, /) -> array:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy