source: git/libpolys/coeffs/numbers.h @ ce1f78

jengelh-datetimespielwiese
Last change on this file since ce1f78 was ce1f78, checked in by Oleksandr Motsak <motsak@…>, 11 years ago
fixed short/long output of coeffs depending on ShortOut/CanShortOut options of rings Note: the ugly ShortOut correction p_String0Short/p_String0Long is due to Hans
  • Property mode set to 100644
File size: 3.5 KB
Line 
1#ifndef NUMBERS_H
2#define NUMBERS_H
3/****************************************
4*  Computer Algebra System SINGULAR     *
5****************************************/
6/* $Id$ */
7/*
8* ABSTRACT: compatility interface to coeffs
9*/
10#include <coeffs/coeffs.h>
11
12// the access methods
13//
14// the routines w.r.t. currRing:
15// (should only be used in the context of currRing, i.e. in t
16#define nCopy(n)          n_Copy(n, currRing->cf)
17#define nDelete(n)        n_Delete(n, currRing->cf)
18#define nMult(n1, n2)     n_Mult(n1, n2, currRing->cf)
19#define nAdd(n1, n2)      n_Add(n1, n2, currRing->cf)
20#define nIsZero(n)        n_IsZero(n, currRing->cf)
21#define nEqual(n1, n2)    n_Equal(n1, n2, currRing->cf)
22#define nNeg(n)           n_Neg(n, currRing->cf)
23#define nSub(n1, n2)      n_Sub(n1, n2, currRing->cf)
24#define nGetChar()        n_GetChar(currRing->cf)
25#define nInit(i)          n_Init(i, currRing->cf)
26#define nIsOne(n)         n_IsOne(n, currRing->cf)
27#define nIsMOne(n)        n_IsMOne(n, currRing->cf)
28#define nGreaterZero(n)   n_GreaterZero(n, currRing->cf)
29#define nGreater(a, b)    n_Greater (a,b,currRing->cf)
30#define nWrite(n)         n_Write(n, currRing->cf, rShortOut(currRing))
31#define nNormalize(n)     n_Normalize(n,currRing->cf)
32
33inline number nGcd(number a, number b, const coeffs cf) { return n_Gcd(a, b, cf); }
34
35#define nIntDiv(a, b)     n_IntDiv(a,b,currRing->cf)
36#define nDiv(a, b)        n_Div(a,b,currRing->cf)
37#define nInvers(a)        n_Invers(a,currRing->cf)
38#define nExactDiv(a, b)   n_ExactDiv(a,b,currRing->cf)
39#define nTest(a)          n_Test(a,currRing->cf)
40
41#define nInpMult(a, b)    n_InpMult(a,b,currRing->cf)
42#define nPower(a, b, res) n_Power(a,b,res,currRing->cf)
43#define nSize(n)          n_Size(n,currRing->cf)
44#define nGetDenom(N)      n_GetDenom((N),currRing->cf)
45#define nGetNumerator(N)  n_GetNumerator((N),currRing->cf)
46
47#define nSetMap(R)        n_SetMap(R,currRing->cf)
48
49
50// --------------------------------------------------------------
51// internal to coeffs, but public for all realizations
52
53#define SHORT_REAL_LENGTH 6 // use short reals for real <= 6 digits
54
55/* the dummy routines: */
56void nDummy1(number* d);
57void ndDelete(number* d, const coeffs r);
58number ndGcd(number a, number b, const coeffs);
59number ndCopy(number a, const coeffs r);
60number ndCopyMap(number a, const coeffs src, const coeffs dst);
61int ndSize(number a, const coeffs r);
62char * ndName(number n, const coeffs r);
63number ndGetDenom(number &n, const coeffs r);
64number ndGetNumerator(number &a,const coeffs r);
65number ndReturn0(number n, const coeffs r);
66number ndIntMod(number a, number b, const coeffs r);
67
68void   ndInpMult(number &a, number b, const coeffs r);
69void   ndInpAdd(number &a, number b, const coeffs r);
70
71void ndKillChar(coeffs);
72
73number  ndInit_bigint(number i, const coeffs dummy, const coeffs dst);
74
75BOOLEAN ndCoeffIsEqual(const coeffs r, n_coeffType n, void * parameter);
76
77/// Test whether a is a zero divisor in r
78/// i.e. not coprime with char. of r
79/// very inefficient implementation:
80/// should ONLY be used for debug stuff /tests
81BOOLEAN n_IsZeroDivisor( number a, const coeffs r);
82
83#ifdef LDEBUG
84void nDBDummy1(number* d,char *f, int l);
85BOOLEAN ndDBTest(number a, const char *f, const int l, const coeffs r);
86#endif
87
88#define nDivBy0 "div by 0"
89
90// dummy routines
91void   ndNormalize(number& d, const coeffs); // nNormalize...
92
93/// initialize an object of type coeff, return FALSE in case of success
94typedef BOOLEAN (*cfInitCharProc)(coeffs, void *);
95n_coeffType nRegister(n_coeffType n, cfInitCharProc p);
96
97#endif
Note: See TracBrowser for help on using the repository browser.