source: git/libpolys/polys/ext_fields/transext.h @ c8e030

fieker-DuValspielwiese
Last change on this file since c8e030 was 03f7b5, checked in by Oleksandr Motsak <motsak@…>, 13 years ago
ADD: detailed printing vs typing for coeff. domains (mostly - minpoly related)
  • 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/* $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
42
43// the following is only needed _here_ due to its use in clapsing.cc!
44#ifdef TRANSEXT_PRIVATES
45struct spolyrec; typedef struct spolyrec polyrec; typedef polyrec * poly;
46
47
48/** a number in K(t_1, .., t_s) is represented by either NULL
49   (representing the zero number), or a pointer to a fraction which contains
50   the numerator polynomial and the denominator polynomial in K[t_1, .., t_s];
51   if the denominator is 1, the member 'denominator' is NULL;
52   as a consequence of the above we get: if some number n is not NULL, then
53   n->numerator cannot be NULL;
54   The member 'complexity' attempts to capture the complexity of any given
55   number n, i.e., starting with a bunch of numbers n_i that have their gcd's
56   cancelled out, n may be constructed from the n_i's by using field
57   arithmetics (+, -, *, /). If we never cancel out gcd's during this process,
58   n will become rather complex. The larger the attribute 'complexity' of n
59   is, the more likely it is that n contains some non-trivial gcd. Thus, this
60   attribute will be used by a heuristic method to cancel out gcd's from time
61   to time. (This heuristic may be set up such that cancellation can be
62   enforced after each arithmetic operation, or such that it will never take
63   place.) Moreover, the 'complexity' of n is zero iff the gcd in n (that is,
64     the gcd of its numerator and denominator) is trivial.
65 */
66struct fractionObject
67{
68  poly numerator;
69  poly denominator;
70  int complexity;
71};
72
73typedef struct fractionObject * fraction;
74
75
76#define NUM(f) (((fraction)f)->numerator)
77#define DEN(f) (((fraction)f)->denominator)
78
79/* some useful accessors for fractions: */
80#define IS0(f) (f == NULL)
81/**< TRUE iff n represents 0 in K(t_1, .., t_s) */
82
83#define DENIS1(f) (DEN(f) == NULL)
84/**< TRUE iff den. represents 1 */
85
86
87number ntInit(poly p, const coeffs cf);
88
89#endif
90
91
92/// struct for passing initialization parameters to naInitChar
93typedef struct { ring r; } TransExtInfo;
94
95/// Get a mapping function from src into the domain of this type (n_transExt)
96nMapFunc ntSetMap(const coeffs src, const coeffs dst);
97
98/// Initialize the coeffs object
99BOOLEAN  ntInitChar(coeffs cf, void* infoStruct);
100
101/* Private hidden interface
102BOOLEAN  ntGreaterZero(number a, const coeffs cf);
103BOOLEAN  ntGreater(number a, number b, const coeffs cf);
104BOOLEAN  ntEqual(number a, number b, const coeffs cf);
105BOOLEAN  ntIsOne(number a, const coeffs cf);
106BOOLEAN  ntIsMOne(number a, const coeffs cf);
107BOOLEAN  ntIsZero(number a, const coeffs cf);
108number   ntInit(int i, const coeffs cf);
109int      ntInt(number &a, const coeffs cf);
110number   ntNeg(number a, const coeffs cf);
111number   ntInvers(number a, const coeffs cf);
112number   ntAdd(number a, number b, const coeffs cf);
113number   ntSub(number a, number b, const coeffs cf);
114number   ntMult(number a, number b, const coeffs cf);
115number   ntDiv(number a, number b, const coeffs cf);
116void     ntPower(number a, int exp, number *b, const coeffs cf);
117number   ntCopy(number a, const coeffs cf);
118void     ntWrite(number &a, const coeffs cf);
119number   ntRePart(number a, const coeffs cf);
120number   ntImPart(number a, const coeffs cf);
121number   ntGetDenom(number &a, const coeffs cf);
122number   ntGetNumerator(number &a, const coeffs cf);
123number   ntGcd(number a, number b, const coeffs cf);
124number   ntLcm(number a, number b, const coeffs cf);
125int      ntSize(number a, const coeffs cf);
126void     ntDelete(number * a, const coeffs cf);
127void     ntCoeffWrite(const coeffs cf, BOOLEAN details);
128number   ntIntDiv(number a, number b, const coeffs cf);
129const char * ntRead(const char *s, number *a, const coeffs cf);
130static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
131*/
132
133/// return the specified parameter as a number in the given trans.ext.
134number ntParam(short iParameter, const coeffs cf);
135
136/// if m == var(i)/1 => return i,
137int ntIsParam(number, const coeffs);
138
139#endif
140/* TRANSEXT_H */
Note: See TracBrowser for help on using the repository browser.