source: git/libpolys/polys/ext_fields/transext.h @ 2d3091c

Last change on this file since 2d3091c was 2d3091c, checked in by Frank Seelisch <seelisch@…>, 12 years ago
test for trac ticket #308 with new implementation (result is instantaneous)
  • Property mode set to 100644
File size: 5.2 KB
1#ifndef TRANSEXT_H
2#define TRANSEXT_H
4*  Computer Algebra System SINGULAR     *
6/* $Id$ */
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->extring.
15#include <coeffs/coeffs.h>
17struct ip_sring;
18typedef struct ip_sring * ring;
20struct sip_sideal;
21typedef struct sip_sideal * ideal;
23struct spolyrec;
24typedef struct spolyrec polyrec;
25typedef polyrec * poly;
27/// struct for passing initialization parameters to naInitChar
28typedef struct { ring r; } TransExtInfo;
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
49  poly numerator;
50  poly denominator;
51  int complexity;
53typedef struct fractionObject * fraction;
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 */
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(f->numerator, cf->extRing), \
67                           cf->extRing->cf))
68                   /**< TRUE iff num. represents 1 */
69#define COM(f) f->complexity
71/// Get a mapping function from src into the domain of this type (n_transExt)
72nMapFunc ntSetMap(const coeffs src, const coeffs dst);
74/// Initialize the coeffs object
75BOOLEAN  ntInitChar(coeffs cf, void* infoStruct);
77/* Private hidden interface
78BOOLEAN  ntGreaterZero(number a, const coeffs cf);
79BOOLEAN  ntGreater(number a, number b, const coeffs cf);
80BOOLEAN  ntEqual(number a, number b, const coeffs cf);
81BOOLEAN  ntIsOne(number a, const coeffs cf);
82BOOLEAN  ntIsMOne(number a, const coeffs cf);
83BOOLEAN  ntIsZero(number a, const coeffs cf);
84number   ntInit(int i, const coeffs cf);
85int      ntInt(number &a, const coeffs cf);
86number   ntNeg(number a, const coeffs cf);
87number   ntInvers(number a, const coeffs cf);
88number   ntPar(int i, const coeffs cf);
89number   ntAdd(number a, number b, const coeffs cf);
90number   ntSub(number a, number b, const coeffs cf);
91number   ntMult(number a, number b, const coeffs cf);
92number   ntDiv(number a, number b, const coeffs cf);
93void     ntPower(number a, int exp, number *b, const coeffs cf);
94number   ntCopy(number a, const coeffs cf);
95void     ntWrite(number &a, const coeffs cf);
96number   ntRePart(number a, const coeffs cf);
97number   ntImPart(number a, const coeffs cf);
98number   ntGetDenom(number &a, const coeffs cf);
99number   ntGetNumerator(number &a, const coeffs cf);
100number   ntGcd(number a, number b, const coeffs cf);
101number   ntLcm(number a, number b, const coeffs cf);
102int      ntSize(number a, const coeffs cf);
103void     ntDelete(number * a, const coeffs cf);
104void     ntCoeffWrite(const coeffs cf);
105number   ntIntDiv(number a, number b, const coeffs cf);
106const char * ntRead(const char *s, number *a, const coeffs cf);
107static BOOLEAN ntCoeffIsEqual(const coeffs cf, n_coeffType n, void * param);
110#ifdef LDEBUG
111#define ntTest(a) ntDBTest(a,__FILE__,__LINE__,cf)
112BOOLEAN  ntDBTest(number a, const char *f, const int l, const coeffs r);
114#define ntTest(a)
117/* our own type */
118#define ntID n_transExt
120/* polynomial ring in which the numerators and denominators of our
121   numbers live */
122#define ntRing cf->extRing
124/* coeffs object in which the coefficients of our numbers live;
125 * methods attached to ntCoeffs may be used to compute with the
126 * coefficients of our numbers, e.g., use ntCoeffs->nAdd to add
127 * coefficients of our numbers */
128#define ntCoeffs cf->extRing->cf
131/* TRANSEXT_H */
Note: See TracBrowser for help on using the repository browser.