source: git/libpolys/polys/ext_fields/transext.h @ 0afa07

spielwiese
Last change on this file since 0afa07 was 0afa07, checked in by Frank Seelisch <seelisch@…>, 13 years ago
removed cfPar, cfParDeg, n_Par, n_ParDeg, ndPar, ndParDeg from coeffs
  • Property mode set to 100644
File size: 6.7 KB
Line 
1#ifndef TRANSEXT_H
2#define TRANSEXT_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id$ */
7/*
8* ABSTRACT: numbers in a rational function field K(t_1, .., t_s) with
9*           transcendental variables t_1, ..., t_s, where s >= 1.
10*           Denoting the implemented coeffs object by cf, then these numbers
11*           are represented as quotients of polynomials living in the
12*           polynomial ring K[t_1, .., t_s] represented by cf->extring.
13*
14*           An element of K(t_1, .., t_s) may have numerous representations,
15*           due to the possibility of common polynomial factors in the
16*           numerator and denominator. This problem is handled by a
17*           cancellation heuristic: Each number "knows" its complexity
18*           which is 0 if and only if common factors have definitely been
19*           cancelled, and some positive integer otherwise.
20*           Each arithmetic operation of two numbers with complexities c1
21*           and c2 will result in a number of complexity c1 + c2 + some
22*           penalty (specific for each arithmetic operation; see constants
23*           in the *.h file). Whenever the resulting complexity exceeds a
24*           certain threshold (see constant in the *.h file), then the
25*           cancellation heuristic will call 'factory' to compute the gcd
26*           and cancel it out in the given number. (This definite cancel-
27*           lation will also be performed at the beginning of ntWrite,
28*           ensuring that any output is free of common factors.
29*           For the special case of K = Q (i.e., when computing over the
30*           rationals), this definite cancellation procedure will also take
31*           care of nested fractions: If there are fractional coefficients
32*           in the numerator or denominator of a number, then this number
33*           is being replaced by a quotient of two polynomials over Z, or
34*           - if the denominator is a constant - by a polynomial over Q.
35*/
36
37#include <coeffs/coeffs.h>
38
39struct ip_sring;
40typedef struct ip_sring * ring;
41
42struct sip_sideal;
43typedef struct sip_sideal * ideal;
44
45struct spolyrec;
46typedef struct spolyrec polyrec;
47typedef polyrec * poly;
48
49/// struct for passing initialization parameters to naInitChar
50typedef struct { ring r; } TransExtInfo;
51
52/* a number in K(t_1, .., t_s) is represented by either NULL
53   (representing the zero number), or a pointer to a fraction which contains
54   the numerator polynomial and the denominator polynomial in K[t_1, .., t_s];
55   if the denominator is 1, the member 'denominator' is NULL;
56   as a consequence of the above we get: if some number n is not NULL, then
57   n->numerator cannot be NULL;
58   The member 'complexity' attempts to capture the complexity of any given
59   number n, i.e., starting with a bunch of numbers n_i that have their gcd's
60   cancelled out, n may be constructed from the n_i's by using field
61   arithmetics (+, -, *, /). If we never cancel out gcd's during this process,
62   n will become rather complex. The larger the attribute 'complexity' of n
63   is, the more likely it is that n contains some non-trivial gcd. Thus, this
64   attribute will be used by a heuristic method to cancel out gcd's from time
65   to time. (This heuristic may be set up such that cancellation can be
66   enforced after each arithmetic operation, or such that it will never take
67   place.) Moreover, the 'complexity' of n is zero iff the gcd in n (that is,
68   the gcd of its numerator and denominator) is trivial. */
69struct fractionObject
70{
71  poly numerator;
72  poly denominator;
73  int complexity;
74};
75typedef struct fractionObject * fraction;
76
77/* constants for controlling the complexity of numbers */
78#define ADD_COMPLEXITY 1   /**< complexity increase due to + and - */
79#define MULT_COMPLEXITY 2   /**< complexity increase due to * and / */
80#define BOUND_COMPLEXITY 10   /**< maximum complexity of a number */
81
82/* some useful accessors for fractions: */
83#define IS0(f) (f == NULL) /**< TRUE iff n represents 0 in K(t_1, .., t_s) */
84#define NUM(f) f->numerator
85#define DEN(f) f->denominator
86#define DENIS1(f) (f->denominator == NULL) /**< TRUE iff den. represents 1 */
87#define NUMIS1(f) (p_IsConstant(f->numerator, cf->extRing) && \
88                   n_IsOne(p_GetCoeff(f->numerator, cf->extRing), \
89                           cf->extRing->cf))
90                   /**< TRUE iff num. represents 1 */
91#define COM(f) f->complexity
92
93/// Get a mapping function from src into the domain of this type (n_transExt)
94nMapFunc ntSetMap(const coeffs src, const coeffs dst);
95
96/// Initialize the coeffs object
97BOOLEAN  ntInitChar(coeffs cf, void* infoStruct);
98
99/* Private hidden interface
100BOOLEAN  ntGreaterZero(number a, const coeffs cf);
101BOOLEAN  ntGreater(number a, number b, const coeffs cf);
102BOOLEAN  ntEqual(number a, number b, const coeffs cf);
103BOOLEAN  ntIsOne(number a, const coeffs cf);
104BOOLEAN  ntIsMOne(number a, const coeffs cf);
105BOOLEAN  ntIsZero(number a, const coeffs cf);
106number   ntInit(int i, const coeffs cf);
107int      ntInt(number &a, const coeffs cf);
108number   ntNeg(number a, const coeffs cf);
109number   ntInvers(number a, const coeffs cf);
110number   ntAdd(number a, number b, const coeffs cf);
111number   ntSub(number a, number b, const coeffs cf);
112number   ntMult(number a, number b, const coeffs cf);
113number   ntDiv(number a, number b, const coeffs cf);
114void     ntPower(number a, int exp, number *b, const coeffs cf);
115number   ntCopy(number a, const coeffs cf);
116void     ntWrite(number &a, const coeffs cf);
117number   ntRePart(number a, const coeffs cf);
118number   ntImPart(number a, const coeffs cf);
119number   ntGetDenom(number &a, const coeffs cf);
120number   ntGetNumerator(number &a, const coeffs cf);
121number   ntGcd(number a, number b, const coeffs cf);
122number   ntLcm(number a, number b, const coeffs cf);
123int      ntSize(number a, const coeffs cf);
124void     ntDelete(number * a, const coeffs cf);
125void     ntCoeffWrite(const coeffs cf);
126number   ntIntDiv(number a, number b, const coeffs cf);
127const char * ntRead(const char *s, number *a, const coeffs cf);
128static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
129*/
130
131#ifdef LDEBUG
132#define ntTest(a) ntDBTest(a,__FILE__,__LINE__,cf)
133BOOLEAN  ntDBTest(number a, const char *f, const int l, const coeffs r);
134#else
135#define ntTest(a)
136#endif
137
138/* our own type */
139#define ntID n_transExt
140
141/* polynomial ring in which the numerators and denominators of our
142   numbers live */
143#define ntRing cf->extRing
144
145/* coeffs object in which the coefficients of our numbers live;
146 * methods attached to ntCoeffs may be used to compute with the
147 * coefficients of our numbers, e.g., use ntCoeffs->nAdd to add
148 * coefficients of our numbers */
149#define ntCoeffs cf->extRing->cf
150
151#endif
152/* TRANSEXT_H */
Note: See TracBrowser for help on using the repository browser.