[8c8415] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
| 2 | |
---|
[086f3e] | 3 | /** |
---|
| 4 | * @file cf_algorithm.h |
---|
| 5 | * declarations of higher level algorithms. |
---|
| 6 | * |
---|
| 7 | * Header file corresponds to: cf_algorithm.cc, cf_chinese.cc, |
---|
| 8 | * cf_factor.cc, cf_linsys.cc, cf_resultant.cc |
---|
| 9 | * |
---|
| 10 | * Hierarchy: mathematical algorithms on canonical forms |
---|
| 11 | * |
---|
| 12 | * Developers note: |
---|
| 13 | * ---------------- |
---|
| 14 | * This header file collects declarations of most of the |
---|
| 15 | * functions in Factory which implement higher level algorithms |
---|
| 16 | * on canonical forms (factorization, gcd, etc.) and declarations |
---|
| 17 | * of some low level mathematical functions, too (absolute value, |
---|
| 18 | * euclidean norm, etc.). |
---|
| 19 | * |
---|
| 20 | **/ |
---|
| 21 | |
---|
[8c8415] | 22 | #ifndef INCL_CF_ALGORITHM_H |
---|
| 23 | #define INCL_CF_ALGORITHM_H |
---|
| 24 | |
---|
[e4fe2b] | 25 | // #include "config.h" |
---|
[8c8415] | 26 | |
---|
| 27 | #include "canonicalform.h" |
---|
[e56537] | 28 | #include "variable.h" |
---|
[8c8415] | 29 | |
---|
| 30 | /*BEGINPUBLIC*/ |
---|
| 31 | |
---|
[38eab60] | 32 | //{{{ function declarations from cf_algorithm.cc |
---|
[d482ee] | 33 | CanonicalForm psr ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
| 34 | |
---|
| 35 | CanonicalForm psq ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
| 36 | |
---|
| 37 | void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r, const Variable & x ); |
---|
| 38 | |
---|
[3edea1] | 39 | CanonicalForm FACTORY_PUBLIC bCommonDen ( const CanonicalForm & f ); |
---|
[0d1712] | 40 | |
---|
[ebc602] | 41 | bool fdivides ( const CanonicalForm & f, const CanonicalForm & g ); |
---|
[041dbdc] | 42 | |
---|
[21b8f4c] | 43 | bool fdivides ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm& quot ); |
---|
| 44 | |
---|
[42281d6] | 45 | bool tryFdivides ( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm& M, bool& fail ); |
---|
| 46 | |
---|
[041dbdc] | 47 | CanonicalForm maxNorm ( const CanonicalForm & f ); |
---|
| 48 | |
---|
| 49 | CanonicalForm euclideanNorm ( const CanonicalForm & f ); |
---|
[d482ee] | 50 | //}}} |
---|
| 51 | |
---|
[38eab60] | 52 | //{{{ function declarations from cf_chinese.cc |
---|
[3edea1] | 53 | void FACTORY_PUBLIC chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2, const CanonicalForm & q2, CanonicalForm & xnew, CanonicalForm & qnew ); |
---|
[8c8415] | 54 | |
---|
[3edea1] | 55 | void FACTORY_PUBLIC chineseRemainder ( const CFArray & x, const CFArray & q, CanonicalForm & xnew, CanonicalForm & qnew ); |
---|
[6f62c3] | 56 | |
---|
[3edea1] | 57 | void FACTORY_PUBLIC chineseRemainderCached ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2, const CanonicalForm & q2, CanonicalForm & xnew, CanonicalForm & qnew, CFArray &inv ); |
---|
| 58 | void FACTORY_PUBLIC chineseRemainderCached(const CFArray &a, const CFArray &n, CanonicalForm &xnew, CanonicalForm &prod, CFArray &inv); |
---|
[a1f17b] | 59 | |
---|
| 60 | |
---|
[6f62c3] | 61 | CanonicalForm Farey ( const CanonicalForm & f, const CanonicalForm & q ); |
---|
[8c8415] | 62 | //}}} |
---|
| 63 | |
---|
[38eab60] | 64 | //{{{ function declarations from cf_factor.cc |
---|
[a3f0fea] | 65 | EXTERN_VAR int singular_homog_flag; |
---|
[fbbb08] | 66 | |
---|
[e5102c] | 67 | bool isPurePoly(const CanonicalForm & f); |
---|
| 68 | |
---|
[6f62c3] | 69 | bool isPurePoly_m(const CanonicalForm & f); |
---|
| 70 | |
---|
[3edea1] | 71 | CFFList FACTORY_PUBLIC factorize ( const CanonicalForm & f, bool issqrfree = false ); |
---|
[e56537] | 72 | |
---|
[3edea1] | 73 | CFFList FACTORY_PUBLIC factorize ( const CanonicalForm & f, const Variable & alpha ); |
---|
[e56537] | 74 | |
---|
[3edea1] | 75 | CFFList FACTORY_PUBLIC sqrFree ( const CanonicalForm & f, bool sort= false ); |
---|
[e56537] | 76 | |
---|
[dad0bc5] | 77 | CanonicalForm homogenize( const CanonicalForm & f, const Variable & x); |
---|
[a38d45] | 78 | CanonicalForm homogenize( const CanonicalForm & f, const Variable & x, |
---|
| 79 | const Variable & v1, const Variable & v2); |
---|
[dad0bc5] | 80 | Variable get_max_degree_Variable(const CanonicalForm & f); |
---|
| 81 | CFList get_Terms( const CanonicalForm & f ); |
---|
| 82 | void getTerms( const CanonicalForm & f, const CanonicalForm & t, CFList & result ); |
---|
| 83 | |
---|
| 84 | |
---|
[e56537] | 85 | //}}} |
---|
| 86 | |
---|
[38eab60] | 87 | //{{{ function declarations from cf_linsys.cc |
---|
[d482ee] | 88 | bool linearSystemSolve ( CFMatrix & M ); |
---|
[9fb70b] | 89 | |
---|
[3edea1] | 90 | CanonicalForm FACTORY_PUBLIC determinant ( const CFMatrix & M, int n ); |
---|
[9fb70b] | 91 | //}}} |
---|
| 92 | |
---|
[38eab60] | 93 | //{{{ function declarations from cf_resultant.cc |
---|
[2a9b48] | 94 | CFArray subResChain ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
| 95 | |
---|
[3edea1] | 96 | CanonicalForm FACTORY_PUBLIC resultant ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x ); |
---|
[f42ba19] | 97 | //}}} |
---|
| 98 | |
---|
[086f3e] | 99 | /** inline CanonicalForm abs ( const CanonicalForm & f ) |
---|
| 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 | * |
---|
| 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 |
---|
| 114 | * |
---|
| 115 | **/ |
---|
[041dbdc] | 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 */ |
---|