1 // General vectors of modular integers.
3 #ifndef _CL_GV_MODINTEGER_H
4 #define _CL_GV_MODINTEGER_H
6 #include "cln/modinteger.h"
7 #include "cln/GV_integer.h"
11 // A vector of modular integers (over the same modular integer ring)
12 // is just a normal vector of integers, with maxbits() operation.
15 struct cl_heap_GV<_cl_MI> : cl_heap {
16 cl_GV_inner<_cl_MI> v;
17 // here room for the elements
19 typedef cl_heap_GV<_cl_MI> cl_heap_GV_MI;
21 struct cl_GV_MI : public cl_GV<_cl_MI,cl_GV_any> {
25 cl_GV_MI (const cl_GV_MI&);
26 // Create a vector of modular integers.
27 cl_GV_MI (uintC len, cl_heap_modint_ring* R);
28 // Assignment operators.
29 cl_GV_MI& operator= (const cl_GV_MI&);
30 // Number m of bits allowed per element (-1 if unconstrained).
31 sintC maxbits () const
33 return ((const cl_heap_GV_I *) pointer)->maxbits();
36 inline cl_GV_MI::cl_GV_MI (const cl_GV_MI& x) : cl_GV<_cl_MI,cl_GV_any> (as_cl_private_thing(x)) {}
37 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_GV_MI,cl_GV_MI)
38 inline cl_GV_MI::cl_GV_MI ()
39 : cl_GV<_cl_MI,cl_GV_any> ((cl_heap_GV_MI*) (cl_heap_GV_I*) cl_null_GV_I) {}
40 inline cl_GV_MI::cl_GV_MI (uintC len, cl_heap_modint_ring* R)
41 : cl_GV<_cl_MI,cl_GV_any> ((cl_heap_GV_MI*) cl_make_heap_GV_I(len,R->bits)) {}
44 inline const cl_GV_MI copy (const cl_GV_MI& vector)
46 return The(cl_GV_MI) (copy((const cl_GV_I&) vector));
51 #endif /* _CL_GV_MODINTEGER_H */