source: git/factory/cf_algorithm.h @ 42281d6

fieker-DuValspielwiese
Last change on this file since 42281d6 was 42281d6, checked in by Martin Lee <martinlee84@…>, 13 years ago
divisibility test git-svn-id: file:///usr/local/Singular/svn/trunk@14328 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 3.8 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id$ */
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//
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// ----------------
18// This header file collects declarations of most of the
19// functions in Factory which implement higher level algorithms
20// on canonical forms (factorization, gcd, etc.) and declarations
21// of some low level mathematical functions, too (absolute value,
22// euclidean norm, etc.).
23//
24//}}}
25
26#include <config.h>
27
28#include "canonicalform.h"
29#include "variable.h"
30
31/*BEGINPUBLIC*/
32
33//{{{ function declarations from cf_algorithm.cc
34CanonicalForm psr ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x );
35
36CanonicalForm psq ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x );
37
38void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r, const Variable & x );
39
40CanonicalForm bCommonDen ( const CanonicalForm & f );
41
42bool fdivides ( const CanonicalForm & f, const CanonicalForm & g );
43
44bool tryFdivides ( const CanonicalForm & f, const CanonicalForm & g, const CanonicalForm& M, bool& fail );
45
46CanonicalForm maxNorm ( const CanonicalForm & f );
47
48CanonicalForm euclideanNorm ( const CanonicalForm & f );
49//}}}
50
51//{{{ function declarations from cf_chinese.cc
52void chineseRemainder ( const CanonicalForm & x1, const CanonicalForm & q1, const CanonicalForm & x2, const CanonicalForm & q2, CanonicalForm & xnew, CanonicalForm & qnew );
53
54void chineseRemainder ( const CFArray & x, const CFArray & q, CanonicalForm & xnew, CanonicalForm & qnew );
55
56CanonicalForm Farey ( const CanonicalForm & f, const CanonicalForm & q );
57//}}}
58
59//{{{ function declarations from cf_factor.cc
60extern int singular_homog_flag;
61
62bool isPurePoly(const CanonicalForm & f);
63
64bool isPurePoly_m(const CanonicalForm & f);
65
66CFFList factorize ( const CanonicalForm & f, bool issqrfree = false );
67
68CFFList factorize ( const CanonicalForm & f, const Variable & alpha );
69
70CFFList sqrFree ( const CanonicalForm & f );
71
72bool isSqrFree ( const CanonicalForm & f );
73
74CanonicalForm homogenize( const CanonicalForm & f, const Variable & x);
75CanonicalForm homogenize( const CanonicalForm & f, const Variable & x,
76                                const Variable & v1, const Variable & v2);
77Variable get_max_degree_Variable(const CanonicalForm & f);
78CFList get_Terms( const CanonicalForm & f );
79void getTerms( const CanonicalForm & f, const CanonicalForm & t, CFList & result );
80
81
82//}}}
83
84//{{{ function declarations from cf_linsys.cc
85bool linearSystemSolve ( CFMatrix & M );
86
87CanonicalForm determinant ( const CFMatrix & M, int n );
88//}}}
89
90//{{{ function declarations from cf_resultant.cc
91CFArray subResChain ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x );
92
93CanonicalForm resultant ( const CanonicalForm & f, const CanonicalForm & g, const Variable & x );
94//}}}
95
96//{{{ inline CanonicalForm abs ( const CanonicalForm & f )
97//{{{ docu
98//
99// abs() - return absolute value of `f'.
100//
101// The absolute value is defined in terms of the function
102// `sign()'.  If it reports negative sign for `f' than -`f' is
103// returned, otherwise `f'.
104//
105// This behaviour is most useful for integers and rationals.  But
106// it may be used to sign-normalize the leading coefficient of
107// arbitrary polynomials, too.
108//
109// Type info:
110// ----------
111// f: CurrentPP
112//
113//}}}
114inline CanonicalForm
115abs ( const CanonicalForm & f )
116{
117    // it is not only more general to use `sign()' instead of a
118    // direct comparison `f < 0', it is faster, too
119    if ( sign( f ) < 0 )
120        return -f;
121    else
122        return f;
123}
124//}}}
125
126/*ENDPUBLIC*/
127
128#endif /* ! INCL_CF_ALGORITHM_H */
Note: See TracBrowser for help on using the repository browser.