transext.h
Go to the documentation of this file.
1 #ifndef TRANSEXT_H
2 #define TRANSEXT_H
3 /****************************************
4 * Computer Algebra System SINGULAR *
5 ****************************************/
6 /*
7 * ABSTRACT: numbers in a rational function field K(t_1, .., t_s) with
8 * transcendental variables t_1, ..., t_s, where s >= 1.
9 * Denoting the implemented coeffs object by cf, then these numbers
10 * are represented as quotients of polynomials living in the
11 * polynomial ring K[t_1, .., t_s] represented by cf->extring.
12 *
13 * An element of K(t_1, .., t_s) may have numerous representations,
14 * due to the possibility of common polynomial factors in the
15 * numerator and denominator. This problem is handled by a
16 * cancellation heuristic: Each number "knows" its complexity
17 * which is 0 if and only if common factors have definitely been
18 * cancelled, and some positive integer otherwise.
19 * Each arithmetic operation of two numbers with complexities c1
20 * and c2 will result in a number of complexity c1 + c2 + some
21 * penalty (specific for each arithmetic operation; see constants
22 * in the *.h file). Whenever the resulting complexity exceeds a
23 * certain threshold (see constant in the *.h file), then the
24 * cancellation heuristic will call 'factory' to compute the gcd
25 * and cancel it out in the given number. (This definite cancel-
26 * lation will also be performed at the beginning of ntWrite,
27 * ensuring that any output is free of common factors.
28 * For the special case of K = Q (i.e., when computing over the
29 * rationals), this definite cancellation procedure will also take
30 * care of nested fractions: If there are fractional coefficients
31 * in the numerator or denominator of a number, then this number
32 * is being replaced by a quotient of two polynomials over Z, or
33 * - if the denominator is a constant - by a polynomial over Q.
34 */
35 
36 #include <coeffs/coeffs.h>
37 
38 struct ip_sring;
39 typedef struct ip_sring * ring;
40 
41 
42 // the following is only needed _here_ due to its use in clapsing.cc!
43 #ifdef TRANSEXT_PRIVATES
44 struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec * poly;
45 
46 
47 /** a number in K(t_1, .., t_s) is represented by either NULL
48  (representing the zero number), or a pointer to a fraction which contains
49  the numerator polynomial and the denominator polynomial in K[t_1, .., t_s];
50  if the denominator is 1, the member 'denominator' is NULL;
51  as a consequence of the above we get: if some number n is not NULL, then
52  n->numerator cannot be NULL;
53  The member 'complexity' attempts to capture the complexity of any given
54  number n, i.e., starting with a bunch of numbers n_i that have their gcd's
55  cancelled out, n may be constructed from the n_i's by using field
56  arithmetics (+, -, *, /). If we never cancel out gcd's during this process,
57  n will become rather complex. The larger the attribute 'complexity' of n
58  is, the more likely it is that n contains some non-trivial gcd. Thus, this
59  attribute will be used by a heuristic method to cancel out gcd's from time
60  to time. (This heuristic may be set up such that cancellation can be
61  enforced after each arithmetic operation, or such that it will never take
62  place.) Moreover, the 'complexity' of n is zero iff the gcd in n (that is,
63  the gcd of its numerator and denominator) is trivial.
64  */
65 struct fractionObject
66 {
67  poly numerator;
68  poly denominator;
69  int complexity;
70 };
71 
72 typedef struct fractionObject * fraction;
73 
74 
75 #define NUM(f) ((f)->numerator)
76 #define DEN(f) ((f)->denominator)
77 
78 /* some useful accessors for fractions: */
79 #define IS0(f) (f == NULL)
80 /**< TRUE iff n represents 0 in K(t_1, .., t_s) */
81 
82 #define DENIS1(f) (DEN(f) == NULL)
83 /**< TRUE iff den. represents 1 */
84 
85 
86 number ntInit(poly p, const coeffs cf);
87 
88 #endif
89 
90 
91 /// struct for passing initialization parameters to naInitChar
92 typedef struct { ring r; } TransExtInfo;
93 
94 /// Get a mapping function from src into the domain of this type (n_transExt)
95 nMapFunc ntSetMap(const coeffs src, const coeffs dst);
96 
97 /// Initialize the coeffs object
98 BOOLEAN ntInitChar(coeffs cf, void* infoStruct);
99 
100 number ntDiff(number a, number d, const coeffs cf);
101 
102 /* Private hidden interface
103 BOOLEAN ntGreaterZero(number a, const coeffs cf);
104 BOOLEAN ntGreater(number a, number b, const coeffs cf);
105 BOOLEAN ntEqual(number a, number b, const coeffs cf);
106 BOOLEAN ntIsOne(number a, const coeffs cf);
107 BOOLEAN ntIsMOne(number a, const coeffs cf);
108 BOOLEAN ntIsZero(number a, const coeffs cf);
109 number ntInit(long i, const coeffs cf);
110 int ntInt(number &a, const coeffs cf);
111 number ntNeg(number a, const coeffs cf);
112 number ntInvers(number a, const coeffs cf);
113 number ntAdd(number a, number b, const coeffs cf);
114 number ntSub(number a, number b, const coeffs cf);
115 number ntMult(number a, number b, const coeffs cf);
116 number ntDiv(number a, number b, const coeffs cf);
117 void ntPower(number a, int exp, number *b, const coeffs cf);
118 number ntCopy(number a, const coeffs cf);
119 void ntWrite(number &a, const coeffs cf);
120 number ntRePart(number a, const coeffs cf);
121 number ntImPart(number a, const coeffs cf);
122 number ntGetDenom(number &a, const coeffs cf);
123 number ntGetNumerator(number &a, const coeffs cf);
124 number ntGcd(number a, number b, const coeffs cf);
125 number ntLcm(number a, number b, const coeffs cf);
126 int ntSize(number a, const coeffs cf);
127 void ntDelete(number * a, const coeffs cf);
128 void ntCoeffWrite(const coeffs cf, BOOLEAN details);
129 const char * ntRead(const char *s, number *a, const coeffs cf);
130 static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
131 */
132 
133 /// if m == var(i)/1 => return i,
134 int ntIsParam(number, const coeffs);
135 
136 #endif
137 /* TRANSEXT_H */
const poly a
Definition: syzextra.cc:212
BOOLEAN ntInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition: transext.cc:2503
return P p
Definition: myNF.cc:203
Definition: ring.h:209
number ntDiff(number a, number d, const coeffs cf)
Definition: transext.cc:813
int ntIsParam(number, const coeffs)
if m == var(i)/1 => return i,
Definition: transext.cc:2204
Coefficient rings, fields and other domains suitable for Singular polynomials.
number ntInit(long i, const coeffs cf)
Definition: transext.cc:615
The main handler for Singular numbers which are suitable for Singular polynomials.
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:72
struct for passing initialization parameters to naInitChar
Definition: transext.h:92
nMapFunc ntSetMap(const coeffs src, const coeffs dst)
Get a mapping function from src into the domain of this type (n_transExt)
Definition: transext.cc:2070
CanonicalForm cf
Definition: cfModGcd.cc:4024
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:131