package owl-base

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

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 fmod : float -> float -> float

fmod x y

Sourceval atan2 : float -> float -> float

atan2 x y

Sourceval hypot : float -> float -> float

hypot x y

Sourceval abs : float -> float

abs x

Sourceval neg : float -> float

neg x

Sourceval reci : float -> float

reci 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 fix : float -> float

fix x

Sourceval sqr : float -> float

sqr x

Sourceval sqrt : float -> float

sqrt x

Sourceval cbrt : float -> float

cbrt x

Sourceval pow : float -> float -> float

pow x

Sourceval exp : float -> float

exp x

Sourceval exp2 : float -> float

exp2 x

Sourceval exp10 : float -> float

exp10 x

Sourceval expm1 : float -> float

expm1 x

Sourceval log : float -> float

log x

Sourceval log2 : float -> float

log2 x

Sourceval log10 : float -> float

log10 x

Sourceval log1p : float -> float

log1p x

Sourceval sigmoid : float -> float

sigmod x

Sourceval signum : float -> float

signum x

Sourceval softsign : float -> float

softsign x

Sourceval softplus : float -> float

softplus x

Sourceval relu : float -> float

relu x

Sourceval dawsn : float -> float

dawsn x

Sourceval sin : float -> float

sin x

Sourceval cos : float -> float

cos x

Sourceval tan : float -> float

tan x

Sourceval cot : float -> float

cot x

Sourceval sec : float -> float

sec x

Sourceval csc : float -> float

csc x

Sourceval asin : float -> float

asin x

Sourceval acos : float -> float

acos x

Sourceval atan : float -> float

atan x

Sourceval acot : float -> float

cot x

Sourceval asec : float -> float

sec x

Sourceval acsc : float -> float

csc 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

Sourceval acoth : float -> float

coth x

Sourceval asech : float -> float

sech x

Sourceval acsch : float -> float

csch x

Sourceval xlogy : float -> float -> float

xlogy(x, y)

Sourceval xlog1py : float -> float -> float

xlog1py(x, y)

Sourceval logit : float -> float

logit(x)

Sourceval expit : float -> float

expit(x)

Sourceval log1mexp : float -> float

log1mexp(x)

Sourceval log1pexp : float -> float

log1pexp(x)

Error functions
Sourceval erf : float -> float

erf(x)

Sourceval erfc : float -> float

erfc(x)

Sourceval erfcx : float -> float

erfcx(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_normal : float -> bool

is_normal x returns true if x is a normal float number.

Sourceval is_subnormal : float -> bool

is_nan x returns true if x is subnormal float number.

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, \sum_i^K x_i = 1 and x_i \ge 0, \forall x_i \in [1,K].

Sourceval is_int : float -> bool
Sourceval is_sqr : int -> bool

is_sqr x checks if x is the square of an integer.

Sourceval mulmod : int -> int -> int -> int

mulmod a b m computes (a*b) mod m.

Sourceval powmod : int -> int -> int -> int

powmod a b m computes (a^b) mod m.

Sourceval is_prime : int -> bool

is_prime x returns true if x is a prime number. The function is deterministic for all numbers representable by an int. The function uses the Rabin–Miller primality test.

Sourceval fermat_fact : int -> int * int

fermat_fact x performs Fermat factorisation over x, i.e. into two roughly equal factors. x must be an odd number.