[8c8415] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
[341696] | 2 | /* $Id$ */ |
---|
[8c8415] | 3 | |
---|
| 4 | #ifndef INCL_CF_ALGORITHM_H |
---|
| 5 | #define INCL_CF_ALGORITHM_H |
---|
| 6 | |
---|
| 7 | //{{{ docu |
---|
| 8 | // |
---|
| 9 | // cf_algorithm.h - declarations of higher level algorithms. |
---|
| 10 | // |
---|
[b16644] | 11 | // Header file corresponds to: cf_algorithms.cc, cf_chinese.cc, |
---|
| 12 | // cf_factor.cc, cf_linsys.cc, cf_resultant.cc |
---|
| 13 | // |
---|
| 14 | // Hierarchy: mathematical algorithms on canonical forms |
---|
| 15 | // |
---|
| 16 | // Developers note: |
---|
| 17 | // ---------------- |
---|
[8c8415] | 18 | // This header file collects declarations of most of the |
---|
[b16644] | 19 | // functions in Factory which implement higher level algorithms |
---|
[041dbdc] | 20 | // on canonical forms (factorization, gcd, etc.) and declarations |
---|
[b16644] | 21 | // of some low level mathematical functions, too (absolute value, |
---|
[041dbdc] | 22 | // euclidean norm, etc.). |
---|
[8c8415] | 23 | // |
---|
| 24 | //}}} |
---|
| 25 | |
---|
[e4fe2b] | 26 | // #include "config.h" |
---|
[8c8415] | 27 | |
---|
| 28 | #include "canonicalform.h" |
---|
[e56537] | 29 | #include "variable.h" |
---|
[8c8415] | 30 | |
---|
| 31 | /*BEGINPUBLIC*/ |
---|
| 32 | |
---|
[38eab60] | 33 | //{{{ function declarations from cf_algorithm.cc |
---|
[d482ee] | 34 | CanonicalForm psr ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
| 35 | |
---|
| 36 | CanonicalForm psq ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
| 37 | |
---|
| 38 | void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r, const Variable & x ); |
---|
| 39 | |
---|
[041dbdc] | 40 | CanonicalForm bCommonDen ( const CanonicalForm & f ); |
---|
[0d1712] | 41 | |
---|
[ebc602] | 42 | bool fdivides ( const CanonicalForm & f, const CanonicalForm & g ); |
---|
[041dbdc] | 43 | |
---|
[21b8f4] | 44 | bool fdivides ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm& quot ); |
---|
| 45 | |
---|
[42281d6] | 46 | bool tryFdivides ( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm& M, bool& fail ); |
---|
| 47 | |
---|
[041dbdc] | 48 | CanonicalForm maxNorm ( const CanonicalForm & f ); |
---|
| 49 | |
---|
| 50 | CanonicalForm euclideanNorm ( const CanonicalForm & f ); |
---|
[d482ee] | 51 | //}}} |
---|
| 52 | |
---|
[38eab60] | 53 | //{{{ function declarations from cf_chinese.cc |
---|
[c2b784] | 54 | void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2, const CanonicalForm & q2, CanonicalForm & xnew, CanonicalForm & qnew ); |
---|
[8c8415] | 55 | |
---|
[d482ee] | 56 | void chineseRemainder ( const CFArray & x, const CFArray & q, CanonicalForm & xnew, CanonicalForm & qnew ); |
---|
[6f62c3] | 57 | |
---|
| 58 | CanonicalForm Farey ( const CanonicalForm & f, const CanonicalForm & q ); |
---|
[8c8415] | 59 | //}}} |
---|
| 60 | |
---|
[38eab60] | 61 | //{{{ function declarations from cf_factor.cc |
---|
[fbbb08] | 62 | extern int singular_homog_flag; |
---|
| 63 | |
---|
[e5102c] | 64 | bool isPurePoly(const CanonicalForm & f); |
---|
| 65 | |
---|
[6f62c3] | 66 | bool isPurePoly_m(const CanonicalForm & f); |
---|
| 67 | |
---|
[e56537] | 68 | CFFList factorize ( const CanonicalForm & f, bool issqrfree = false ); |
---|
| 69 | |
---|
| 70 | CFFList factorize ( const CanonicalForm & f, const Variable & alpha ); |
---|
| 71 | |
---|
[f78374] | 72 | CFFList sqrFree ( const CanonicalForm & f, bool sort= false ); |
---|
[e56537] | 73 | |
---|
| 74 | bool isSqrFree ( const CanonicalForm & f ); |
---|
[dad0bc5] | 75 | |
---|
| 76 | CanonicalForm homogenize( const CanonicalForm & f, const Variable & x); |
---|
[a38d45] | 77 | CanonicalForm homogenize( const CanonicalForm & f, const Variable & x, |
---|
| 78 | const Variable & v1, const Variable & v2); |
---|
[dad0bc5] | 79 | Variable get_max_degree_Variable(const CanonicalForm & f); |
---|
| 80 | CFList get_Terms( const CanonicalForm & f ); |
---|
| 81 | void getTerms( const CanonicalForm & f, const CanonicalForm & t, CFList & result ); |
---|
| 82 | |
---|
| 83 | |
---|
[e56537] | 84 | //}}} |
---|
| 85 | |
---|
[38eab60] | 86 | //{{{ function declarations from cf_linsys.cc |
---|
[d482ee] | 87 | bool linearSystemSolve ( CFMatrix & M ); |
---|
[9fb70b] | 88 | |
---|
[d482ee] | 89 | CanonicalForm determinant ( const CFMatrix & M, int n ); |
---|
[9fb70b] | 90 | //}}} |
---|
| 91 | |
---|
[38eab60] | 92 | //{{{ function declarations from cf_resultant.cc |
---|
[2a9b48] | 93 | CFArray subResChain ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
| 94 | |
---|
[d482ee] | 95 | CanonicalForm resultant ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
[f42ba19] | 96 | //}}} |
---|
| 97 | |
---|
[041dbdc] | 98 | //{{{ inline CanonicalForm abs ( const CanonicalForm & f ) |
---|
| 99 | //{{{ docu |
---|
| 100 | // |
---|
| 101 | // abs() - return absolute value of `f'. |
---|
| 102 | // |
---|
| 103 | // The absolute value is defined in terms of the function |
---|
| 104 | // `sign()'. If it reports negative sign for `f' than -`f' is |
---|
| 105 | // returned, otherwise `f'. |
---|
| 106 | // |
---|
[b16644] | 107 | // This behaviour is most useful for integers and rationals. But |
---|
| 108 | // it may be used to sign-normalize the leading coefficient of |
---|
| 109 | // arbitrary polynomials, too. |
---|
| 110 | // |
---|
| 111 | // Type info: |
---|
| 112 | // ---------- |
---|
| 113 | // f: CurrentPP |
---|
[041dbdc] | 114 | // |
---|
| 115 | //}}} |
---|
| 116 | inline CanonicalForm |
---|
| 117 | abs ( const CanonicalForm & f ) |
---|
| 118 | { |
---|
[b16644] | 119 | // it is not only more general to use `sign()' instead of a |
---|
| 120 | // direct comparison `f < 0', it is faster, too |
---|
[041dbdc] | 121 | if ( sign( f ) < 0 ) |
---|
[6918d65] | 122 | return -f; |
---|
[041dbdc] | 123 | else |
---|
[6918d65] | 124 | return f; |
---|
[041dbdc] | 125 | } |
---|
| 126 | //}}} |
---|
| 127 | |
---|
[8c8415] | 128 | /*ENDPUBLIC*/ |
---|
| 129 | |
---|
| 130 | #endif /* ! INCL_CF_ALGORITHM_H */ |
---|