package osdp

  1. Overview
  2. Docs

Gives an interface Scalar.S to linear expressions. Since to_float and div have no meaning for linear expressions, they are implemented as assert false. You should never use them. Simialr behavior for the moment for comparison functions. Moreover, the product of two linear expressions is a linear expression only when at least one of them is a constant. Not_linear is raised otherwise.

Parameters

module L : S

Signature

include Scalar.M with type t = L.t
type t = L.t
val compare : t -> t -> int

A few values.

val zero : t
val one : t

Conversion functions.

val of_float : float -> t
val to_float : t -> float
val of_q : Q.t -> t
val to_q : t -> Q.t

Arithmetic operations.

val add : t -> t -> t
val sub : t -> t -> t
val mult : t -> t -> t
val div : t -> t -> t

Printing.

val pp : Stdlib.Format.formatter -> t -> unit
val minus_one : t

More conversion functions.

val of_int : int -> t

More arithmetic operations.

val neg : t -> t
val inv : t -> t
val equal : t -> t -> bool
val leq : t -> t -> bool
val geq : t -> t -> bool
val lt : t -> t -> bool
val gt : t -> t -> bool
val sign : t -> int

Returns -1, 0 or 1 when its argument is respectively < 0, 0 or > 0.

Prefix and infix operators.

val (~-) : t -> t
val (+) : t -> t -> t
val (-) : t -> t -> t
val (*) : t -> t -> t
val (/) : t -> t -> t
val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (<=) : t -> t -> bool
val (>=) : t -> t -> bool
val (<) : t -> t -> bool
val (>) : t -> t -> bool