source: git/libpolys/polys/ext_fields/transext.h @ 69672d

fieker-DuValspielwiese
Last change on this file since 69672d was 69672d, checked in by Hans Schoenemann <hannes@…>, 12 years ago
fix: pardeg
  • Property mode set to 100644
File size: 5.9 KB
Line 
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
38struct ip_sring;
39typedef struct ip_sring * ring;
40
41
42// the following is only needed _here_ due to its use in clapsing.cc!
43#ifdef TRANSEXT_PRIVATES
44struct 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 */
65struct fractionObject
66{
67  poly numerator;
68  poly denominator;
69  int complexity;
70};
71
72typedef struct fractionObject * fraction;
73
74
75#define NUM(f) (((fraction)f)->numerator)
76#define DEN(f) (((fraction)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
86number ntInit(poly p, const coeffs cf);
87
88#endif
89
90
91/// struct for passing initialization parameters to naInitChar
92typedef struct { ring r; } TransExtInfo;
93
94/// Get a mapping function from src into the domain of this type (n_transExt)
95nMapFunc ntSetMap(const coeffs src, const coeffs dst);
96
97/// Initialize the coeffs object
98BOOLEAN  ntInitChar(coeffs cf, void* infoStruct);
99
100/* Private hidden interface
101BOOLEAN  ntGreaterZero(number a, const coeffs cf);
102BOOLEAN  ntGreater(number a, number b, const coeffs cf);
103BOOLEAN  ntEqual(number a, number b, const coeffs cf);
104BOOLEAN  ntIsOne(number a, const coeffs cf);
105BOOLEAN  ntIsMOne(number a, const coeffs cf);
106BOOLEAN  ntIsZero(number a, const coeffs cf);
107number   ntInit(int i, const coeffs cf);
108int      ntInt(number &a, const coeffs cf);
109number   ntNeg(number a, const coeffs cf);
110number   ntInvers(number a, const coeffs cf);
111number   ntAdd(number a, number b, const coeffs cf);
112number   ntSub(number a, number b, const coeffs cf);
113number   ntMult(number a, number b, const coeffs cf);
114number   ntDiv(number a, number b, const coeffs cf);
115void     ntPower(number a, int exp, number *b, const coeffs cf);
116number   ntCopy(number a, const coeffs cf);
117void     ntWrite(number &a, const coeffs cf);
118number   ntRePart(number a, const coeffs cf);
119number   ntImPart(number a, const coeffs cf);
120number   ntGetDenom(number &a, const coeffs cf);
121number   ntGetNumerator(number &a, const coeffs cf);
122number   ntGcd(number a, number b, const coeffs cf);
123number   ntLcm(number a, number b, const coeffs cf);
124int      ntSize(number a, const coeffs cf);
125void     ntDelete(number * a, const coeffs cf);
126void     ntCoeffWrite(const coeffs cf, BOOLEAN details);
127number   ntIntDiv(number a, number b, const coeffs cf);
128const char * ntRead(const char *s, number *a, const coeffs cf);
129static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
130*/
131
132/// return the specified parameter as a number in the given trans.ext.
133number ntParam(short iParameter, const coeffs cf);
134
135/// if m == var(i)/1 => return i,
136int ntIsParam(number, const coeffs);
137
138#endif
139/* TRANSEXT_H */
Note: See TracBrowser for help on using the repository browser.