source: git/factory/cf_algorithm.h @ 80b8fe

spielwiese
Last change on this file since 80b8fe was 086f3e, checked in by Martin Lee <martinlee84@…>, 10 years ago
chg: more old comments -> doxygen
  • Property mode set to 100644
File size: 3.9 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2
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
22#ifndef INCL_CF_ALGORITHM_H
23#define INCL_CF_ALGORITHM_H
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
33CanonicalForm psr ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x );
34
35CanonicalForm psq ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x );
36
37void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r, const Variable & x );
38
39CanonicalForm bCommonDen ( const CanonicalForm & f );
40
41bool fdivides ( const CanonicalForm & f, const CanonicalForm & g );
42
43bool fdivides ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm& quot );
44
45bool tryFdivides ( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm& M, bool& fail );
46
47CanonicalForm maxNorm ( const CanonicalForm & f );
48
49CanonicalForm euclideanNorm ( const CanonicalForm & f );
50//}}}
51
52//{{{ function declarations from cf_chinese.cc
53void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2, const CanonicalForm & q2, CanonicalForm & xnew, CanonicalForm & qnew );
54
55void chineseRemainder ( const CFArray & x, const CFArray & q, CanonicalForm & xnew, CanonicalForm & qnew );
56
57CanonicalForm Farey ( const CanonicalForm & f, const CanonicalForm & q );
58//}}}
59
60//{{{ function declarations from cf_factor.cc
61extern int singular_homog_flag;
62
63bool isPurePoly(const CanonicalForm & f);
64
65bool isPurePoly_m(const CanonicalForm & f);
66
67CFFList factorize ( const CanonicalForm & f, bool issqrfree = false );
68
69CFFList factorize ( const CanonicalForm & f, const Variable & alpha );
70
71CFFList sqrFree ( const CanonicalForm & f, bool sort= false );
72
73CanonicalForm homogenize( const CanonicalForm & f, const Variable & x);
74CanonicalForm homogenize( const CanonicalForm & f, const Variable & x,
75                                const Variable & v1, const Variable & v2);
76Variable get_max_degree_Variable(const CanonicalForm & f);
77CFList get_Terms( const CanonicalForm & f );
78void getTerms( const CanonicalForm & f, const CanonicalForm & t, CFList & result );
79
80
81//}}}
82
83//{{{ function declarations from cf_linsys.cc
84bool linearSystemSolve ( CFMatrix & M );
85
86CanonicalForm determinant ( const CFMatrix & M, int n );
87//}}}
88
89//{{{ function declarations from cf_resultant.cc
90CFArray subResChain ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x );
91
92CanonicalForm resultant ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x );
93//}}}
94
95/** inline CanonicalForm abs ( const CanonicalForm & f )
96 *
97 * abs() - return absolute value of `f'.
98 *
99 * The absolute value is defined in terms of the function
100 * `sign()'.  If it reports negative sign for `f' than -`f' is
101 * returned, otherwise `f'.
102 *
103 * This behaviour is most useful for integers and rationals.  But
104 * it may be used to sign-normalize the leading coefficient of
105 * arbitrary polynomials, too.
106 *
107 * Type info:
108 * ----------
109 * f: CurrentPP
110 *
111**/
112inline CanonicalForm
113abs ( const CanonicalForm & f )
114{
115    // it is not only more general to use `sign()' instead of a
116    // direct comparison `f < 0', it is faster, too
117    if ( sign( f ) < 0 )
118        return -f;
119    else
120        return f;
121}
122//}}}
123
124/*ENDPUBLIC*/
125
126#endif /* ! INCL_CF_ALGORITHM_H */
Note: See TracBrowser for help on using the repository browser.