github.com/jiajun1992/watercarver@v0.0.0-20191031150618-dfc2b17c0c4a/StadiumForWaterCarver/src/Mod_p.h (about) 1 /* 2 * Mod_p.h 3 * 4 * Created on: 15.09.2010 5 * Author: stephaniebayer 6 * 7 * An instance of thi class represents an element of Z_p. The class gives all operators and functionality needed. 8 * 9 */ 10 11 #ifndef MOD_P_H_ 12 #define MOD_P_H_ 13 14 #include "FakeZZ.h" 15 #include "CurvePoint.h" 16 NTL_CLIENT 17 18 class Mod_p { 19 private: 20 CurvePoint val; //Value of the element 21 ZZ mod; //Modular value 22 public: 23 //Constructors and destructor 24 Mod_p(); 25 Mod_p(CurvePoint v, ZZ p); 26 Mod_p(const Mod_p& other); 27 virtual ~Mod_p(); 28 29 // added: explicit initializer 30 Mod_p(bool dummy); 31 32 //Access to the parameters 33 ZZ get_mod() const; 34 CurvePoint get_val() const; 35 36 //operators 37 void operator =(const Mod_p& el); 38 Mod_p operator *(const Mod_p& b) const; 39 bool operator ==(const Mod_p& b) const; 40 bool operator !=(const Mod_p& b) const; 41 42 friend ostream& operator<<(ostream& os, const Mod_p& b); 43 friend istream& operator>>(istream& is, Mod_p& b); 44 45 //Returns the inverse of an element 46 static void inv(Mod_p& a, const Mod_p& el); 47 48 //multiplication and exponentiation functions 49 static void mult(Mod_p& a,const Mod_p& b , const Mod_p& c); 50 static void expo(Mod_p& a,const Mod_p& b, const long e); 51 static void expo(Mod_p& a, const Mod_p& b,const ZZ e); 52 Mod_p expo(const ZZ e); 53 54 55 }; 56 57 #endif /* MOD_P_H_ */