fast_frommer.h
Go to the documentation of this file.00001
00002
00003 #ifndef FAST_FROMMER_2627D46B
00004 #define FAST_FROMMER_2627D46B
00005
00006 #if _MSC_VER > 1000
00007 #pragma once
00008 #endif // _MSC_VER > 1000
00009
00010
00011 #include "FrommerTimer.h"
00012
00013
00014
00015
00016
00017
00018
00029 namespace nCenterFocus
00030 {
00031
00055
00056 template < class TFrommerDefs, int variant>
00057 class fast_Frommer
00058 {
00059
00060 public:
00061 typedef typename TFrommerDefs::RingType TRing;
00062
00063 typedef typename TFrommerDefs::RingType RingType;
00064
00065 typedef typename TFrommerDefs::PolynomXYType TPolynomXY;
00066
00067 typedef typename TFrommerDefs::TMatrixXYType TMatrixXYType;
00068 typedef typename TFrommerDefs::TMatrixXY_0Type TMatrixXY_0Type;
00069
00070 typedef typename TFrommerDefs::TMatrixXYPairType TMatrixXYPairType;
00071
00072 typedef typename TFrommerDefs::PolynomXYPairType TPolynomXYPair;
00073
00074
00075 private:
00076
00077 std::string name_m;
00078
00079 #ifdef FROMMERSTAGE_TIMER
00080 Timer tim_m;
00081 Timer tim2_m;
00082 FrommerTimer frommerTimer_m;
00083 MtcpManager_g.connectTimer(tim_m);
00084 MtcpManager_g.connectTimer(tim2_m);
00085 #endif
00086
00087 #ifdef SAFE
00088 bool initialized;
00089 #endif
00090
00098
00099 const TRing * const ring1;
00100
00101 const typename RingType::FieldType & field_ref_m;
00102
00103 const short maxFocalValuesToCompute;
00104
00105 const short maxDegree;
00106
00107
00108
00109
00111 TPolynomXY const * q;
00112
00114 TPolynomXY const * minusp;
00115
00117
00118 TPolynomXYPair pq;
00119
00120
00121 TMatrixXYType * const A;
00122
00123
00124
00125 TMatrixXYPairType* const dA;
00126
00127
00128 TMatrixXYType * const B;
00129
00130
00131 TMatrixXY_0Type * const B0;
00132
00134 const typename TRing::ScalarType * const a_table;
00135
00136 short int currentDegree;
00137
00138 short int lastDegree;
00139
00140 short currFocalValuePos;
00141
00142
00143
00144 protected:
00145
00148 void wellDefined();
00154 inline void init();
00155 static const typename TRing::ScalarType * const createLowATable(int maxDegree, const TRing * _ring );
00160 template <class TemplateMatrix>
00161 inline void outputMatrix(TemplateMatrix *mat) const;
00162
00163
00164 inline void outputMatrices() const;
00169 inline void compute_dyA_and_dxA();
00170
00171 void perform_the_A_Step();
00172 inline void perform_the_even_A_Step();
00173 inline void perform_the_odd_A_Step();
00174
00175 inline void perform_generic_C_Step();
00176 inline void perform_C_Step();
00177 void perform_fast_C_Step();
00178 void perform_first_C_Step();
00179
00180
00181
00182
00183 inline void perform_C_StepDeg3();
00184
00185 inline void perform_inner_C_Step( register typename TRing::ElementType * const b0,
00186 register const typename TRing::ElementType * const p0,
00187 register const typename TRing::ElementType * const q0,
00188 register const typename TRing::ElementType * const da0,
00189 short _n
00190 );
00191
00192 inline void perform_fast_inner_C_Step( register typename TMatrixXY_0Type::CoefficientType & b0,
00193 register const typename TRing::ElementType & p0,
00194 register const typename TRing::ElementType & q0,
00195 register const typename TRing::ElementType & da0,
00196 short _n
00197 );
00198
00201 public:
00202 void setName(std::string name) {name_m=name; }
00203
00204 fast_Frommer(short m, const TRing *rr);
00205 virtual ~fast_Frommer();
00206
00209
00210 void setPolynoms(const TPolynomXY * const minuspp,
00211 const TPolynomXY * const qq);
00218
00219
00220 inline void doit(short bComputeAllFocalValues, int jacobian=false);
00221
00222 void doitNew(short bComputeAllFocalValues, int jacobian);
00223
00224 void doitOld(short bComputeAllFocalValues, int jacobian);
00225
00226
00227
00229
00230
00231 template<int >
00232 inline void doitx(short howManyFocalValues);
00233
00234 template<int >
00235 void doitxNew(short howManyFocalValues);
00236
00237
00238 template<int >
00239 void doitxOld(short howManyFocalValues);
00240
00241
00246 inline const TRing* getRing() const;
00247
00248 inline const TRing& getRingRef() const;
00254 inline typename TRing::ElementType & getFocalValue( int pos) const;
00255
00256 void getComputedFocalValues(vector<typename TRing::ElementType> &computedFV ) const;
00257
00258 inline short getSuccessiveVanishedFocalValuesCount() const;
00259
00260 short getComputedFocalValuesNum() const {return currFocalValuePos-1 ; }
00261
00262 short getMaxFocalValuesToCompute() const {return maxFocalValuesToCompute ; }
00265 typename TRing::ElementType* computedFocalValues;
00266
00267 void printStageTimings(std::ostream & os) const;
00268
00269 #ifdef CF_TEST
00270 TMatrixXYType getA() { return *A; }
00271 TMatrixXYType getB() { return *B; }
00272 #endif
00273 };
00274
00275
00276
00277 #include "fast_frommer.cpp"
00278
00279
00280
00281 }
00282 #endif // !defined(FAST_FROMMER_2627D46B)
00283