Base.Maths

This document is auto-generated for Owl’s APIs. #79 entries have been extracted.

Github: {Signature} {Implementation}

Basic functions

val add : float -> float -> float

add x y

source code

val sub : float -> float -> float

sub x y

source code

val mul : float -> float -> float

mul x y

source code

val div : float -> float -> float

div x y

source code

val fmod : float -> float -> float

fmod x y

source code

val atan2 : float -> float -> float

atan2 x y

source code

val hypot : float -> float -> float

hypot x y

source code

val abs : float -> float

abs x

source code

val neg : float -> float

neg x

source code

val reci : float -> float

reci x

source code

val floor : float -> float

floor x

source code

val ceil : float -> float

ceil x

source code

val round : float -> float

round x

source code

val trunc : float -> float

trunc x

source code

val fix : float -> float

fix x

source code

val sqr : float -> float

sqr x

source code

val sqrt : float -> float

sqrt x

source code

val cbrt : float -> float

cbrt x

source code

val pow : float -> float -> float

pow x

source code

val exp : float -> float

exp x

source code

val exp2 : float -> float

exp2 x

source code

val exp10 : float -> float

exp10 x

source code

val expm1 : float -> float

expm1 x

source code

val log : float -> float

log x

source code

val log2 : float -> float

log2 x

source code

val log10 : float -> float

log10 x

source code

val log1p : float -> float

log1p x

source code

val sigmoid : float -> float

sigmod x

source code

val signum : float -> float

signum x

source code

val softsign : float -> float

softsign x

source code

val softplus : float -> float

softplus x

source code

val relu : float -> float

relu x

source code

val sin : float -> float

sin x

source code

val cos : float -> float

cos x

source code

val tan : float -> float

tan x

source code

val cot : float -> float

cot x

source code

val sec : float -> float

sec x

source code

val csc : float -> float

csc x

source code

val asin : float -> float

asin x

source code

val acos : float -> float

acos x

source code

val atan : float -> float

atan x

source code

val acot : float -> float

cot x

source code

val asec : float -> float

sec x

source code

val acsc : float -> float

csc x

source code

val sinh : float -> float

sinh x

source code

val cosh : float -> float

cosh x

source code

val tanh : float -> float

tanh x

source code

val asinh : float -> float

asinh x

source code

val acosh : float -> float

acosh x

source code

val atanh : float -> float

atanh x

source code

val acoth : float -> float

coth x

source code

val asech : float -> float

sech x

source code

val acsch : float -> float

csch x

source code

val xlogy : float -> float -> float

xlogy(x, y)

source code

val xlog1py : float -> float -> float

xlog1py(x, y)

source code

val logit : float -> float

logit(x)

source code

val expit : float -> float

expit(x)

source code

val log1mexp : float -> float

log1mexp(x)

source code

val log1pexp : float -> float

log1pexp(x)

source code

Error functions

val erf : float -> float

erf(x)

source code

val erfc : float -> float

erfc(x)

source code

val erfcx : float -> float

erfcx(x)

source code

Helper functions

val is_nan : float -> bool

is_nan x returns true if x is nan.

source code

val is_inf : float -> bool

is_inf x returns true if x is infinity or neg_infinity.

source code

val is_normal : float -> bool

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

source code

val is_subnormal : float -> bool

is_nan x returns true if x is subnormal float number.

source code

val is_odd : int -> bool

is_odd x returns true if x is odd.

source code

val is_even : int -> bool

is_even x returns true if x is even.

source code

val is_pow2 : int -> bool

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

source code

val 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.

source code

val 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]\).

source code

val is_sqr : int -> bool

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

source code

val mulmod : int -> int -> int -> int

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

source code

val powmod : int -> int -> int -> int

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

source code

val 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.

source code

val 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.

source code