[49f1f45] | 1 | /* winnt/factory.h automatically generated by makeheader from factory.template */ |
---|
[9503e0] | 2 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
[8d14d67] | 3 | /* $Id: factory.h,v 1.7 2008-12-08 08:59:27 Singular Exp $ */ |
---|
[9503e0] | 4 | |
---|
| 5 | #ifndef INCL_FACTORY_H |
---|
| 6 | #define INCL_FACTORY_H |
---|
| 7 | |
---|
| 8 | //{{{ docu |
---|
| 9 | // |
---|
| 10 | // factory.template - template to generate `factory.h'. |
---|
| 11 | // |
---|
| 12 | // `factory.h' is the user interface to Factory. Created |
---|
| 13 | // automatically by `makeheader', it collects all important |
---|
| 14 | // declarations from all important Factory header files into one |
---|
| 15 | // overall header file leaving out all boring Factory internal |
---|
| 16 | // stuff. See `./bin/makeheader' for an explanation of the syntax |
---|
| 17 | // of this file. |
---|
| 18 | // |
---|
| 19 | // Note: In this file the order of "includes" matters (since this |
---|
| 20 | // are not real includes)! In general, files at the end depend |
---|
| 21 | // on files at the beginning. |
---|
| 22 | // |
---|
| 23 | //}}} |
---|
| 24 | |
---|
| 25 | #include <factoryconf.h> |
---|
| 26 | |
---|
| 27 | #ifndef NOSTREAMIO |
---|
[49f1f45] | 28 | #ifdef HAVE_IOSTREAM |
---|
| 29 | #include <iostream> |
---|
| 30 | #define OSTREAM std::ostream |
---|
| 31 | #define ISTREAM std::istream |
---|
| 32 | #elif defined(HAVE_IOSTREAM_H) |
---|
[9503e0] | 33 | #include <iostream.h> |
---|
[49f1f45] | 34 | #define OSTREAM ostream |
---|
| 35 | #define ISTREAM istream |
---|
| 36 | #endif |
---|
[9503e0] | 37 | #endif /* ! NOSTREAMIO */ |
---|
| 38 | |
---|
| 39 | #ifdef SINGULAR |
---|
[49f1f45] | 40 | #include "cf_gmp.h" |
---|
| 41 | #else |
---|
[9503e0] | 42 | #include <gmp.h> |
---|
| 43 | #endif /* SINGULAR */ |
---|
| 44 | |
---|
| 45 | #ifdef macintosh |
---|
[49f1f45] | 46 | #include <:templates:ftmpl_array.h> |
---|
| 47 | #include <:templates:ftmpl_factor.h> |
---|
| 48 | #include <:templates:ftmpl_list.h> |
---|
| 49 | #include <:templates:ftmpl_matrix.h> |
---|
[9503e0] | 50 | #else |
---|
| 51 | #include <templates/ftmpl_array.h> |
---|
| 52 | #include <templates/ftmpl_factor.h> |
---|
| 53 | #include <templates/ftmpl_list.h> |
---|
| 54 | #include <templates/ftmpl_matrix.h> |
---|
| 55 | #endif |
---|
| 56 | |
---|
[49f1f45] | 57 | /* stuff included from ./cf_globals.h */ |
---|
[e1017c] | 58 | |
---|
| 59 | |
---|
[9503e0] | 60 | extern const char factoryVersion[]; |
---|
| 61 | extern const char factoryConfiguration[]; |
---|
| 62 | |
---|
[e1017c] | 63 | |
---|
[49f1f45] | 64 | /* stuff included from ./cf_primes.h */ |
---|
[e1017c] | 65 | |
---|
| 66 | |
---|
[9503e0] | 67 | int cf_getPrime( int i ); |
---|
| 68 | |
---|
| 69 | int cf_getNumPrimes(); |
---|
| 70 | |
---|
| 71 | int cf_getSmallPrime( int i ); |
---|
| 72 | |
---|
| 73 | int cf_getNumSmallPrimes(); |
---|
| 74 | |
---|
| 75 | int cf_getBigPrime( int i ); |
---|
| 76 | |
---|
| 77 | int cf_getNumBigPrimes(); |
---|
| 78 | |
---|
[e1017c] | 79 | |
---|
[49f1f45] | 80 | /* stuff included from ./cf_defs.h */ |
---|
[e1017c] | 81 | |
---|
| 82 | |
---|
[9503e0] | 83 | #define LEVELBASE -1000000 |
---|
| 84 | #define LEVELTRANS -500000 |
---|
| 85 | #define LEVELQUOT 1000000 |
---|
| 86 | #define LEVELEXPR 1000001 |
---|
| 87 | |
---|
| 88 | #define UndefinedDomain 32000 |
---|
| 89 | #define PrimePowerDomain 5 |
---|
| 90 | #define GaloisFieldDomain 4 |
---|
| 91 | #define FiniteFieldDomain 3 |
---|
| 92 | #define RationalDomain 2 |
---|
| 93 | #define IntegerDomain 1 |
---|
| 94 | |
---|
| 95 | //{{{ constants |
---|
| 96 | //{{{ docu |
---|
| 97 | // |
---|
| 98 | // - factory switches. |
---|
| 99 | // |
---|
| 100 | //}}} |
---|
| 101 | const int SW_RATIONAL = 0; |
---|
| 102 | const int SW_QUOTIENT = 1; |
---|
| 103 | const int SW_SYMMETRIC_FF = 2; |
---|
| 104 | const int SW_BERLEKAMP = 3; |
---|
| 105 | const int SW_FAC_USE_BIG_PRIMES = 4; |
---|
| 106 | const int SW_FAC_QUADRATICLIFT = 5; |
---|
| 107 | const int SW_USE_EZGCD = 6; |
---|
[8d14d67] | 108 | const int SW_USE_EZGCD_P = 7; |
---|
| 109 | const int SW_USE_SPARSEMOD = 8; |
---|
| 110 | const int SW_USE_NTL=9; |
---|
| 111 | const int SW_USE_NTL_GCD_0=10; |
---|
| 112 | const int SW_USE_NTL_GCD_P=11; |
---|
| 113 | const int SW_USE_NTL_SORT=12; |
---|
| 114 | const int SW_USE_CHINREM_GCD=13; |
---|
| 115 | const int SW_USE_GCD_P=14; |
---|
| 116 | const int SW_USE_QGCD=15; |
---|
| 117 | const int SW_USE_fieldGCD=16; |
---|
[9503e0] | 118 | //}}} |
---|
| 119 | |
---|
| 120 | |
---|
[49f1f45] | 121 | /* stuff included from ./variable.h */ |
---|
[e1017c] | 122 | |
---|
[9503e0] | 123 | |
---|
| 124 | class CanonicalForm; |
---|
| 125 | |
---|
| 126 | class Variable |
---|
| 127 | { |
---|
| 128 | private: |
---|
| 129 | int _level; |
---|
| 130 | Variable( int l, bool flag ); |
---|
| 131 | public: |
---|
| 132 | Variable() : _level(LEVELBASE) {} |
---|
| 133 | Variable( int l ); |
---|
| 134 | Variable( char name ); |
---|
| 135 | Variable( int l, char name ); |
---|
| 136 | Variable( const Variable & v ) : _level(v._level) {} |
---|
| 137 | ~Variable() {}; |
---|
| 138 | Variable& operator= ( const Variable & v ) |
---|
| 139 | { |
---|
| 140 | _level = v._level; |
---|
| 141 | return *this; |
---|
| 142 | } |
---|
| 143 | int level() const { return _level; } |
---|
| 144 | char name() const; |
---|
| 145 | static Variable highest() { return Variable( LEVELQUOT-1 ); } |
---|
| 146 | Variable next() const { return Variable( _level+1 ); } |
---|
| 147 | friend bool operator == ( const Variable & lhs, const Variable & rhs ) |
---|
| 148 | { |
---|
| 149 | return lhs._level == rhs._level; |
---|
| 150 | } |
---|
| 151 | friend bool operator != ( const Variable & lhs, const Variable & rhs ) |
---|
| 152 | { |
---|
| 153 | return lhs._level != rhs._level; |
---|
| 154 | } |
---|
| 155 | friend bool operator > ( const Variable & lhs, const Variable & rhs ) |
---|
| 156 | { |
---|
| 157 | return lhs._level > rhs._level; |
---|
| 158 | } |
---|
| 159 | friend bool operator < ( const Variable & lhs, const Variable & rhs ) |
---|
| 160 | { |
---|
| 161 | return lhs._level < rhs._level; |
---|
| 162 | } |
---|
| 163 | friend bool operator >= ( const Variable & lhs, const Variable & rhs ) |
---|
| 164 | { |
---|
| 165 | return lhs._level >= rhs._level; |
---|
| 166 | } |
---|
| 167 | friend bool operator <= ( const Variable & lhs, const Variable & rhs ) |
---|
| 168 | { |
---|
| 169 | return lhs._level <= rhs._level; |
---|
| 170 | } |
---|
| 171 | #ifndef NOSTREAMIO |
---|
[49f1f45] | 172 | friend OSTREAM & operator << ( OSTREAM & os, const Variable & v ); |
---|
[9503e0] | 173 | #endif /* NOSTREAMIO */ |
---|
[49f1f45] | 174 | friend void swap_levels(); |
---|
| 175 | friend Variable rootOf( const CanonicalForm &, char name ); |
---|
[9503e0] | 176 | }; |
---|
[49f1f45] | 177 | Variable rootOf( const CanonicalForm &, char name = '@' ); |
---|
[9503e0] | 178 | |
---|
| 179 | inline int level( const Variable & v ) { return v.level(); } |
---|
| 180 | inline char name( const Variable & v ) { return v.name(); } |
---|
| 181 | |
---|
| 182 | CanonicalForm getMipo( const Variable & alpha, const Variable & x ); |
---|
[8d14d67] | 183 | bool hasMipo( const Variable & alpha ); |
---|
[9503e0] | 184 | |
---|
| 185 | char getDefaultVarName(); |
---|
| 186 | char getDefaultExtName(); |
---|
| 187 | |
---|
[49f1f45] | 188 | int ExtensionLevel(); |
---|
[9503e0] | 189 | |
---|
[e1017c] | 190 | |
---|
[49f1f45] | 191 | /* stuff included from ./canonicalform.h */ |
---|
[9503e0] | 192 | |
---|
| 193 | |
---|
[49f1f45] | 194 | #undef CF_INLINE |
---|
| 195 | #define CF_INLINE |
---|
| 196 | #undef CF_NO_INLINE |
---|
| 197 | #define CF_NO_INLINE |
---|
| 198 | |
---|
[9503e0] | 199 | |
---|
| 200 | class InternalCF; |
---|
| 201 | |
---|
[49f1f45] | 202 | inline int is_imm ( const InternalCF * const ptr ) |
---|
| 203 | { |
---|
| 204 | // returns 0 if ptr is not immediate |
---|
| 205 | return ( ((int)((long)ptr)) & 3 ); |
---|
| 206 | } |
---|
| 207 | |
---|
| 208 | |
---|
| 209 | int initCanonicalForm( void ); |
---|
| 210 | |
---|
| 211 | static int cf_is_initialized_now = initCanonicalForm(); |
---|
| 212 | |
---|
[9503e0] | 213 | //{{{ class CanonicalForm |
---|
| 214 | class CanonicalForm |
---|
| 215 | { |
---|
| 216 | private: |
---|
| 217 | InternalCF *value; |
---|
| 218 | public: |
---|
| 219 | // constructors, destructors, selectors |
---|
[49f1f45] | 220 | CF_INLINE CanonicalForm(); |
---|
| 221 | CF_INLINE CanonicalForm( const CanonicalForm& ); |
---|
| 222 | CF_INLINE CanonicalForm( InternalCF* ); |
---|
| 223 | CF_INLINE CanonicalForm( const int ); |
---|
| 224 | CF_INLINE CanonicalForm( const Variable & ); |
---|
| 225 | CF_INLINE CanonicalForm( const Variable &, int ); |
---|
| 226 | CanonicalForm( const char *, const int base=10 ); // use with caution - does only handle integers !!! |
---|
[9503e0] | 227 | |
---|
[49f1f45] | 228 | CF_NO_INLINE ~CanonicalForm(); |
---|
[9503e0] | 229 | |
---|
| 230 | InternalCF* getval() const; // use with caution !!! |
---|
| 231 | |
---|
| 232 | CanonicalForm deepCopy() const; |
---|
| 233 | |
---|
| 234 | // predicates |
---|
[49f1f45] | 235 | CF_NO_INLINE bool isOne() const; |
---|
| 236 | CF_NO_INLINE bool isZero() const; |
---|
| 237 | inline bool isImm() const { return is_imm( value ); }; |
---|
[9503e0] | 238 | |
---|
| 239 | bool inZ() const; |
---|
| 240 | bool inQ() const; |
---|
| 241 | bool inFF() const; |
---|
| 242 | bool inGF() const; |
---|
| 243 | bool inPP() const; |
---|
| 244 | bool inBaseDomain() const; |
---|
| 245 | bool inExtension() const; |
---|
| 246 | bool inCoeffDomain() const; |
---|
| 247 | bool inPolyDomain() const; |
---|
| 248 | bool inQuotDomain() const; |
---|
| 249 | |
---|
| 250 | bool isFFinGF() const; |
---|
| 251 | bool isUnivariate() const; |
---|
[49f1f45] | 252 | bool isHomogeneous() const; |
---|
[9503e0] | 253 | |
---|
| 254 | // conversion functions |
---|
| 255 | int intval() const; |
---|
| 256 | CanonicalForm mapinto () const; |
---|
| 257 | |
---|
| 258 | CanonicalForm lc () const; |
---|
| 259 | CanonicalForm Lc () const; |
---|
| 260 | CanonicalForm LC () const; |
---|
| 261 | CanonicalForm LC ( const Variable & v ) const; |
---|
| 262 | |
---|
| 263 | int degree () const; |
---|
| 264 | int degree ( const Variable & v ) const; |
---|
| 265 | |
---|
| 266 | CanonicalForm tailcoeff () const; |
---|
| 267 | int taildegree () const; |
---|
| 268 | |
---|
| 269 | int level () const; |
---|
| 270 | Variable mvar () const; |
---|
| 271 | |
---|
| 272 | CanonicalForm num () const; |
---|
| 273 | CanonicalForm den () const; |
---|
| 274 | |
---|
| 275 | // assignment operators |
---|
[49f1f45] | 276 | CF_NO_INLINE CanonicalForm& operator = ( const CanonicalForm& ); |
---|
| 277 | CF_NO_INLINE CanonicalForm& operator = ( const int ); |
---|
[9503e0] | 278 | |
---|
| 279 | CanonicalForm& operator += ( const CanonicalForm& ); |
---|
| 280 | CanonicalForm& operator -= ( const CanonicalForm& ); |
---|
| 281 | CanonicalForm& operator *= ( const CanonicalForm& ); |
---|
| 282 | CanonicalForm& operator /= ( const CanonicalForm& ); |
---|
| 283 | CanonicalForm& operator %= ( const CanonicalForm& ); |
---|
| 284 | CanonicalForm& div ( const CanonicalForm& ); |
---|
| 285 | CanonicalForm& mod ( const CanonicalForm& ); |
---|
| 286 | |
---|
| 287 | // evaluation operators |
---|
| 288 | CanonicalForm operator () ( const CanonicalForm & f ) const; |
---|
| 289 | CanonicalForm operator () ( const CanonicalForm & f, const Variable & v ) const; |
---|
| 290 | |
---|
| 291 | CanonicalForm operator [] ( int i ) const; |
---|
| 292 | |
---|
| 293 | CanonicalForm deriv() const; |
---|
| 294 | CanonicalForm deriv( const Variable & x ) const; |
---|
| 295 | |
---|
| 296 | int sign() const; |
---|
| 297 | CanonicalForm sqrt() const; |
---|
| 298 | int ilog2() const; |
---|
| 299 | |
---|
| 300 | // comparison operators |
---|
| 301 | friend bool operator == ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 302 | friend bool operator != ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 303 | friend bool operator > ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 304 | friend bool operator < ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 305 | |
---|
| 306 | // arithmetic operators |
---|
[49f1f45] | 307 | friend CF_NO_INLINE CanonicalForm operator - ( const CanonicalForm& ); |
---|
[9503e0] | 308 | |
---|
| 309 | friend void divrem ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& ); |
---|
| 310 | friend bool divremt ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& ); |
---|
| 311 | |
---|
[49f1f45] | 312 | friend CanonicalForm bgcd ( const CanonicalForm &, const CanonicalForm & ); |
---|
| 313 | friend CanonicalForm bextgcd ( const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm & ); |
---|
| 314 | |
---|
| 315 | // input/output |
---|
[9503e0] | 316 | #ifndef NOSTREAMIO |
---|
[49f1f45] | 317 | void print( OSTREAM&, char * ) const; |
---|
| 318 | void print( OSTREAM& ) const; |
---|
| 319 | friend OSTREAM& operator << ( OSTREAM&, const CanonicalForm& ); |
---|
| 320 | friend ISTREAM& operator >> ( ISTREAM&, CanonicalForm& ); |
---|
[9503e0] | 321 | #endif /* NOSTREAMIO */ |
---|
| 322 | |
---|
| 323 | // obsolete methods |
---|
| 324 | static CanonicalForm genCoeff( int what, int i = 0 ); |
---|
| 325 | CanonicalForm genZero() const; |
---|
| 326 | CanonicalForm genOne() const; |
---|
| 327 | |
---|
| 328 | friend class CFIterator; |
---|
| 329 | }; |
---|
| 330 | //}}} |
---|
| 331 | |
---|
[49f1f45] | 332 | CF_INLINE CanonicalForm |
---|
| 333 | operator + ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 334 | |
---|
| 335 | CF_NO_INLINE CanonicalForm |
---|
| 336 | operator - ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 337 | |
---|
| 338 | CF_INLINE CanonicalForm |
---|
| 339 | operator * ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 340 | |
---|
| 341 | CF_NO_INLINE CanonicalForm |
---|
| 342 | operator / ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 343 | |
---|
| 344 | CF_NO_INLINE CanonicalForm |
---|
| 345 | operator % ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 346 | |
---|
| 347 | CF_NO_INLINE CanonicalForm |
---|
| 348 | div ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 349 | |
---|
| 350 | CF_NO_INLINE CanonicalForm |
---|
| 351 | mod ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 352 | |
---|
[9503e0] | 353 | |
---|
| 354 | //{{{ function declarations from canonicalform.cc |
---|
[49f1f45] | 355 | CanonicalForm blcm ( const CanonicalForm & f, const CanonicalForm & g ); |
---|
| 356 | |
---|
[9503e0] | 357 | CanonicalForm power ( const CanonicalForm & f, int n ); |
---|
| 358 | |
---|
| 359 | CanonicalForm power ( const Variable & v, int n ); |
---|
| 360 | //}}} |
---|
| 361 | |
---|
| 362 | //{{{ function declarations from cf_gcd.cc |
---|
| 363 | CanonicalForm gcd ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 364 | |
---|
[8d14d67] | 365 | CanonicalForm gcd_poly ( const CanonicalForm & f, const CanonicalForm & g ); |
---|
| 366 | |
---|
[9503e0] | 367 | CanonicalForm extgcd ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& ); |
---|
| 368 | |
---|
| 369 | CanonicalForm lcm ( const CanonicalForm&, const CanonicalForm& ); |
---|
| 370 | |
---|
| 371 | CanonicalForm pp ( const CanonicalForm& ); |
---|
| 372 | |
---|
| 373 | CanonicalForm content ( const CanonicalForm& ); |
---|
| 374 | |
---|
| 375 | CanonicalForm content ( const CanonicalForm&, const Variable& ); |
---|
| 376 | |
---|
| 377 | CanonicalForm icontent ( const CanonicalForm & f ); |
---|
[49f1f45] | 378 | |
---|
| 379 | CanonicalForm vcontent ( const CanonicalForm & f, const Variable & x ); |
---|
[9503e0] | 380 | //}}} |
---|
| 381 | |
---|
| 382 | //{{{ function declarations from cf_ops.cc |
---|
| 383 | CanonicalForm swapvar ( const CanonicalForm &, const Variable &, const Variable & ); |
---|
| 384 | |
---|
| 385 | CanonicalForm replacevar ( const CanonicalForm &, const Variable &, const Variable & ); |
---|
| 386 | |
---|
| 387 | int getNumVars( const CanonicalForm & f ); |
---|
| 388 | |
---|
| 389 | CanonicalForm getVars( const CanonicalForm & f ); |
---|
| 390 | |
---|
| 391 | CanonicalForm apply ( const CanonicalForm & f, void (*mf)( CanonicalForm &, int & ) ); |
---|
| 392 | |
---|
| 393 | CanonicalForm mapdomain ( const CanonicalForm & f, CanonicalForm (*mf)( const CanonicalForm & ) ); |
---|
| 394 | |
---|
| 395 | int * degrees ( const CanonicalForm & f, int * degs = 0 ); |
---|
| 396 | |
---|
| 397 | int totaldegree ( const CanonicalForm & f ); |
---|
| 398 | |
---|
| 399 | int totaldegree ( const CanonicalForm & f, const Variable & v1, const Variable & v2 ); |
---|
| 400 | |
---|
| 401 | int size ( const CanonicalForm & f, const Variable & v ); |
---|
| 402 | |
---|
| 403 | int size ( const CanonicalForm & f ); |
---|
| 404 | //}}} |
---|
| 405 | |
---|
| 406 | //{{{ inline functions corresponding to CanonicalForm methods |
---|
| 407 | //{{{ docu |
---|
| 408 | // |
---|
| 409 | // - inline functions corresponding to CanonicalForm methods. |
---|
| 410 | // |
---|
| 411 | // These function exist for convenience only and because it is |
---|
| 412 | // more beautiful to write 'degree( f )' than 'f.degree()'. |
---|
| 413 | // |
---|
| 414 | //}}} |
---|
| 415 | inline CanonicalForm |
---|
| 416 | lc ( const CanonicalForm & f ) { return f.lc(); } |
---|
| 417 | |
---|
| 418 | inline CanonicalForm |
---|
| 419 | Lc ( const CanonicalForm & f ) { return f.Lc(); } |
---|
| 420 | |
---|
| 421 | inline CanonicalForm |
---|
| 422 | LC ( const CanonicalForm & f ) { return f.LC(); } |
---|
| 423 | |
---|
| 424 | inline CanonicalForm |
---|
| 425 | LC ( const CanonicalForm & f, const Variable & v ) { return f.LC( v ); } |
---|
| 426 | |
---|
| 427 | inline int |
---|
| 428 | degree ( const CanonicalForm & f ) { return f.degree(); } |
---|
| 429 | |
---|
| 430 | inline int |
---|
| 431 | degree ( const CanonicalForm & f, const Variable & v ) { return f.degree( v ); } |
---|
| 432 | |
---|
| 433 | inline int |
---|
| 434 | taildegree ( const CanonicalForm & f ) { return f.taildegree(); } |
---|
| 435 | |
---|
| 436 | inline CanonicalForm |
---|
| 437 | tailcoeff ( const CanonicalForm & f ) { return f.tailcoeff(); } |
---|
| 438 | |
---|
| 439 | inline int |
---|
| 440 | level ( const CanonicalForm & f ) { return f.level(); } |
---|
| 441 | |
---|
[49f1f45] | 442 | inline Variable |
---|
[9503e0] | 443 | mvar ( const CanonicalForm & f ) { return f.mvar(); } |
---|
| 444 | |
---|
| 445 | inline CanonicalForm |
---|
| 446 | num ( const CanonicalForm & f ) { return f.num(); } |
---|
| 447 | |
---|
| 448 | inline CanonicalForm |
---|
| 449 | den ( const CanonicalForm & f ) { return f.den(); } |
---|
| 450 | |
---|
[49f1f45] | 451 | inline int |
---|
| 452 | sign ( const CanonicalForm & a ) { return a.sign(); } |
---|
| 453 | |
---|
[9503e0] | 454 | inline CanonicalForm |
---|
| 455 | deriv ( const CanonicalForm & f, const Variable & x ) { return f.deriv( x ); } |
---|
| 456 | |
---|
| 457 | inline CanonicalForm |
---|
| 458 | sqrt ( const CanonicalForm & a ) { return a.sqrt(); } |
---|
| 459 | |
---|
| 460 | inline int |
---|
| 461 | ilog2 ( const CanonicalForm & a ) { return a.ilog2(); } |
---|
| 462 | |
---|
| 463 | inline CanonicalForm |
---|
| 464 | mapinto ( const CanonicalForm & f ) { return f.mapinto(); } |
---|
| 465 | //}}} |
---|
| 466 | |
---|
| 467 | //{{{ inline functions |
---|
| 468 | inline CanonicalForm |
---|
| 469 | head ( const CanonicalForm & f ) |
---|
| 470 | { |
---|
| 471 | if ( f.level() > 0 ) |
---|
| 472 | return power( f.mvar(), f.degree() ) * f.LC(); |
---|
| 473 | else |
---|
| 474 | return f; |
---|
| 475 | } |
---|
| 476 | |
---|
| 477 | inline int |
---|
| 478 | headdegree ( const CanonicalForm & f ) { return totaldegree( head( f ) ); } |
---|
[49f1f45] | 479 | |
---|
| 480 | |
---|
[9503e0] | 481 | //}}} |
---|
| 482 | |
---|
| 483 | //{{{ other function declarations |
---|
| 484 | void setCharacteristic( int c ); // -> Fp && Q |
---|
| 485 | void setCharacteristic( int c, int n ); // -> PrimePower |
---|
| 486 | void setCharacteristic( int c, int n, char name ); // -> GF(q) |
---|
| 487 | |
---|
| 488 | int getCharacteristic(); |
---|
| 489 | int getGFDegree(); |
---|
| 490 | CanonicalForm getGFGenerator(); |
---|
| 491 | |
---|
| 492 | void On( int ); |
---|
| 493 | void Off( int ); |
---|
| 494 | bool isOn( int ); |
---|
| 495 | //}}} |
---|
| 496 | |
---|
| 497 | //{{{ type definitions |
---|
| 498 | typedef Factor<CanonicalForm> CFFactor; |
---|
| 499 | typedef List<CFFactor> CFFList; |
---|
| 500 | typedef ListIterator<CFFactor> CFFListIterator; |
---|
| 501 | typedef List<CanonicalForm> CFList; |
---|
| 502 | typedef ListIterator<CanonicalForm> CFListIterator; |
---|
| 503 | typedef Array<CanonicalForm> CFArray; |
---|
| 504 | typedef Matrix<CanonicalForm> CFMatrix; |
---|
| 505 | //}}} |
---|
| 506 | |
---|
| 507 | |
---|
[49f1f45] | 508 | /* stuff included from ./cf_binom.h */ |
---|
[e1017c] | 509 | |
---|
| 510 | |
---|
[9503e0] | 511 | CanonicalForm binomialpower ( const Variable&, const CanonicalForm&, int ); |
---|
| 512 | |
---|
[e1017c] | 513 | |
---|
[49f1f45] | 514 | /* stuff included from ./cf_algorithm.h */ |
---|
[e1017c] | 515 | |
---|
| 516 | |
---|
[9503e0] | 517 | //{{{ function declarations from cf_algorithm.cc |
---|
| 518 | CanonicalForm psr ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
| 519 | |
---|
| 520 | CanonicalForm psq ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
| 521 | |
---|
| 522 | void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r, const Variable & x ); |
---|
| 523 | |
---|
[49f1f45] | 524 | CanonicalForm bCommonDen ( const CanonicalForm & f ); |
---|
| 525 | |
---|
| 526 | bool fdivides ( const CanonicalForm & f, const CanonicalForm & g ); |
---|
| 527 | |
---|
| 528 | CanonicalForm maxNorm ( const CanonicalForm & f ); |
---|
| 529 | |
---|
| 530 | CanonicalForm euclideanNorm ( const CanonicalForm & f ); |
---|
[9503e0] | 531 | //}}} |
---|
| 532 | |
---|
| 533 | //{{{ function declarations from cf_chinese.cc |
---|
| 534 | void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2, const CanonicalForm & q2, CanonicalForm & xnew, CanonicalForm & qnew ); |
---|
| 535 | |
---|
| 536 | void chineseRemainder ( const CFArray & x, const CFArray & q, CanonicalForm & xnew, CanonicalForm & qnew ); |
---|
[49f1f45] | 537 | |
---|
| 538 | CanonicalForm Farey ( const CanonicalForm & f, const CanonicalForm & q ); |
---|
[9503e0] | 539 | //}}} |
---|
| 540 | |
---|
| 541 | //{{{ function declarations from cf_factor.cc |
---|
[49f1f45] | 542 | bool isPurePoly(const CanonicalForm & f); |
---|
| 543 | |
---|
| 544 | bool isPurePoly_m(const CanonicalForm & f); |
---|
| 545 | |
---|
[9503e0] | 546 | CFFList factorize ( const CanonicalForm & f, bool issqrfree = false ); |
---|
| 547 | |
---|
| 548 | CFFList factorize ( const CanonicalForm & f, const Variable & alpha ); |
---|
| 549 | |
---|
[8d14d67] | 550 | CFFList sqrFree ( const CanonicalForm & f ); |
---|
[9503e0] | 551 | |
---|
| 552 | bool isSqrFree ( const CanonicalForm & f ); |
---|
[49f1f45] | 553 | |
---|
| 554 | CanonicalForm homogenize( const CanonicalForm & f, const Variable & x); |
---|
| 555 | CanonicalForm homogenize( const CanonicalForm & f, const Variable & x, |
---|
| 556 | const Variable & v1, const Variable & v2); |
---|
| 557 | Variable get_max_degree_Variable(const CanonicalForm & f); |
---|
| 558 | CFList get_Terms( const CanonicalForm & f ); |
---|
| 559 | void getTerms( const CanonicalForm & f, const CanonicalForm & t, CFList & result ); |
---|
| 560 | |
---|
| 561 | |
---|
[9503e0] | 562 | //}}} |
---|
| 563 | |
---|
| 564 | //{{{ function declarations from cf_linsys.cc |
---|
| 565 | bool linearSystemSolve ( CFMatrix & M ); |
---|
| 566 | |
---|
| 567 | CanonicalForm determinant ( const CFMatrix & M, int n ); |
---|
| 568 | //}}} |
---|
| 569 | |
---|
| 570 | //{{{ function declarations from cf_resultant.cc |
---|
| 571 | CFArray subResChain ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
| 572 | |
---|
| 573 | CanonicalForm resultant ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
| 574 | //}}} |
---|
| 575 | |
---|
[49f1f45] | 576 | //{{{ inline CanonicalForm abs ( const CanonicalForm & f ) |
---|
| 577 | //{{{ docu |
---|
| 578 | // |
---|
| 579 | // abs() - return absolute value of `f'. |
---|
| 580 | // |
---|
| 581 | // The absolute value is defined in terms of the function |
---|
| 582 | // `sign()'. If it reports negative sign for `f' than -`f' is |
---|
| 583 | // returned, otherwise `f'. |
---|
| 584 | // |
---|
| 585 | // This behaviour is most useful for integers and rationals. But |
---|
| 586 | // it may be used to sign-normalize the leading coefficient of |
---|
| 587 | // arbitrary polynomials, too. |
---|
| 588 | // |
---|
| 589 | // Type info: |
---|
| 590 | // ---------- |
---|
| 591 | // f: CurrentPP |
---|
| 592 | // |
---|
| 593 | //}}} |
---|
| 594 | inline CanonicalForm |
---|
| 595 | abs ( const CanonicalForm & f ) |
---|
| 596 | { |
---|
| 597 | // it is not only more general to use `sign()' instead of a |
---|
| 598 | // direct comparison `f < 0', it is faster, too |
---|
| 599 | if ( sign( f ) < 0 ) |
---|
[8d14d67] | 600 | return -f; |
---|
[49f1f45] | 601 | else |
---|
[8d14d67] | 602 | return f; |
---|
[49f1f45] | 603 | } |
---|
| 604 | //}}} |
---|
| 605 | |
---|
[9503e0] | 606 | |
---|
[49f1f45] | 607 | /* stuff included from ./cf_eval.h */ |
---|
[e1017c] | 608 | |
---|
[9503e0] | 609 | |
---|
| 610 | class Evaluation |
---|
| 611 | { |
---|
| 612 | protected: |
---|
| 613 | CFArray values; |
---|
| 614 | public: |
---|
| 615 | Evaluation() : values() {} |
---|
| 616 | Evaluation( int min, int max ) : values( min, max ) {} |
---|
| 617 | Evaluation( const Evaluation & e ) : values( e.values ) {} |
---|
| 618 | virtual ~Evaluation() {} |
---|
| 619 | Evaluation& operator= ( const Evaluation & e ); |
---|
| 620 | int min() const { return values.min(); } |
---|
| 621 | int max() const { return values.max(); } |
---|
| 622 | CanonicalForm operator[] ( int i ) const { return values[i]; } |
---|
| 623 | CanonicalForm operator[] ( const Variable & v ) const { return operator[](v.level()); } |
---|
| 624 | CanonicalForm operator() ( const CanonicalForm& f ) const; |
---|
| 625 | CanonicalForm operator() ( const CanonicalForm & f, int i, int j ) const; |
---|
| 626 | virtual void nextpoint(); |
---|
| 627 | #ifndef NOSTREAMIO |
---|
[49f1f45] | 628 | friend OSTREAM& operator<< ( OSTREAM& s, const Evaluation &e ); |
---|
[9503e0] | 629 | #endif /* NOSTREAMIO */ |
---|
| 630 | }; |
---|
| 631 | |
---|
| 632 | |
---|
[49f1f45] | 633 | /* stuff included from ./cf_generator.h */ |
---|
[e1017c] | 634 | |
---|
[9503e0] | 635 | |
---|
| 636 | class CFGenerator |
---|
| 637 | { |
---|
| 638 | public: |
---|
| 639 | CFGenerator() {} |
---|
| 640 | virtual ~CFGenerator() {} |
---|
| 641 | virtual bool hasItems() const { return false; } |
---|
| 642 | virtual void reset() {}; |
---|
| 643 | virtual CanonicalForm item() const { return 0; } |
---|
| 644 | virtual void next() {}; |
---|
| 645 | }; |
---|
| 646 | |
---|
| 647 | class FFGenerator : public CFGenerator |
---|
| 648 | { |
---|
| 649 | private: |
---|
| 650 | int current; |
---|
| 651 | public: |
---|
| 652 | FFGenerator() : current(0) {} |
---|
| 653 | ~FFGenerator() {} |
---|
| 654 | bool hasItems() const; |
---|
| 655 | void reset() { current = 0; } |
---|
| 656 | CanonicalForm item() const; |
---|
| 657 | void next(); |
---|
| 658 | void operator++ () { next(); } |
---|
| 659 | void operator++ ( int ) { next(); } |
---|
| 660 | }; |
---|
| 661 | |
---|
| 662 | class GFGenerator : public CFGenerator |
---|
| 663 | { |
---|
| 664 | private: |
---|
| 665 | int current; |
---|
| 666 | public: |
---|
| 667 | GFGenerator(); |
---|
| 668 | ~GFGenerator() {} |
---|
| 669 | bool hasItems() const; |
---|
| 670 | void reset(); |
---|
| 671 | CanonicalForm item() const; |
---|
| 672 | void next(); |
---|
| 673 | void operator++ () { next(); } |
---|
| 674 | void operator++ ( int ) { next(); } |
---|
| 675 | }; |
---|
| 676 | |
---|
[49f1f45] | 677 | class AlgExtGenerator //??? : public CFGenerator |
---|
[9503e0] | 678 | { |
---|
| 679 | private: |
---|
| 680 | Variable algext; |
---|
[49f1f45] | 681 | FFGenerator **gensf; |
---|
| 682 | GFGenerator **gensg; |
---|
[9503e0] | 683 | int n; |
---|
| 684 | bool nomoreitems; |
---|
| 685 | AlgExtGenerator(); |
---|
| 686 | AlgExtGenerator( const AlgExtGenerator & ); |
---|
| 687 | AlgExtGenerator& operator= ( const AlgExtGenerator & ); |
---|
| 688 | public: |
---|
| 689 | AlgExtGenerator( const Variable & a ); |
---|
| 690 | ~AlgExtGenerator(); |
---|
| 691 | |
---|
| 692 | bool hasItems() const { return ! nomoreitems; } |
---|
| 693 | void reset(); |
---|
| 694 | CanonicalForm item() const; |
---|
| 695 | void next(); |
---|
| 696 | void operator++ () { next(); } |
---|
| 697 | void operator++ ( int ) { next(); } |
---|
| 698 | }; |
---|
| 699 | |
---|
| 700 | class CFGenFactory |
---|
| 701 | { |
---|
| 702 | public: |
---|
| 703 | static CFGenerator* generate(); |
---|
| 704 | }; |
---|
| 705 | |
---|
| 706 | |
---|
[49f1f45] | 707 | /* stuff included from ./cf_iter.h */ |
---|
| 708 | |
---|
| 709 | |
---|
| 710 | #undef CF_INLINE |
---|
| 711 | #define CF_INLINE |
---|
| 712 | #undef CF_NO_INLINE |
---|
| 713 | #define CF_NO_INLINE |
---|
[e1017c] | 714 | |
---|
| 715 | |
---|
[9503e0] | 716 | class term; |
---|
| 717 | typedef term * termList; |
---|
| 718 | |
---|
| 719 | class CFIterator { |
---|
| 720 | private: |
---|
| 721 | CanonicalForm data; |
---|
| 722 | termList cursor; |
---|
| 723 | bool ispoly, hasterms; |
---|
| 724 | public: |
---|
| 725 | CFIterator (); |
---|
| 726 | CFIterator ( const CFIterator& ); |
---|
| 727 | CFIterator ( const CanonicalForm& ); |
---|
| 728 | CFIterator ( const CanonicalForm&, const Variable& ); |
---|
| 729 | |
---|
| 730 | ~CFIterator (); |
---|
| 731 | |
---|
| 732 | CFIterator& operator= ( const CFIterator& ); |
---|
| 733 | CFIterator& operator= ( const CanonicalForm& ); |
---|
| 734 | |
---|
[49f1f45] | 735 | CF_NO_INLINE CFIterator& operator++ (); |
---|
| 736 | CF_NO_INLINE CFIterator& operator++ ( int ); |
---|
| 737 | CF_NO_INLINE int hasTerms () const; |
---|
| 738 | CF_NO_INLINE CanonicalForm coeff () const; |
---|
| 739 | CF_NO_INLINE int exp () const; |
---|
[9503e0] | 740 | }; |
---|
| 741 | |
---|
| 742 | |
---|
[49f1f45] | 743 | /* stuff included from ./cf_random.h */ |
---|
[9503e0] | 744 | |
---|
| 745 | |
---|
| 746 | class CFRandom { |
---|
| 747 | public: |
---|
| 748 | virtual ~CFRandom() {} |
---|
| 749 | virtual CanonicalForm generate() const { return 0; } |
---|
| 750 | virtual CFRandom * clone() const { return new CFRandom(); } |
---|
| 751 | }; |
---|
| 752 | |
---|
| 753 | class GFRandom : public CFRandom |
---|
| 754 | { |
---|
| 755 | public: |
---|
| 756 | GFRandom() {}; |
---|
| 757 | ~GFRandom() {} |
---|
| 758 | CanonicalForm generate() const; |
---|
| 759 | CFRandom * clone() const; |
---|
| 760 | }; |
---|
| 761 | |
---|
| 762 | class FFRandom : public CFRandom |
---|
| 763 | { |
---|
| 764 | public: |
---|
| 765 | FFRandom() {} |
---|
| 766 | ~FFRandom() {} |
---|
| 767 | CanonicalForm generate() const; |
---|
| 768 | CFRandom * clone() const; |
---|
| 769 | }; |
---|
| 770 | |
---|
| 771 | class IntRandom : public CFRandom |
---|
| 772 | { |
---|
| 773 | private: |
---|
| 774 | int max; |
---|
| 775 | public: |
---|
| 776 | IntRandom(); |
---|
| 777 | IntRandom( int m ); |
---|
| 778 | ~IntRandom(); |
---|
| 779 | CanonicalForm generate() const; |
---|
| 780 | CFRandom * clone() const; |
---|
| 781 | }; |
---|
| 782 | |
---|
| 783 | class AlgExtRandomF : public CFRandom { |
---|
| 784 | private: |
---|
| 785 | Variable algext; |
---|
| 786 | CFRandom * gen; |
---|
| 787 | int n; |
---|
| 788 | AlgExtRandomF(); |
---|
| 789 | AlgExtRandomF( const Variable & v, CFRandom * g, int nn ); |
---|
| 790 | AlgExtRandomF& operator= ( const AlgExtRandomF & ); |
---|
| 791 | public: |
---|
[8d14d67] | 792 | AlgExtRandomF( const AlgExtRandomF & ); |
---|
[9503e0] | 793 | AlgExtRandomF( const Variable & v ); |
---|
| 794 | AlgExtRandomF( const Variable & v1, const Variable & v2 ); |
---|
| 795 | ~AlgExtRandomF(); |
---|
| 796 | CanonicalForm generate() const; |
---|
| 797 | CFRandom * clone() const; |
---|
| 798 | }; |
---|
| 799 | |
---|
| 800 | class CFRandomFactory { |
---|
| 801 | public: |
---|
| 802 | static CFRandom * generate(); |
---|
| 803 | }; |
---|
| 804 | |
---|
| 805 | int factoryrandom( int n ); |
---|
| 806 | |
---|
| 807 | void factoryseed( int s ); |
---|
| 808 | |
---|
| 809 | |
---|
[49f1f45] | 810 | /* stuff included from ./cf_irred.h */ |
---|
[e1017c] | 811 | |
---|
[9503e0] | 812 | |
---|
| 813 | CanonicalForm find_irreducible ( int deg, CFRandom & gen, const Variable & x ); |
---|
| 814 | |
---|
| 815 | |
---|
[49f1f45] | 816 | /* stuff included from ./fac_util.h */ |
---|
[e1017c] | 817 | |
---|
[9503e0] | 818 | |
---|
| 819 | class modpk |
---|
| 820 | { |
---|
| 821 | private: |
---|
| 822 | CanonicalForm pk; |
---|
| 823 | CanonicalForm pkhalf; |
---|
| 824 | int p; |
---|
| 825 | int k; |
---|
| 826 | public: |
---|
| 827 | modpk(); |
---|
| 828 | modpk( int q, int l ); |
---|
| 829 | modpk( const modpk & m ); |
---|
| 830 | modpk& operator= ( const modpk& m ); |
---|
| 831 | ~modpk() {} |
---|
| 832 | int getp() const { return p; } |
---|
| 833 | int getk() const { return k; } |
---|
| 834 | CanonicalForm inverse( const CanonicalForm & f, bool symmetric = true ) const; |
---|
| 835 | CanonicalForm getpk() const { return pk; } |
---|
| 836 | CanonicalForm operator() ( const CanonicalForm & f, bool symmetric = true ) const; |
---|
| 837 | }; |
---|
| 838 | |
---|
| 839 | |
---|
| 840 | CanonicalForm replaceLc( const CanonicalForm & f, const CanonicalForm & c ); |
---|
| 841 | |
---|
| 842 | CanonicalForm remainder( const CanonicalForm & f, const CanonicalForm & g, const modpk & pk ); |
---|
| 843 | |
---|
| 844 | void divremainder( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & quot, CanonicalForm & rem, const modpk & pk ); |
---|
| 845 | |
---|
| 846 | bool Hensel ( const CanonicalForm & U, CFArray & G, const CFArray & lcG, const Evaluation & A, const modpk & bound, const Variable & x ); |
---|
| 847 | |
---|
| 848 | /* some special array functions */ |
---|
| 849 | |
---|
| 850 | CanonicalForm sum ( const CFArray & a, int f, int l ); |
---|
| 851 | |
---|
| 852 | CanonicalForm prod ( const CFArray & a, int f, int l ); |
---|
| 853 | |
---|
| 854 | CanonicalForm sum ( const CFArray & a ); |
---|
| 855 | |
---|
| 856 | CanonicalForm prod ( const CFArray & a ); |
---|
| 857 | |
---|
| 858 | CanonicalForm crossprod ( const CFArray & a, const CFArray & b ); |
---|
| 859 | |
---|
| 860 | |
---|
[49f1f45] | 861 | /* stuff included from ./cf_map.h */ |
---|
[e1017c] | 862 | |
---|
| 863 | |
---|
[9503e0] | 864 | //{{{ class MapPair |
---|
| 865 | //{{{ docu |
---|
| 866 | // |
---|
| 867 | // class MapPair - stores one mapping pair (Variable -> CanonicalForm). |
---|
| 868 | // |
---|
| 869 | // This class is only used to store such pairs. It has no |
---|
| 870 | // methods to transform a CanonicalForm as the class CFMap has. |
---|
| 871 | // |
---|
| 872 | // V, S: the pair (V -> S) |
---|
| 873 | // |
---|
| 874 | //}}} |
---|
| 875 | //{{{ inline method docu |
---|
| 876 | // |
---|
| 877 | // Variable var () const |
---|
| 878 | // CanonicalForm subst () const |
---|
| 879 | // |
---|
| 880 | // var(), subst() - selectors, return V and P, resp. |
---|
| 881 | // |
---|
| 882 | //}}} |
---|
| 883 | class MapPair |
---|
| 884 | { |
---|
| 885 | private: |
---|
| 886 | Variable V; |
---|
| 887 | CanonicalForm S; |
---|
| 888 | public: |
---|
| 889 | MapPair ( const Variable & v, const CanonicalForm & s ) : V(v), S(s) {} |
---|
| 890 | MapPair () : V(), S(1) {} |
---|
| 891 | MapPair ( const MapPair & p ) : V(p.V), S(p.S) {} |
---|
| 892 | ~MapPair () {} |
---|
| 893 | MapPair & operator = ( const MapPair & p ); |
---|
| 894 | Variable var () const { return V; } |
---|
| 895 | CanonicalForm subst () const { return S; } |
---|
| 896 | #ifndef NOSTREAMIO |
---|
[49f1f45] | 897 | void print( OSTREAM&) const; |
---|
| 898 | friend OSTREAM & operator << ( OSTREAM & s, const MapPair & p ); |
---|
[9503e0] | 899 | #endif /* NOSTREAMIO */ |
---|
| 900 | }; |
---|
| 901 | //}}} |
---|
| 902 | |
---|
| 903 | typedef List<MapPair> MPList; |
---|
| 904 | typedef ListIterator<MapPair> MPListIterator; |
---|
| 905 | |
---|
| 906 | //{{{ class CFMap |
---|
| 907 | //{{{ docu |
---|
| 908 | // |
---|
| 909 | // class CFMap - class to map canonical forms. |
---|
| 910 | // |
---|
| 911 | // Use an object of class CFMap to insert 'values' into canonical |
---|
| 912 | // form. Such a mapping is defined by a list of MapPairs (V -> S) |
---|
| 913 | // describing which canonical form S to insert for variable V. |
---|
| 914 | // Hereby, the substituted canonical forms are not subject to |
---|
| 915 | // further substitutions. |
---|
| 916 | // |
---|
| 917 | // P: list of MapPairs, sorted by level in descending order |
---|
| 918 | // |
---|
| 919 | //}}} |
---|
| 920 | class CFMap |
---|
| 921 | { |
---|
| 922 | private: |
---|
| 923 | MPList P; |
---|
| 924 | public: |
---|
| 925 | CFMap () {} |
---|
| 926 | CFMap ( const CanonicalForm & s ) : P( MapPair( Variable(), s ) ) {} |
---|
| 927 | CFMap ( const Variable & v ) : P( MapPair( v, 1 ) ) {} |
---|
| 928 | CFMap ( const Variable & v, const CanonicalForm & s ) : P( MapPair( v, s ) ) {} |
---|
| 929 | ~CFMap () {} |
---|
| 930 | CFMap ( const CFList & L ); |
---|
| 931 | CFMap ( const CFMap & m ) : P( m.P ) {} |
---|
| 932 | CFMap & operator = ( const CFMap & m ); |
---|
| 933 | void newpair ( const Variable & v, const CanonicalForm & s ); |
---|
| 934 | CanonicalForm operator () ( const CanonicalForm & f ) const; |
---|
| 935 | #ifndef NOSTREAMIO |
---|
[49f1f45] | 936 | friend OSTREAM & operator << ( OSTREAM & s, const CFMap & m ); |
---|
[9503e0] | 937 | #endif /* NOSTREAMIO */ |
---|
| 938 | }; |
---|
| 939 | //}}} |
---|
| 940 | |
---|
| 941 | CanonicalForm compress ( const CanonicalForm & f, CFMap & m ); |
---|
| 942 | void compress ( const CFArray & a, CFMap & M, CFMap & N ); |
---|
| 943 | void compress ( const CanonicalForm & f, const CanonicalForm & g, CFMap & M, CFMap & N ); |
---|
| 944 | |
---|
| 945 | |
---|
[49f1f45] | 946 | /* stuff included from ./cf_reval.h */ |
---|
[9503e0] | 947 | |
---|
| 948 | |
---|
| 949 | class REvaluation : public Evaluation |
---|
| 950 | { |
---|
[8d14d67] | 951 | protected: // neeeded in FFREvaluation |
---|
[9503e0] | 952 | CFRandom * gen; |
---|
| 953 | public: |
---|
| 954 | REvaluation() : Evaluation(), gen(0) {} |
---|
| 955 | REvaluation( int min, int max, const CFRandom & sample ) : Evaluation( min, max ), gen( sample.clone() ) {} |
---|
| 956 | REvaluation( const REvaluation & e ); |
---|
| 957 | ~REvaluation(); |
---|
| 958 | REvaluation& operator= ( const REvaluation & e ); |
---|
| 959 | void nextpoint(); |
---|
| 960 | }; |
---|
| 961 | |
---|
| 962 | |
---|
[8d14d67] | 963 | /* stuff included from ./fac_sqrfree.h */ |
---|
| 964 | |
---|
| 965 | |
---|
[9503e0] | 966 | #ifdef SINGULAR |
---|
| 967 | |
---|
[49f1f45] | 968 | /* stuff included from ./gfops.h */ |
---|
[e1017c] | 969 | |
---|
[9503e0] | 970 | |
---|
| 971 | int gf_gf2ff ( int a ); |
---|
| 972 | |
---|
| 973 | bool gf_isff ( int a ); |
---|
| 974 | |
---|
| 975 | |
---|
[49f1f45] | 976 | /* stuff included from ./singext.h */ |
---|
[e1017c] | 977 | |
---|
[9503e0] | 978 | |
---|
| 979 | MP_INT gmp_numerator ( const CanonicalForm & f ); |
---|
| 980 | |
---|
| 981 | MP_INT gmp_denominator ( const CanonicalForm & f ); |
---|
| 982 | |
---|
[49f1f45] | 983 | int gf_value (const CanonicalForm & f ); |
---|
| 984 | |
---|
[9503e0] | 985 | CanonicalForm make_cf ( const MP_INT & n ); |
---|
| 986 | |
---|
| 987 | CanonicalForm make_cf ( const MP_INT & n, const MP_INT & d, bool normalize ); |
---|
| 988 | |
---|
[49f1f45] | 989 | CanonicalForm make_cf_from_gf ( const int z ); |
---|
| 990 | |
---|
[e1017c] | 991 | |
---|
[9503e0] | 992 | #endif /* SINGULAR */ |
---|
| 993 | |
---|
[49f1f45] | 994 | #ifdef HAVE_BIFAC |
---|
| 995 | /* stuff included from ./bifac.h */ |
---|
| 996 | |
---|
| 997 | |
---|
| 998 | CFFList AbsFactorize( const CanonicalForm & a ); |
---|
| 999 | |
---|
| 1000 | class BIFAC |
---|
| 1001 | { |
---|
| 1002 | //////////////////////////////////////////////////////////////// |
---|
| 1003 | public: |
---|
| 1004 | //////////////////////////////////////////////////////////////// |
---|
| 1005 | |
---|
| 1006 | // === KONST-/ DESTRUKTOREN ==== |
---|
| 1007 | BIFAC ( void ); // Konstruktor |
---|
| 1008 | virtual ~BIFAC( void ); // DESTRUKTOR |
---|
| 1009 | |
---|
| 1010 | // === Funktionen ======= |
---|
| 1011 | void bifac(CanonicalForm f, bool absolute=true); |
---|
| 1012 | CFFList getFactors( void ){ return gl_RL; }; |
---|
| 1013 | |
---|
| 1014 | |
---|
| 1015 | //////////////////////////////////////////////////////////////// |
---|
| 1016 | private: |
---|
| 1017 | //////////////////////////////////////////////////////////////// |
---|
| 1018 | |
---|
| 1019 | // === Funktionen ======= |
---|
| 1020 | void passedTime(); |
---|
| 1021 | void biGanzMachen( CanonicalForm & f ); |
---|
| 1022 | void biNormieren( CanonicalForm & f ) ; |
---|
| 1023 | void convertResult( CanonicalForm & f, int ch, int sw); |
---|
| 1024 | int findCharacteristic(CanonicalForm f); |
---|
| 1025 | // void matrix_drucken( CFMatrix M ); |
---|
| 1026 | long int anz_terme( CanonicalForm & f ); |
---|
| 1027 | |
---|
| 1028 | CFList matrix2basis(CFMatrix A, int dim, int m, int n, CanonicalForm f); |
---|
| 1029 | CFList basisOfG(CanonicalForm f); |
---|
| 1030 | CFMatrix createA (CFList G, CanonicalForm f); |
---|
| 1031 | CanonicalForm create_g (CFList G); |
---|
| 1032 | CFList createRg (CFList G, CanonicalForm f); |
---|
| 1033 | CFList createEg (CFList G, CanonicalForm f); |
---|
| 1034 | CFList createEgUni (CFList G, CanonicalForm f); |
---|
| 1035 | |
---|
| 1036 | void unifac(CanonicalForm f, int grad); |
---|
| 1037 | CanonicalForm RationalFactor (CanonicalForm phi, CanonicalForm f, \ |
---|
| 1038 | CanonicalForm fx, CanonicalForm g); |
---|
| 1039 | void RationalFactorizationOnly (CFFList Phis, CanonicalForm f, CanonicalForm g); |
---|
| 1040 | CFList getAbsoluteFactors (CanonicalForm f1, CanonicalForm phi); |
---|
| 1041 | void AbsoluteFactorization (CFFList Phis, CanonicalForm f, CanonicalForm g); |
---|
| 1042 | void bifacSqrFree( CanonicalForm f ); |
---|
| 1043 | void bifacMain(CanonicalForm f); |
---|
| 1044 | |
---|
| 1045 | |
---|
| 1046 | // === Variable ======= |
---|
| 1047 | CFFList gl_RL; // where to store the rational factorization |
---|
| 1048 | CFList gl_AL; // where to store the absolute factorization |
---|
| 1049 | bool absolute; // Compute an absolute factorization as well? |
---|
| 1050 | int exponent; // |
---|
| 1051 | }; |
---|
| 1052 | |
---|
| 1053 | #endif /* HAVE_BIFAC */ |
---|
| 1054 | |
---|
[9503e0] | 1055 | #endif /* ! INCL_FACTORY_H */ |
---|