Tree @debian/9.9.1-2 (Download .tar.gz)
- ..
- BasicThreadPool.c
- BerlekampTest.c
- BerlekampTestIn
- BerlekampTestOut
- BitMatTest.c
- c_lip_impl.h
- CanZassTest.c
- CanZassTestIn
- CanZassTestOut
- cfile
- CharPolyTest.c
- CharPolyTestIn
- CharPolyTestOut
- CheckAVX.c
- CheckCLZL.c
- CheckCLZLAux.c
- CheckCompile.c
- CheckFMA.c
- CheckLL.c
- CheckLLAux.c
- configure
- CopyFeatures
- ctools.c
- def_makefile
- DIRNAME
- DispSettings.c
- DoConfig
- dosify
- ExceptionTest.c
- FacVec.c
- FFT.c
- fileio.c
- g_lip_impl.h
- G_LLL_FP.c
- G_LLL_QP.c
- G_LLL_RR.c
- G_LLL_XD.c
- gen_gmp_aux.c
- GetPID1.c
- GetPID2.c
- GetTime0.c
- GetTime1.c
- GetTime2.c
- GetTime3.c
- GetTime4.c
- GetTime5.c
- GF2.c
- GF2E.c
- GF2EX.c
- GF2EXFactoring.c
- GF2EXTest.c
- GF2X.c
- GF2X1.c
- GF2XFactoring.c
- GF2XTest.c
- GF2XTimeTest.c
- GF2XVec.c
- HNF.c
- InitSettings.c
- lip.c
- LLL.c
- LLL_FP.c
- LLL_QP.c
- LLL_RR.c
- LLL_XD.c
- LLLTest.c
- LLLTestIn
- LLLTestOut
- lzz_p.c
- lzz_pE.c
- lzz_pEX.c
- lzz_pEXFactoring.c
- lzz_pEXTest.c
- lzz_pX.c
- lzz_pX1.c
- lzz_pXCharPoly.c
- lzz_pXFactoring.c
- mach_desc.win
- MakeCheckFeature
- MakeDesc.c
- MakeDescAux.c
- makefile
- MakeGetPID
- MakeGetTime
- mat_GF2.c
- mat_GF2E.c
- mat_lzz_p.c
- mat_lzz_pE.c
- mat_lzz_pTest.c
- mat_poly_lzz_p.c
- mat_poly_ZZ.c
- mat_poly_ZZ_p.c
- mat_RR.c
- mat_ZZ.c
- mat_ZZ_p.c
- mat_ZZ_pE.c
- MatrixTest.c
- MatrixTestIn
- MatrixTestOut
- mfile
- MoreFacTest.c
- MoreFacTestIn
- MulTimeTest.c
- newnames.c
- NOTES
- Poly1TimeTest.c
- Poly2TimeTest.c
- Poly3TimeTest.c
- ppscript
- quad_float.c
- QuadTest.c
- QuadTestIn
- QuadTestOut
- QuickTest.c
- RemoveProg
- ResetFeatures
- RR.c
- RRTest.c
- RRTestIn
- RRTestOut
- subset.c
- TestGetPID.c
- TestGetTime.c
- TestScript
- thread.c
- ThreadTest.c
- Timing.c
- tools.c
- unixify
- vec_GF2.c
- vec_GF2E.c
- vec_lzz_p.c
- vec_lzz_pE.c
- vec_RR.c
- vec_ZZ.c
- vec_ZZ_p.c
- vec_ZZ_pE.c
- VERSION_INFO
- WINDIR
- Wizard
- WizardAux
- WordVector.c
- xdouble.c
- ZZ.c
- ZZ_p.c
- ZZ_pE.c
- ZZ_pEX.c
- ZZ_pEXFactoring.c
- ZZ_pEXTest.c
- ZZ_pX.c
- ZZ_pX1.c
- ZZ_pXCharPoly.c
- ZZ_pXFactoring.c
- ZZVec.c
- ZZX.c
- ZZX1.c
- ZZXCharPoly.c
- ZZXFacTest.c
- ZZXFacTestIn
- ZZXFacTestOut
- ZZXFactoring.c
lzz_pE.c @debian/9.9.1-2 — raw · history · blame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | #include <NTL/lzz_pE.h> #include <NTL/new.h> NTL_START_IMPL NTL_TLS_GLOBAL_DECL(SmartPtr<zz_pEInfoT>, zz_pEInfo_stg) NTL_CHEAP_THREAD_LOCAL zz_pEInfoT *zz_pEInfo = 0; zz_pEInfoT::zz_pEInfoT(const zz_pX& NewP) { build(p, NewP); _card_base = zz_p::modulus(); _card_exp = deg(NewP); } const ZZ& zz_pE::cardinality() { if (!zz_pEInfo) LogicError("zz_pE::cardinality: undefined modulus"); do { // NOTE: thread safe lazy init Lazy<ZZ>::Builder builder(zz_pEInfo->_card); if (!builder()) break; UniquePtr<ZZ> p; p.make(); power(*p, zz_pEInfo->_card_base, zz_pEInfo->_card_exp); builder.move(p); } while (0); return *zz_pEInfo->_card; } void zz_pE::init(const zz_pX& p) { zz_pEContext c(p); c.restore(); } void zz_pEContext::save() { NTL_TLS_GLOBAL_ACCESS(zz_pEInfo_stg); ptr = zz_pEInfo_stg; } void zz_pEContext::restore() const { NTL_TLS_GLOBAL_ACCESS(zz_pEInfo_stg); zz_pEInfo_stg = ptr; zz_pEInfo = zz_pEInfo_stg.get(); } zz_pEBak::~zz_pEBak() { if (MustRestore) c.restore(); } void zz_pEBak::save() { c.save(); MustRestore = true; } void zz_pEBak::restore() { c.restore(); MustRestore = false; } const zz_pE& zz_pE::zero() { static const zz_pE z(INIT_NO_ALLOC); // GLOBAL (assumes C++11 thread-safe init) return z; } istream& operator>>(istream& s, zz_pE& x) { zz_pX y; NTL_INPUT_CHECK_RET(s, s >> y); conv(x, y); return s; } void div(zz_pE& x, const zz_pE& a, const zz_pE& b) { zz_pE t; inv(t, b); mul(x, a, t); } void div(zz_pE& x, const zz_pE& a, long b) { NTL_zz_pRegister(B); B = b; inv(B, B); mul(x, a, B); } void div(zz_pE& x, const zz_pE& a, const zz_p& b) { NTL_zz_pRegister(B); B = b; inv(B, B); mul(x, a, B); } void div(zz_pE& x, long a, const zz_pE& b) { zz_pE t; inv(t, b); mul(x, a, t); } void div(zz_pE& x, const zz_p& a, const zz_pE& b) { zz_pE t; inv(t, b); mul(x, a, t); } void inv(zz_pE& x, const zz_pE& a) { InvMod(x._zz_pE__rep, a._zz_pE__rep, zz_pE::modulus()); } NTL_END_IMPL |