Module Owl_base_mathsSource

Maths: fundamental and advanced mathematical functions.

Basic functions
Sourceval add : float -> float -> float

``add x y``

Sourceval sub : float -> float -> float

``sub x y``

Sourceval mul : float -> float -> float

``mul x y``

Sourceval div : float -> float -> float

``div x y``

Sourceval atan2 : float -> float -> float

``atan2 x y``

Sourceval abs : float -> float

``abs x``

Sourceval neg : float -> float

``neg x``

Sourceval floor : float -> float

``floor x``

Sourceval ceil : float -> float

``ceil x``

Sourceval round : float -> float

``round x``

Sourceval trunc : float -> float

``trunc x``

Sourceval sqr : float -> float

``sqr x``

Sourceval sqrt : float -> float

``sqrt x``

Sourceval pow : float -> float -> float

``pow x``

Sourceval exp : float -> float

``exp x``

Sourceval log : float -> float

``log x``

Sourceval log2 : float -> float

``log2 x``

Sourceval log10 : float -> float

``log10 x``

Sourceval sigmoid : float -> float

``sigmod x``

Sourceval signum : float -> float

``signum x``

Sourceval relu : float -> float

``relu x``

Sourceval sin : float -> float

``sin x``

Sourceval cos : float -> float

``cos x``

Sourceval tan : float -> float

``tan x``

Sourceval asin : float -> float

``asin x``

Sourceval acos : float -> float

``acos x``

Sourceval atan : float -> float

``atan x``

Sourceval sinh : float -> float

``sinh x``

Sourceval cosh : float -> float

``cosh x``

Sourceval tanh : float -> float

``tanh x``

Sourceval asinh : float -> float

``asinh x``

Sourceval acosh : float -> float

``acosh x``

Sourceval atanh : float -> float

``atanh x``

Helper functions
Sourceval is_nan : float -> bool

``is_nan x`` returns ``true`` if ``x`` is ``nan``.

Sourceval is_inf : float -> bool

``is_inf x`` returns ``true`` if ``x`` is ``infinity`` or ``neg_infinity``.

Sourceval is_odd : int -> bool

``is_odd x`` returns ``true`` if ``x`` is odd.

Sourceval is_even : int -> bool

``is_even x`` returns ``true`` if ``x`` is even.

Sourceval is_pow2 : int -> bool

``is_pow2 x`` return ``true`` if ``x`` is integer power of 2, e.g. 32, 64, etc.

Sourceval same_sign : float -> float -> bool

``same_sign x y`` returns ``true`` if ``x`` and ``y`` have the same sign, otherwise it returns ``false``. Positive and negative zeros are special cases and always returns ``true``.

Sourceval is_simplex : float array -> bool

``is_simplex x`` checks whether ``x`` is simplex. In other words, :math:`\sum_i^K x_i = 1` and :math:`x_i \ge 0, \forall x_i \in 1,K`.