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