My Project
Loading...
Searching...
No Matches
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"
38
39// restrict access to the internal represention as much as possible:
40#ifdef TRANSEXT_PRIVATES
41
42/** a number in K(t_1, .., t_s) is represented by either NULL
43 (representing the zero number), or a pointer to a fraction which contains
44 the numerator polynomial and the denominator polynomial in K[t_1, .., t_s];
45 if the denominator is 1, the member 'denominator' is NULL;
46 as a consequence of the above we get: if some number n is not NULL, then
47 n->numerator cannot be NULL;
48 The member 'complexity' attempts to capture the complexity of any given
49 number n, i.e., starting with a bunch of numbers n_i that have their gcd's
50 cancelled out, n may be constructed from the n_i's by using field
51 arithmetics (+, -, *, /). If we never cancel out gcd's during this process,
52 n will become rather complex. The larger the attribute 'complexity' of n
53 is, the more likely it is that n contains some non-trivial gcd. Thus, this
54 attribute will be used by a heuristic method to cancel out gcd's from time
55 to time. (This heuristic may be set up such that cancellation can be
56 enforced after each arithmetic operation, or such that it will never take
57 place.) Moreover, the 'complexity' of n is zero iff the gcd in n (that is,
58 the gcd of its numerator and denominator) is trivial.
59 */
60struct fractionObject
61{
62 poly numerator;
63 poly denominator;
64 int complexity;
65};
66
67typedef struct fractionObject * fraction;
68
69
70#define NUM(f) ((f)->numerator)
71#define DEN(f) ((f)->denominator)
72
73/* some useful accessors for fractions: */
74#define IS0(f) (f == NULL)
75/**< TRUE iff n represents 0 in K(t_1, .., t_s) */
76
77#define DENIS1(f) (DEN(f) == NULL)
78/**< TRUE iff den. represents 1 */
79
80/// takes over p!
81number ntInit(poly p, const coeffs cf);
82
83#endif
84
85
86
87/// struct for passing initialization parameters to naInitChar
88typedef struct { ring r; } TransExtInfo;
89
90/// Get a mapping function from src into the domain of this type (n_transExt)
91nMapFunc ntSetMap(const coeffs src, const coeffs dst);
92
93/// Initialize the coeffs object
94BOOLEAN ntInitChar(coeffs cf, void* infoStruct);
95
96number ntDiff(number a, number d, const coeffs cf);
97
98/* Private hidden interface
99BOOLEAN ntGreaterZero(number a, const coeffs cf);
100BOOLEAN ntGreater(number a, number b, const coeffs cf);
101BOOLEAN ntEqual(number a, number b, const coeffs cf);
102BOOLEAN ntIsOne(number a, const coeffs cf);
103BOOLEAN ntIsMOne(number a, const coeffs cf);
104BOOLEAN ntIsZero(number a, const coeffs cf);
105number ntInit(long i, const coeffs cf);
106int ntInt(number &a, const coeffs cf);
107number ntNeg(number a, const coeffs cf);
108number ntInvers(number a, const coeffs cf);
109number ntAdd(number a, number b, const coeffs cf);
110number ntSub(number a, number b, const coeffs cf);
111number ntMult(number a, number b, const coeffs cf);
112number ntDiv(number a, number b, const coeffs cf);
113void ntPower(number a, int exp, number *b, const coeffs cf);
114number ntCopy(number a, const coeffs cf);
115void ntWrite(number &a, const coeffs cf);
116number ntRePart(number a, const coeffs cf);
117number ntImPart(number a, const coeffs cf);
118number ntGetDenom(number &a, const coeffs cf);
119number ntGetNumerator(number &a, const coeffs cf);
120number ntGcd(number a, number b, const coeffs cf);
121number ntLcm(number a, number b, const coeffs cf);
122int ntSize(number a, const coeffs cf);
123void ntDelete(number * a, const coeffs cf);
124void ntCoeffWrite(const coeffs cf, BOOLEAN details);
125const char * ntRead(const char *s, number *a, const coeffs cf);
126static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
127*/
128
129/// if m == var(i)/1 => return i,
130int ntIsParam(number, const coeffs);
131
132/// helper routine for calling singclap_gcd_r
133poly gcd_over_Q ( poly f, poly g, const ring r);
134#endif
135/* TRANSEXT_H */
int BOOLEAN
Definition: auxiliary.h:87
int p
Definition: cfModGcd.cc:4078
g
Definition: cfModGcd.cc:4090
CanonicalForm cf
Definition: cfModGcd.cc:4083
FILE * f
Definition: checklibs.c:9
Coefficient rings, fields and other domains 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:73
The main handler for Singular numbers which are suitable for Singular polynomials.
number ntInit(long i, const coeffs cf)
Definition: transext.cc:704
number ntDiff(number a, number d, const coeffs cf)
Definition: transext.cc:897
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:2170
poly gcd_over_Q(poly f, poly g, const ring r)
helper routine for calling singclap_gcd_r
Definition: transext.cc:275
BOOLEAN ntInitChar(coeffs cf, void *infoStruct)
Initialize the coeffs object.
Definition: transext.cc:2636
int ntIsParam(number, const coeffs)
if m == var(i)/1 => return i,
Definition: transext.cc:2308
struct for passing initialization parameters to naInitChar
Definition: transext.h:88