-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfield.h
33 lines (22 loc) · 886 Bytes
/
field.h
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
/* generic interface for finite-field operations */
typedef int Field;
/* returns the order in use */
int getOrder();
/* adds two field elements (modulo order addition) */
Field add(Field a, Field b);
/* multiplies two field elements (modulo order multiplication) */
Field mult(Field a, Field b);
/* returns the zero element of the field (s.t. x+0 = x, x*0 = 0) */
Field zero();
/* returns -a (s.t. a + (-a) = 0) */
Field neg(Field a);
/* whether a is zero or not */
int isZero(Field a);
/* adds two n-dimentional vectors on the field */
Field * vadd(Field *a, Field *b, int n);
/* subtracts two n-dimentional vectors on the field */
Field * vsub(Field *a, Field *b, int n);
/* performs scalar multiplication on a vector */
void vmult(Field *a, Field x, int n);
/* returns a string on the heap containing a hex representation of a vector */
char * tohexstr(Field *a, int n);