?? vec_gf2e.txt
字號:
/**************************************************************************\MODULE: vec_GF2ESUMMARY:Provides vectors over GF2E, along with some related operations.\**************************************************************************/#include <NTL/GF2E.h>#include <NTL/vector.h>NTL_vector_decl(GF2E,vec_GF2E)NTL_io_vector_decl(GF2E,vec_GF2E)// I/O operators are definedNTL_eq_vector_decl(GF2E,vec_GF2E)// operators == and != are definedvoid mul(vec_GF2E& x, const vec_GF2E& a, const GF2E& b);void mul(vec_GF2E& x, const vec_GF2E& a, GF2 b);void mul(vec_GF2E& x, const vec_GF2E& a, long b);void mul(vec_GF2E& x, const GF2E& a, const vec_GF2E& b);void mul(vec_GF2E& x, GF2 a, const vec_GF2E& b);void mul(vec_GF2E& x, long a, const vec_GF2E& b);// x = a * bvoid add(vec_GF2E& x, const vec_GF2E& a, const vec_GF2E& b);// x = a + bvoid sub(vec_GF2E& x, const vec_GF2E& a, const vec_GF2E& b);// x = a - b = x + avoid negate(vec_GF2E& x, const vec_GF2E& a);// x = - a = avoid clear(vec_GF2E& x);// x = 0 (length unchanged)long IsZero(const vec_GF2E& a);// test if a is the zero vectorvoid InnerProduct(GF2E& x, const vec_GF2E& a, const vec_GF2E& b);// x = sum_{i=0}^{n-1} a[i]*b[i], where n = min(a.length(), b.length())void InnerProduct(GF2E& x, const vec_GF2E& a, const vec_GF2E& b, long offset);// x = sum_{i=offset}^n a[i]*b[i-offset], where n = min(a.length(),// b.length()+offset)void VectorCopy(vec_GF2E& x, const vec_GF2E& a, long n);vec_GF2E VectorCopy(const vec_GF2E& a, long n);// x = a copy of a of length exactly n.// The input is truncated or padded with zeroes, as necessary.// operator notation:vec_GF2E operator+(const vec_GF2E& a, const vec_GF2E& b);vec_GF2E operator-(const vec_GF2E& a, const vec_GF2E& b);vec_GF2E operator-(const vec_GF2E& a);// vector/scalar multiplication:vec_GF2E operator*(const vec_GF2E& a, const GF2E& b);vec_GF2E operator*(const vec_GF2E& a, GF2 b);vec_GF2E operator*(const vec_GF2E& a, long b);vec_GF2E operator*(const GF2E& a, const vec_GF2E& b);vec_GF2E operator*(GF2 a, const vec_GF2E& b);vec_GF2E operator*(long a, const vec_GF2E& b);// inner product:GF2E operator*(const vec_GF2E& a, const vec_GF2E& b);// assignment operator notation:vec_GF2E& operator+=(vec_GF2E& x, const vec_GF2E& a);vec_GF2E& operator-=(vec_GF2E& x, const vec_GF2E& a);vec_GF2E& operator*=(vec_GF2E& x, const GF2E& a);vec_GF2E& operator*=(vec_GF2E& x, GF2 a);vec_GF2E& operator*=(vec_GF2E& x, long a);// Implementation note: the BlockConstruct routine has been customized// for GF2E so that when a vec_GF2E 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 consequence of this is that swapping an element of a vec_GF2E// with another GF2E can not be implemented by pointer swap, and will in// this case be done by copy.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -