-
Notifications
You must be signed in to change notification settings - Fork 0
/
linear.mli
37 lines (31 loc) · 885 Bytes
/
linear.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
(*
Incremental linear algebra solver
(C) 2008, Nathan Mishra-Linger
License: BSD
*)
(* CR: parameterize this code by the underlying field of scalars *)
module Var : sig
type t with compare
val create : unit -> t
end
(* linear algebra expressions *)
type t
val var : Var.t -> t
val fresh : unit -> t (* var (Var.create ()) *)
val const : float -> t
val times : float -> t -> t
val div : t -> float -> t
val plus : t -> t -> t
val minus : t -> t -> t
val negate : t -> t
val one : t
val zero : t
val sum : t list -> t
(* solver: assert equations and determine expression values *)
val equate : t -> t -> unit
(* throws *)
exception Inconsistent
(* if equation is inconsistent w.r.t. previously asserted equations *)
exception Redundant
(* if equation is redundant w.r.t. previously asserted equations *)
val value : t -> float option