package ocplib-simplex

  1. Overview
  2. Docs
module R = R
module V = V

Type

type t = private {
  1. v : V.t;
    (*

    The raw value of the bound.

    *)
  2. offset : R.t;
    (*

    The number of epsilons to add to the bound.

    *)
}

Constructors

val zero : t

The zero bound with no offset.

val of_r : V.t -> t

From a rational r, returns the Rat2 representation with no offset.

val upper : V.t -> t

From a rational r, returns r - Ɛ.

val lower : V.t -> t

From a rational r, returns r + Ɛ.

Algebraic operations

val minus : t -> t

From a bound r + kƐ, returns -r -kƐ.

val add : t -> t -> t

Adds two bounds.

val sub : t -> t -> t

Substracts two bounds.

val mult_by_const : R.t -> t -> t

Multiplies a bound by a rational constant (both v and offset are multiplied).

val div_by_const : R.t -> t -> t

Divides a bound by a constant. Fails if the constant is zero.

Comparison functions

val compare : t -> t -> int

Compares two bounds; returns 0 iff the two bounds are strictly equal.

val equal : t -> t -> bool

Returns true iff the bounds are strictly equal.

val is_zero : t -> bool

Returns true iff the bound in argument is zero.

val is_pure_rational : t -> bool

Returns true iff the offset is 0.

val is_int : t -> bool

Returns true iff the offset is 0 and the field v is an integer.

Misc

val floor : t -> t

Returns the greatest (pure) integer smaller or equal to the argument.

val ceiling : t -> t

Returns the smallest (pure) integer greater or equal to the argument.

val print : Format.formatter -> t -> unit

Prints a bound.

OCaml

Innovation. Community. Security.