source: git/libpolys/polys/ext_fields/transext.h @ 010f3b

spielwiese
Last change on this file since 010f3b was 010f3b, checked in by Frank Seelisch <seelisch@…>, 13 years ago
more tests for transcendental case
  • Property mode set to 100644
File size: 5.2 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 in the polynomial
12*           ring K[t_1, .., t_s] represented by cf->algring.
13*/
14
15#include <coeffs/coeffs.h>
16
17struct ip_sring;
18typedef struct ip_sring * ring;
19
20struct sip_sideal;
21typedef struct sip_sideal * ideal;
22
23struct spolyrec;
24typedef struct spolyrec polyrec;
25typedef polyrec * poly;
26
27/// struct for passing initialization parameters to naInitChar
28typedef struct { ring r; } TransExtInfo;
29
30/* a number in K(t_1, .., t_s) is represented by either NULL
31   (representing the zero number), or a pointer to a fraction which contains
32   the numerator polynomial and the denominator polynomial in K[t_1, .., t_s];
33   if the denominator is 1, the member 'denominator' is NULL;
34   as a consequence of the above we get: if some number n is not NULL, then
35   n->numerator cannot be NULL;
36   The member 'complexity' attempts to capture the complexity of any given
37   number n, i.e., starting with a bunch of numbers n_i that have their gcd's
38   cancelled out, n may be constructed from the n_i's by using field
39   arithmetics (+, -, *, /). If we never cancel out gcd's during this process,
40   n will become rather complex. The larger the attribute 'complexity' of n
41   is, the more likely it is that n contains some non-trivial gcd. Thus, this
42   attribute will be used by a heuristic method to cancel out gcd's from time
43   to time. (This heuristic may be set up such that cancellation can be
44   enforced after each arithmetic operation, or such that it will never take
45   place.) Moreover, the 'complexity' of n is zero iff the gcd in n (that is,
46   the gcd of its numerator and denominator) is trivial. */
47struct fractionObject
48{
49  poly numerator;
50  poly denominator;
51  int complexity;
52};
53typedef struct fractionObject * fraction;
54
55/* constants for controlling the complexity of numbers */
56#define ADD_COMPLEXITY 1   /**< complexity increase due to + and - */
57#define MULT_COMPLEXITY 2   /**< complexity increase due to * and / */
58#define BOUND_COMPLEXITY 10   /**< maximum complexity of a number */
59
60/* some useful accessors for fractions: */
61#define is0(f) (f == NULL) /**< TRUE iff n represents 0 in K(t_1, .., t_s) */
62#define num(f) f->numerator
63#define den(f) f->denominator
64#define denIs1(f) (f->denominator == NULL) /**< TRUE iff den. represents 1 */
65#define numIs1(f) (p_IsConstant(f->numerator, cf->extRing) && \
66                   n_IsOne(p_GetCoeff(num(f), cf->extRing), cf->extRing->cf))
67                   /**< TRUE iff num. represents 1 */
68#define c(f) f->complexity
69
70/// Get a mapping function from src into the domain of this type (n_transExt)
71nMapFunc ntSetMap(const coeffs src, const coeffs dst);
72
73/// Initialize the coeffs object
74BOOLEAN  ntInitChar(coeffs cf, void* infoStruct);
75
76/* Private hidden interface
77BOOLEAN  ntGreaterZero(number a, const coeffs cf);
78BOOLEAN  ntGreater(number a, number b, const coeffs cf);
79BOOLEAN  ntEqual(number a, number b, const coeffs cf);
80BOOLEAN  ntIsOne(number a, const coeffs cf);
81BOOLEAN  ntIsMOne(number a, const coeffs cf);
82BOOLEAN  ntIsZero(number a, const coeffs cf);
83number   ntInit(int i, const coeffs cf);
84int      ntInt(number &a, const coeffs cf);
85number   ntNeg(number a, const coeffs cf);
86number   ntInvers(number a, const coeffs cf);
87number   ntPar(int i, const coeffs cf);
88number   ntAdd(number a, number b, const coeffs cf);
89number   ntSub(number a, number b, const coeffs cf);
90number   ntMult(number a, number b, const coeffs cf);
91number   ntDiv(number a, number b, const coeffs cf);
92void     ntPower(number a, int exp, number *b, const coeffs cf);
93number   ntCopy(number a, const coeffs cf);
94void     ntWrite(number &a, const coeffs cf);
95number   ntRePart(number a, const coeffs cf);
96number   ntImPart(number a, const coeffs cf);
97number   ntGetDenom(number &a, const coeffs cf);
98number   ntGetNumerator(number &a, const coeffs cf);
99number   ntGcd(number a, number b, const coeffs cf);
100number   ntLcm(number a, number b, const coeffs cf);
101int      ntSize(number a, const coeffs cf);
102void     ntDelete(number * a, const coeffs cf);
103void     ntCoeffWrite(const coeffs cf);
104number   ntIntDiv(number a, number b, const coeffs cf);
105const char * ntRead(const char *s, number *a, const coeffs cf);
106static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
107*/
108
109#ifdef LDEBUG
110#define ntTest(a) ntDBTest(a,__FILE__,__LINE__,cf)
111BOOLEAN  ntDBTest(number a, const char *f, const int l, const coeffs r);
112#else
113#define ntTest(a)
114#endif
115
116/* our own type */
117#define ntID n_transExt
118
119/* polynomial ring in which the numerators and denominators of our
120   numbers live */
121#define ntRing cf->extRing
122
123/* coeffs object in which the coefficients of our numbers live;
124 * methods attached to ntCoeffs may be used to compute with the
125 * coefficients of our numbers, e.g., use ntCoeffs->nAdd to add
126 * coefficients of our numbers */
127#define ntCoeffs cf->extRing->cf
128
129#endif
130/* TRANSEXT_H */
Note: See TracBrowser for help on using the repository browser.