
/*****************************************************************************\

MODULE: vec_ZZ_p

SUMMARY:

Provides vectors over ZZ_p, along with some related operations.

Implementation note: the BlockConstruct routine has been
customized for ZZ_p so that when a vector(ZZ_p) is grown,
space for the needed elements is allocated in one
contiguous chunk.  This saves on calls to malloc and free,
and should also yield better locality of reference.
One connsequence of this is that swapping an element
of a vector(ZZ_p) with another ZZ_p can not be implemented
by pointer swap, and will in this case be done by copy.

\*****************************************************************************/

#include "ZZ_p.h"
#include "vec_ZZ.h"
#include "vector.h"

vector_decl(ZZ_p)

vector_io_decl(ZZ_p)
// I/O operators are defined

vector_eq_decl(ZZ_p)
// operators == and != are defined

void operator<<(vector(ZZ_p)& x, const vector(ZZ)& a);
// x.SetLength(a.length())
// x[i] << a[i]  (0 <= i < a.length())

void operator<<(vector(ZZ)& x, const vector(ZZ_p)& a);
// x.SetLength(a.length())
// x[i] << a[i]  (0 <= i < a.length())

void mul(vector(ZZ_p)& x, const vector(ZZ_p)& a, const ZZ_p& b);
// x = a * b

void add(vector(ZZ_p)& x, const vector(ZZ_p)& a, const vector(ZZ_p)& b);
// x = a + b

void sub(vector(ZZ_p)& x, const vector(ZZ_p)& a, const vector(ZZ_p)& b);
// x = a - b

void clear(vector(ZZ_p)& x);
// x = 0 (length unchanged)

void negate(vector(ZZ_p)& x, const vector(ZZ_p)& a);
// x = -a


void InnerProduct(ZZ_p& x, const vector(ZZ_p)& a, const vector(ZZ_p)& b);
// x = sum_{i=0}^{n-1} a[i]*b[i], where n = min(a.length(), b.length())

void InnerProduct(ZZ_p& x, const vector(ZZ_p)& a, const vector(ZZ_p)& b,
                  long offset);
// x = sum_{i=offset}^n a[i]*b[i-offset], 
// where n = min(a.length(), b.length()+offset)


