source: git/libpolys/polys/ext_fields/transext.h @ 12f6ce0

spielwiese
Last change on this file since 12f6ce0 was 12f6ce0, checked in by Janko Boehm <boehm@…>, 11 years ago
Added differentiation of coefficients in transcendental extensions
  • Property mode set to 100644
File size: 5.8 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
100number ntDiff(number a, number d, const coeffs cf);
101
102/* Private hidden interface
103BOOLEAN  ntGreaterZero(number a, const coeffs cf);
104BOOLEAN  ntGreater(number a, number b, const coeffs cf);
105BOOLEAN  ntEqual(number a, number b, const coeffs cf);
106BOOLEAN  ntIsOne(number a, const coeffs cf);
107BOOLEAN  ntIsMOne(number a, const coeffs cf);
108BOOLEAN  ntIsZero(number a, const coeffs cf);
109number   ntInit(long i, const coeffs cf);
110int      ntInt(number &a, const coeffs cf);
111number   ntNeg(number a, const coeffs cf);
112number   ntInvers(number a, const coeffs cf);
113number   ntAdd(number a, number b, const coeffs cf);
114number   ntSub(number a, number b, const coeffs cf);
115number   ntMult(number a, number b, const coeffs cf);
116number   ntDiv(number a, number b, const coeffs cf);
117void     ntPower(number a, int exp, number *b, const coeffs cf);
118number   ntCopy(number a, const coeffs cf);
119void     ntWrite(number &a, const coeffs cf);
120number   ntRePart(number a, const coeffs cf);
121number   ntImPart(number a, const coeffs cf);
122number   ntGetDenom(number &a, const coeffs cf);
123number   ntGetNumerator(number &a, const coeffs cf);
124number   ntGcd(number a, number b, const coeffs cf);
125number   ntLcm(number a, number b, const coeffs cf);
126int      ntSize(number a, const coeffs cf);
127void     ntDelete(number * a, const coeffs cf);
128void     ntCoeffWrite(const coeffs cf, BOOLEAN details);
129number   ntIntDiv(number a, number b, const coeffs cf);
130const char * ntRead(const char *s, number *a, const coeffs cf);
131static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
132*/
133
134/// if m == var(i)/1 => return i,
135int ntIsParam(number, const coeffs);
136
137#endif
138/* TRANSEXT_H */
Note: See TracBrowser for help on using the repository browser.