File: zZp.mli

package info (click to toggle)
sks 1.1.6-14
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,296 kB
  • sloc: ml: 15,228; ansic: 1,069; sh: 358; makefile: 347
file content (132 lines) | stat: -rw-r--r-- 4,879 bytes parent folder | download | duplicates (5)
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
(***********************************************************************)
(* zZp.mli - Field of integers mod p (for a settable prime p)          *)
(*                                                                     *)
(* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, *)
(*               2011, 2012, 2013  Yaron Minsky and Contributors       *)
(*                                                                     *)
(* This file is part of SKS.  SKS is free software; you can            *)
(* redistribute it and/or modify it under the terms of the GNU General *)
(* Public License as published by the Free Software Foundation; either *)
(* version 2 of the License, or (at your option) any later version.    *)
(*                                                                     *)
(* This program is distributed in the hope that it will be useful, but *)
(* WITHOUT ANY WARRANTY; without even the implied warranty of          *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   *)
(* General Public License for more details.                            *)
(*                                                                     *)
(* You should have received a copy of the GNU General Public License   *)
(* along with this program; if not, write to the Free Software         *)
(* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *)
(* USA or see <http://www.gnu.org/licenses/>.                          *)
(***********************************************************************)

type zz
type zzref
type mut_array
val order : Number.z ref
val nbits : int ref
val nbytes : int ref
val two : zz
val zero : zz
val one : zz
val set_order : zz -> unit
val num_bytes : unit -> int
val of_bytes : string -> zz
val to_bytes : zz -> string
val of_int : int -> zz
val to_N : 'a -> 'a
val of_N : zz -> zz
val add : zz -> zz -> zz
val sub : zz -> zz -> zz
val mul : zz -> zz -> zz
val mult : zz -> zz -> zz
val imult : zz -> int -> zz
val add_fast : zz -> zz -> zz
val mul_fast : zz -> zz -> zz
val mult_fast : zz -> zz -> zz
val canonicalize : zz -> zz
val square : zz -> zz
val square_fast : zz -> zz
val imul : zz -> zz -> zz
val neg : zz -> zz
val inv : zz -> zz
val div : zz -> zz -> zz
(* val sub_fast : zz -> zz -> zz *)
val lt : zz -> zz -> bool
val gt : zz -> zz -> bool
val eq : zz -> zz -> bool
val neq : zz -> zz -> bool
val to_string : zz -> string
val of_string : string -> zz
val print : zz -> unit
val points : int -> zz array
val svalues : int -> mut_array
val mult_in : zzref -> zz -> zz -> unit
(* val mult_fast_in : zzref -> zz -> zz -> unit *)
val add_in : zzref -> zz -> zz -> unit
(* val add_fast_in : zzref -> zz -> zz -> unit *)
val sub_in : zzref -> zz -> zz -> unit
(* val sub_fast_in : zzref -> zz -> zz -> unit *)
val copy_in : zzref -> zz -> unit
val copy_out : zzref -> zz
val make_ref : zz -> zzref
val look : zzref -> zz
val canonicalize_in : zzref -> unit
val add_el_array : points: zz array -> zz -> zz array
val del_el_array : points: zz array -> zz -> zz array
val mult_array : svalues:mut_array -> zz array -> unit
val add_el : svalues:mut_array -> points:zz array -> zz -> unit
val del_el : svalues:mut_array -> points:zz array -> zz -> unit
val array_mult : zz array -> zz array -> zz array
val mut_array_div : mut_array -> mut_array -> zz array
val mut_array_copy : mut_array -> mut_array
val cmp : zz -> zz -> int
val length : mut_array -> int
val mut_array_to_array : mut_array -> zz array
val mut_array_of_array : zz array -> mut_array
val to_string_array : zz -> string array
val rand : (unit -> int) -> zz

(** Set specialized to ZZp.zz *)
module Set :
  sig
    type elt = zz
    type t
    val empty : t
    val is_empty : t -> bool
    val mem : elt -> t -> bool
    val add : elt -> t -> t
    val singleton : elt -> t
    val remove : elt -> t -> t
    val union : t -> t -> t
    val inter : t -> t -> t
    val diff : t -> t -> t
    val compare : t -> t -> int
    val equal : t -> t -> bool
    val subset : t -> t -> bool
    val iter : f:(elt -> unit) -> t -> unit
    val fold : f:(elt -> 'a -> 'a) -> t -> init:'a -> 'a
    val for_all : f:(elt -> bool) -> t -> bool
    val exists : f:(elt -> bool) -> t -> bool
    val filter : f:(elt -> bool) -> t -> t
    val partition : f:(elt -> bool) -> t -> t * t
    val cardinal : t -> int
    val elements : t -> elt list
    val min_elt : t -> elt
    val max_elt : t -> elt
    val choose : t -> elt
    val split : elt -> t -> t * bool * t
  end
val zset_of_list : zz list -> Set.t
val canonical_of_number : Number.z -> zz
val of_number : Number.z -> zz
val to_number : zz -> Number.z
module Infix :
  sig
    val ( +: ) : zz -> zz -> zz
    val ( -: ) : zz -> zz -> zz
    val ( *: ) : zz -> zz -> zz
    val ( /: ) : zz -> zz -> zz
    val ( =: ) : zz -> zz -> bool
    val ( <>: ) : zz -> zz -> bool
  end