-
Notifications
You must be signed in to change notification settings - Fork 1
/
ff.go
45 lines (43 loc) · 1022 Bytes
/
ff.go
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
// Package ff contains the interfaces describing finite fields and their
// elements.
package ff
// Field defines the methods that a finite field must support
type Field interface {
Card() uint
Char() uint
Element(interface{}) (Element, error)
ElementFromSigned(int) Element
ElementFromString(string) (Element, error)
ElementFromUnsigned(uint) Element
Elements() []Element
MultGenerator() Element
One() Element
RandElement() Element
RegexElement(bool) string
String() string
Zero() Element
}
// Element defines the methods that an element of a finite field must support
type Element interface {
Add(Element) Element
Copy() Element
Equal(Element) bool
Err() error
Inv() Element
IsNonzero() bool
IsOne() bool
IsZero() bool
Minus(Element) Element
Mult(Element) Element
Neg() Element
NTerms() uint
Plus(Element) Element
Pow(uint) Element
Prod(Element, Element) Element
SetNeg() Element
SetUnsigned(uint) Element
String() string
Sub(Element) Element
Times(Element) Element
Trace() Element
}