math_util#

Math utils functions.

Module Contents#

Tan(x)

Computes tangent of x element-wise.

Tanh(x)

Computes hyperbolic tangent of x element-wise.

TanC(x, c)

A unified tangent and inverse tangent function for different signs of curvatures.

ArTan(x)

Computes inverse tangent of x element-wise.

ArTanh(x)

Computes inverse hyperbolic tangent of x element-wise.

ArTanC(x, c)

A unified hyperbolic tangent and inverse hyperbolic tangent function for different signs of curvatures.

Cos(x)

Computes cosine of x element-wise.

Cosh(x)

Computes hyperbolic cosine of x element-wise.

ArCos(x)

Computes inverse cosine of x element-wise.

ArCosh(x)

Computes inverse hyperbolic cosine of x element-wise.

Sin(x)

Computes sine of x element-wise.

Sinh(x)

Computes hyperbolic sine of x element-wise.

SinC(x, c)

A unified sine and inverse sine function for different signs of curvatures.

ArSin(x)

Computes inverse sine of x element-wise.

ArSinh(x)

Computes inverse hyperbolic sine of x element-wise.

ArSinC(x, c)

A unified hyperbolic sine and inverse hyperbolic sine function for different signs of curvatures.

Tan(x)#

Computes tangent of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

A tensor. Has the same type as x.

Tanh(x)#

Computes hyperbolic tangent of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type as x.

Return type:

A tensor

TanC(x, c)#

A unified tangent and inverse tangent function for different signs of curvatures.

This function is used in k-Stereographic model, a unification of constant curvature manifolds. Please refer to https://arxiv.org/abs/2007.07698 for more details.

First-order expansion is used in order to calculate gradients correctly when c is zero.

Parameters:
  • x (tensor) – A tensor.

  • c (tensor) – Manifold curvature.

Returns:

Has the same type of x.

Return type:

A tensor

ArTan(x)#

Computes inverse tangent of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type as x.

Return type:

A tensor

ArTanh(x)#

Computes inverse hyperbolic tangent of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type as x.

Return type:

A tensor

ArTanC(x, c)#

A unified hyperbolic tangent and inverse hyperbolic tangent function for different signs of curvatures.

This function is used in k-Stereographic model, a unification of constant curvature manifolds. Please refer to https://arxiv.org/abs/2007.07698 for more details.

First-order expansion is used in order to calculate gradients correctly when c is zero.

Parameters:
  • x (tensor) – A tensor.

  • c (tensor) – Manifold curvature.

Returns:

Has the same type of x.

Return type:

A tensor

Cos(x)#

Computes cosine of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type of x.

Return type:

A tensor

Cosh(x)#

Computes hyperbolic cosine of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type of x.

Return type:

A tensor

ArCos(x)#

Computes inverse cosine of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type of x.

Return type:

A tensor

ArCosh(x)#

Computes inverse hyperbolic cosine of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type of x.

Return type:

A tensor

Sin(x)#

Computes sine of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type of x.

Return type:

A tensor

Sinh(x)#

Computes hyperbolic sine of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type of x.

Return type:

A tensor

SinC(x, c)#

A unified sine and inverse sine function for different signs of curvatures.

This function is used in k-Stereographic model, a unification of constant curvature manifolds. Please refer to https://arxiv.org/abs/2007.07698 for more details.

First-order expansion is used in order to calculate gradients correctly when c is zero.

Parameters:
  • x (tensor) – A tensor.

  • c (tensor) – Manifold curvature.

Returns:

Has the same type of x.

Return type:

A tensor

ArSin(x)#

Computes inverse sine of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type of x.

Return type:

A tensor

ArSinh(x)#

Computes inverse hyperbolic sine of x element-wise.

Parameters:

x (tensor) – A tensor.

Returns:

Has the same type of x.

Return type:

A tensor

ArSinC(x, c)#

A unified hyperbolic sine and inverse hyperbolic sine function for different signs of curvatures.

This function is used in k-Stereographic model, a unification of constant curvature manifolds. Please refer to https://arxiv.org/abs/2007.07698 for more details.

First-order expansion is used in order to calculate gradients correctly when c is zero.

Parameters:
  • x (tensor) – A tensor.

  • c (tensor) – Manifold curvature.

Returns:

Has the same type of x.

Return type:

A tensor