Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-19 08:08:30

0001 // General vectors of modular integers.
0002 
0003 #ifndef _CL_GV_MODINTEGER_H
0004 #define _CL_GV_MODINTEGER_H
0005 
0006 #include "cln/modinteger.h"
0007 #include "cln/GV_integer.h"
0008 
0009 namespace cln {
0010 
0011 // A vector of modular integers (over the same modular integer ring)
0012 // is just a normal vector of integers, with maxbits() operation.
0013 
0014 template <>
0015 struct cl_heap_GV<_cl_MI> : cl_heap {
0016     cl_GV_inner<_cl_MI> v;
0017     // here room for the elements
0018 };
0019 typedef cl_heap_GV<_cl_MI> cl_heap_GV_MI;
0020 
0021 struct cl_GV_MI : public cl_GV<_cl_MI,cl_GV_any> {
0022 public:
0023     // Constructors.
0024     cl_GV_MI ();
0025     cl_GV_MI (const cl_GV_MI&);
0026     // Create a vector of modular integers.
0027     cl_GV_MI (std::size_t len, cl_heap_modint_ring* R);
0028     // Assignment operators.
0029     cl_GV_MI& operator= (const cl_GV_MI&);
0030     // Number m of bits allowed per element (-1 if unconstrained).
0031     sintC maxbits () const
0032     {
0033         return ((const cl_heap_GV_I *) pointer)->maxbits();
0034     }
0035 };
0036 inline cl_GV_MI::cl_GV_MI (const cl_GV_MI& x) : cl_GV<_cl_MI,cl_GV_any> (as_cl_private_thing(x)) {}
0037 CL_DEFINE_ASSIGNMENT_OPERATOR(cl_GV_MI,cl_GV_MI)
0038 inline cl_GV_MI::cl_GV_MI ()
0039     : cl_GV<_cl_MI,cl_GV_any> ((cl_heap_GV_MI*) (cl_heap_GV_I*) cl_null_GV_I) {}
0040 inline cl_GV_MI::cl_GV_MI (std::size_t len, cl_heap_modint_ring* R)
0041     : cl_GV<_cl_MI,cl_GV_any> ((cl_heap_GV_MI*) cl_make_heap_GV_I(len,R->bits)) {}
0042 
0043 // Copy a vector.
0044 inline const cl_GV_MI copy (const cl_GV_MI& vector)
0045 {
0046     return The(cl_GV_MI) (copy((const cl_GV_I&) vector));
0047 }
0048 
0049 }  // namespace cln
0050 
0051 #endif /* _CL_GV_MODINTEGER_H */