heat.trigonometrics
Trig functions
Module Contents
- arccos(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute the trigonometric arccos, element-wise. Result is a
DNDarray
of the same shape asx
. Input elements outside [-1., 1.] are returned asNaN
. Ifout
was provided,arccos
is a reference to it.- Parameters:
Examples
>>> ht.arccos(ht.array([-1.,-0., 0.83])) DNDarray([3.1416, 1.5708, 0.5917], dtype=ht.float32, device=cpu:0, split=None)
- acosh(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute the inverse hyperbolic cosine, element-wise. Result is a
DNDarray
of the same shape asx
. Input elements outside [1., +infinity] are returned asNaN
. Ifout
was provided,acosh
is a reference to it.- Parameters:
Examples
>>> ht.acosh(ht.array([1., 10., 20.])) DNDarray([0.0000, 2.9932, 3.6883], dtype=ht.float32, device=cpu:0, split=None)
- arcsin(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute the trigonometric arcsin, element-wise. Result is a
DNDarray
of the same shape asx
. Input elements outside [-1., 1.] are returned asNaN
. Ifout
was provided,arcsin
is a reference to it.- Parameters:
Examples
>>> ht.arcsin(ht.array([-1.,-0., 0.83])) DNDarray([-1.5708, -0.0000, 0.9791], dtype=ht.float32, device=cpu:0, split=None)
- asinh(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute the inverse hyperbolic sine, element-wise. Result is a
DNDarray
of the same shape asx
. Input elements outside [-infinity., +infinity] are returned asNaN
. Ifout
was provided,asinh
is a reference to it.- Parameters:
Examples
>>> ht.asinh(ht.array([-10., 0., 10.])) DNDarray([-2.9982, 0.0000, 2.9982], dtype=ht.float32, device=cpu:0, split=None)
- arctan(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute the trigonometric arctan, element-wise. Result is a
DNDarray
of the same shape asx
. Input elements outside [-1., 1.] are returned asNaN
. Ifout
was provided,arctan
is a reference to it.- Parameters:
Examples
>>> ht.arctan(ht.arange(-6, 7, 2)) DNDarray([-1.4056, -1.3258, -1.1071, 0.0000, 1.1071, 1.3258, 1.4056], dtype=ht.float32, device=cpu:0, split=None)
- arctan2(x1: heat.core.dndarray.DNDarray, x2: heat.core.dndarray.DNDarray) heat.core.dndarray.DNDarray
Element-wise arc tangent of
x1/x2
choosing the quadrant correctly. Returns a newDNDarray
with the signed angles in radians between vector (x2
,``x1``) and vector (1,0)- Parameters:
Examples
>>> x = ht.array([-1, +1, +1, -1]) >>> y = ht.array([-1, -1, +1, +1]) >>> ht.arctan2(y, x) * 180 / ht.pi DNDarray([-135.0000, -45.0000, 45.0000, 135.0000], dtype=ht.float64, device=cpu:0, split=None)
- atanh(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute the inverse hyperbolic tangent, element-wise. Result is a
DNDarray
of the same shape asx
. Input elements outside [-1., 1.] are returned asNaN
. Ifout
was provided,atanh
is a reference to it.- Parameters:
Examples
>>> ht.atanh(ht.array([-1.,-0., 0.83])) DNDarray([ -inf, -0.0000, 1.1881], dtype=ht.float32, device=cpu:0, split=None)
- cos(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Return the trigonometric cosine, element-wise.
- Parameters:
x (ht.DNDarray) – The value for which to compute the trigonometric cosine.
out (ht.DNDarray or None, optional) – A location in which to store the results. If provided, it must have a broadcastable shape. If not provided or set to None, a fresh tensor is allocated.
Examples
>>> ht.cos(ht.arange(-6, 7, 2)) DNDarray([ 0.9602, -0.6536, -0.4161, 1.0000, -0.4161, -0.6536, 0.9602], dtype=ht.float32, device=cpu:0, split=None)
- cosh(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute the hyperbolic cosine, element-wise. Result is a
DNDarray
of the same shape asx
. Negative input elements are returned asNaN
. Ifout
was provided,cosh
is a reference to it.- Parameters:
Examples
>>> ht.cosh(ht.arange(-6, 7, 2)) DNDarray([201.7156, 27.3082, 3.7622, 1.0000, 3.7622, 27.3082, 201.7156], dtype=ht.float32, device=cpu:0, split=None)
- deg2rad(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Convert angles from degrees to radians.
- Parameters:
Examples
>>> ht.deg2rad(ht.array([0.,20.,45.,78.,94.,120.,180., 270., 311.])) DNDarray([0.0000, 0.3491, 0.7854, 1.3614, 1.6406, 2.0944, 3.1416, 4.7124, 5.4280], dtype=ht.float32, device=cpu:0, split=None)
- degrees(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Convert angles from radians to degrees.
- Parameters:
Examples
>>> ht.degrees(ht.array([0.,0.2,0.6,0.9,1.2,2.7,3.14])) DNDarray([ 0.0000, 11.4592, 34.3775, 51.5662, 68.7549, 154.6986, 179.9088], dtype=ht.float32, device=cpu:0, split=None)
- rad2deg(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Convert angles from radians to degrees.
- Parameters:
Examples
>>> ht.rad2deg(ht.array([0.,0.2,0.6,0.9,1.2,2.7,3.14])) DNDarray([ 0.0000, 11.4592, 34.3775, 51.5662, 68.7549, 154.6986, 179.9088], dtype=ht.float32, device=cpu:0, split=None)
- radians(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Convert angles from degrees to radians.
- Parameters:
Examples
>>> ht.radians(ht.array([0., 20., 45., 78., 94., 120., 180., 270., 311.])) DNDarray([0.0000, 0.3491, 0.7854, 1.3614, 1.6406, 2.0944, 3.1416, 4.7124, 5.4280], dtype=ht.float32, device=cpu:0, split=None)
- sin(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute the trigonometric sine, element-wise. Result is a
DNDarray
of the same shape asx
. Negative input elements are returned asNaN
. Ifout
was provided,sin
is a reference to it.- Parameters:
Examples
>>> ht.sin(ht.arange(-6, 7, 2)) DNDarray([ 0.2794, 0.7568, -0.9093, 0.0000, 0.9093, -0.7568, -0.2794], dtype=ht.float32, device=cpu:0, split=None)
- sinh(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute the hyperbolic sine, element-wise. Result is a
DNDarray
of the same shape asx
. Negative input elements are returned asNaN
. Ifout
was provided,sinh
is a reference to it.- Parameters:
Examples
>>> ht.sinh(ht.arange(-6, 7, 2)) DNDarray([-201.7132, -27.2899, -3.6269, 0.0000, 3.6269, 27.2899, 201.7132], dtype=ht.float32, device=cpu:0, split=None)
- tan(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute tangent element-wise. Result is a
DNDarray
of the same shape asx
. Equivalent tosin()
/cos()
element-wise. Ifout
was provided,tan
is a reference to it.- Parameters:
Examples
>>> ht.tan(ht.arange(-6, 7, 2)) DNDarray([ 0.2910, -1.1578, 2.1850, 0.0000, -2.1850, 1.1578, -0.2910], dtype=ht.float32, device=cpu:0, split=None)
- tanh(x: heat.core.dndarray.DNDarray, out: heat.core.dndarray.DNDarray | None = None) heat.core.dndarray.DNDarray
Compute the hyperbolic tangent, element-wise. Result is a
DNDarray
of the same shape asx
. Ifout
was provided,tanh
is a reference to it.- Parameters:
Examples
>>> ht.tanh(ht.arange(-6, 7, 2)) DNDarray([-1.0000, -0.9993, -0.9640, 0.0000, 0.9640, 0.9993, 1.0000], dtype=ht.float32, device=cpu:0, split=None)