summaryrefslogtreecommitdiff
path: root/src/poly.mli
blob: 4837142306c31f5640fc5f0423f069e78330533e (plain)
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


(* Programmed by Jedidiah Barber *)
(* Licensed under the Sunset License v1.0 *)


type t



val zero : t

val one : t

val singleton : coeff:Z.t -> expnt:Z.t -> t

val ( ~$ ) : Z.t * Z.t -> t



(* These two functions produce polynomials of degree zero. *)

val of_int : int -> t

val of_zint : Z.t -> t



(* The first values are the coefficients, the second values are the exponents. *)
(* Values given by to_* functions are in descending exponent order. *)

val to_list : t -> (Z.t * Z.t) list

val of_list : (Z.t * Z.t) list -> t

val to_array : t -> (Z.t * Z.t) array

val of_array : (Z.t * Z.t) array -> t



val degree : t -> Z.t

val get_coeff : expnt:Z.t -> t -> Z.t



val to_string : t -> string

val print : t -> unit

val output : Stdlib.out_channel -> t -> unit

val pp_print : Stdlib.Format.formatter -> t -> unit



val neg : t -> t

val add : t -> t -> t

val sub : t -> t -> t

val mul : t -> t -> t

val div_rem : t -> t -> t * t

val div : t -> t -> t

val rem : t -> t -> t



val ( + ) : t -> t -> t

val ( - ) : t -> t -> t

val ( * ) : t -> t -> t

val ( / ) : t -> t -> t