Functions | Variables
nforder_elt.cc File Reference
#include "kernel/mod2.h"
#include "Singular/ipid.h"
#include "Singular/number2.h"
#include <coeffs/numbers.h>
#include <coeffs/coeffs.h>
#include "Singular/blackbox.h"
#include "nforder.h"
#include <coeffs/bigintmat.h>

Go to the source code of this file.

Functions

static void WriteRing (const coeffs r, BOOLEAN details)
 
static char * CoeffString (const coeffs r)
 
static void EltWrite (number a, const coeffs r)
 
number EltCreateMat (nforder *a, bigintmat *b)
 
static BOOLEAN order_cmp (coeffs n, n_coeffType t, void *parameter)
 
static void KillChar (coeffs r)
 
BOOLEAN EltDBTest (number, const char *, const int, const coeffs)
 
static void SetChar (const coeffs r)
 
static number EltMult (number a, number b, const coeffs r)
 
static number EltSub (number a, number b, const coeffs r)
 
static number EltAdd (number a, number b, const coeffs r)
 
static number EltDiv (number a, number b, const coeffs r)
 
static number EltIntDiv (number a, number b, const coeffs r)
 
static number EltIntMod (number a, number b, const coeffs r)
 
static number EltExactDiv (number a, number b, const coeffs r)
 
static number EltInit (long i, const coeffs r)
 init with an integer More...
 
static number EltInitMPZ (mpz_t i, const coeffs r)
 init with a GMP integer More...
 
static int EltSize (number n, const coeffs r)
 how complicated, (0) => 0, or positive More...
 
static long EltInt (number &n, const coeffs r)
 convertion to int, 0 if impossible More...
 
static void EltMPZ (mpz_t result, number &n, const coeffs r)
 Converts a non-negative number n into a GMP number, 0 if impossible. More...
 
static number EltNeg (number a, const coeffs r)
 changes argument inline: a:= -a return -a! (no copy is returned) the result should be assigned to the original argument: e.g. a = n_Neg(a,r) More...
 
static number EltInvers (number a, const coeffs r)
 return 1/a More...
 
static number EltCopy (number a, const coeffs r)
 
static const char * EltRead (const char *s, number *a, const coeffs r)
 
static BOOLEAN EltEqual (number a, number b, const coeffs r)
 
static BOOLEAN EltGreater (number a, number b, const coeffs r)
 
static BOOLEAN EltIsOne (number a, const coeffs r)
 
static BOOLEAN EltIsMOne (number a, const coeffs r)
 
static BOOLEAN EltGreaterZero (number a, const coeffs r)
 
static BOOLEAN EltIsZero (number a, const coeffs r)
 
static nMapFunc EltSetMap (const coeffs src, const coeffs dst)
 
static void EltDelete (number *a, const coeffs r)
 
BOOLEAN n_nfOrderInit (coeffs r, void *parameter)
 

Variables

n_coeffType nforder_type
 

Function Documentation

static char* CoeffString ( const coeffs  r)
static

Definition at line 18 of file nforder_elt.cc.

19 {
20  return ((nforder *)r->data)->String();
21 }
static number EltAdd ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 85 of file nforder_elt.cc.

86 {
87  nforder *O = (nforder*) (r->data);
88  bigintmat *c = new bigintmat((bigintmat*)a);
89  O->elAdd(c, (bigintmat*) b);
90  return (number) c;
91 }
const poly a
Definition: syzextra.cc:212
void elAdd(bigintmat *a, bigintmat *b)
Definition: nforder.cpp:301
Matrices of numbers.
Definition: bigintmat.h:32
const poly b
Definition: syzextra.cc:213
static number EltCopy ( number  a,
const coeffs  r 
)
static

Definition at line 172 of file nforder_elt.cc.

173 {
174  return EltCreateMat((nforder*)r->data, (bigintmat*)a);
175 }
const poly a
Definition: syzextra.cc:212
Matrices of numbers.
Definition: bigintmat.h:32
number EltCreateMat(nforder *a, bigintmat *b)
Definition: nforder_elt.cc:34
number EltCreateMat ( nforder a,
bigintmat b 
)

Definition at line 34 of file nforder_elt.cc.

35 {
36  number xx;
37  if (b->rows()==1) {
38  assume(b->cols()==a->getDim());
39  xx = (number) b->transpose();
40  } else {
41  assume(b->rows() == a->getDim());
42  assume(b->cols() == 1);
43  xx = (number) new bigintmat((bigintmat*)b);
44  }
45 // Print("Created new element %lx from %lx\n", xx, b);
46  return (number) xx;
47 }
bigintmat * transpose()
Definition: bigintmat.cc:38
Matrices of numbers.
Definition: bigintmat.h:32
#define assume(x)
Definition: mod2.h:405
int cols() const
Definition: bigintmat.h:128
int rows() const
Definition: bigintmat.h:129
int getDim()
Definition: nforder.cpp:235
const poly b
Definition: syzextra.cc:213
BOOLEAN EltDBTest ( number  ,
const char *  ,
const int  ,
const coeffs   
)

Definition at line 59 of file nforder_elt.cc.

60 {
61  return TRUE;
62 }
#define TRUE
Definition: auxiliary.h:144
static void EltDelete ( number *  a,
const coeffs  r 
)
static

Definition at line 219 of file nforder_elt.cc.

220 {
221 // Print("Deleting %lx\n%s\n", *a, (((bigintmat*)(*a))->String()));
222 
223  delete (bigintmat*)(*a);
224  *a = NULL;
225 }
const poly a
Definition: syzextra.cc:212
Matrices of numbers.
Definition: bigintmat.h:32
#define NULL
Definition: omList.c:10
static number EltDiv ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 92 of file nforder_elt.cc.

93 {
94  Werror("%s called\n", __func__, a, b, r);
95  return NULL;
96 }
const poly a
Definition: syzextra.cc:212
#define NULL
Definition: omList.c:10
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static BOOLEAN EltEqual ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 183 of file nforder_elt.cc.

184 {
185  Print("%s called\n", __func__, a, b, r);
186  return 0;
187 }
const poly a
Definition: syzextra.cc:212
#define Print
Definition: emacs.cc:83
const poly b
Definition: syzextra.cc:213
static number EltExactDiv ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 107 of file nforder_elt.cc.

108 {
109  Werror("%s called\n", __func__, a, b, r);
110  return NULL;
111 }
const poly a
Definition: syzextra.cc:212
#define NULL
Definition: omList.c:10
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static BOOLEAN EltGreater ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 188 of file nforder_elt.cc.

189 {
190  Print("%s called\n", __func__, a, b, r);
191  return 0;
192 }
const poly a
Definition: syzextra.cc:212
#define Print
Definition: emacs.cc:83
const poly b
Definition: syzextra.cc:213
static BOOLEAN EltGreaterZero ( number  a,
const coeffs  r 
)
static

Definition at line 203 of file nforder_elt.cc.

204 {
205 // Print("%s called\n", __func__, a, r);
206  return 1;
207 }
static number EltInit ( long  i,
const coeffs  r 
)
static

init with an integer

Definition at line 113 of file nforder_elt.cc.

115 {
116  nforder * O = (nforder*) r->data;
117  if (!O) return NULL; //during init, this seems to be called with O==NULL
118  coeffs C = O->basecoeffs();
119  bigintmat * b = new bigintmat(O->getDim(), 1, C);
120  if (O->oneIsOne()) {
121  basis_elt(b, 1);
122  number I = n_Init(i, C);
123  b->skalmult(I, C);
124  n_Delete(&I, C);
125  return (number) b;
126  } else
127  return NULL;
128 }
bool oneIsOne()
Definition: nforder.h:84
Matrices of numbers.
Definition: bigintmat.h:32
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:539
int int kStrategy strat if(h==NULL) return NULL
The main handler for Singular numbers which are suitable for Singular polynomials.
bool skalmult(number b, coeffs c)
Multipliziert zur Matrix den Skalar b hinzu.
Definition: bigintmat.cc:906
int i
Definition: cfEzgcd.cc:123
coeffs basecoeffs() const
Definition: nforder.h:76
#define NULL
Definition: omList.c:10
void basis_elt(bigintmat *m, int i)
Definition: nforder.cpp:422
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
int getDim()
Definition: nforder.cpp:235
const poly b
Definition: syzextra.cc:213
static number EltInitMPZ ( mpz_t  i,
const coeffs  r 
)
static

init with a GMP integer

Definition at line 131 of file nforder_elt.cc.

133 {
134  Werror("%s called\n", __func__);
135  return NULL;
136 }
#define NULL
Definition: omList.c:10
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static long EltInt ( number &  n,
const coeffs  r 
)
static

convertion to int, 0 if impossible

Definition at line 145 of file nforder_elt.cc.

147 {
148  Werror("%s called\n", __func__);
149  return NULL;
150 }
#define NULL
Definition: omList.c:10
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static number EltIntDiv ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 97 of file nforder_elt.cc.

98 {
99  Werror("IntDiv called on order elts", a, b, r);
100  return NULL;
101 }
const poly a
Definition: syzextra.cc:212
#define NULL
Definition: omList.c:10
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static number EltIntMod ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 102 of file nforder_elt.cc.

103 {
104  Werror("IntMod called on order elts", a, b, r);
105  return NULL;
106 }
const poly a
Definition: syzextra.cc:212
#define NULL
Definition: omList.c:10
const poly b
Definition: syzextra.cc:213
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static number EltInvers ( number  a,
const coeffs  r 
)
static

return 1/a

Definition at line 166 of file nforder_elt.cc.

168 {
169  Werror("%s called\n", __func__);
170  return NULL;
171 }
#define NULL
Definition: omList.c:10
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static BOOLEAN EltIsMOne ( number  a,
const coeffs  r 
)
static

Definition at line 198 of file nforder_elt.cc.

199 {
200 // Print("%s called\n", __func__, a, r);
201  return 0;
202 }
static BOOLEAN EltIsOne ( number  a,
const coeffs  r 
)
static

Definition at line 193 of file nforder_elt.cc.

194 {
195 // Print("%s called\n", __func__, a, r);
196  return 0;
197 }
static BOOLEAN EltIsZero ( number  a,
const coeffs  r 
)
static

Definition at line 208 of file nforder_elt.cc.

209 {
210  return (a==NULL) || ((bigintmat*)a)->isZero();
211 }
const poly a
Definition: syzextra.cc:212
Matrices of numbers.
Definition: bigintmat.h:32
#define NULL
Definition: omList.c:10
static void EltMPZ ( mpz_t  result,
number &  n,
const coeffs  r 
)
static

Converts a non-negative number n into a GMP number, 0 if impossible.

Definition at line 152 of file nforder_elt.cc.

154 {
155  Werror("%s called\n", __func__);
156 }
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static number EltMult ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 71 of file nforder_elt.cc.

72 {
73  nforder *O = (nforder*) (r->data);
74  bigintmat *c = new bigintmat((bigintmat*)a);
75  O->elMult(c, (bigintmat*) b);
76  return (number) c;
77 }
const poly a
Definition: syzextra.cc:212
Matrices of numbers.
Definition: bigintmat.h:32
void elMult(bigintmat *a, bigintmat *b)
Definition: nforder.cpp:321
const poly b
Definition: syzextra.cc:213
static number EltNeg ( number  a,
const coeffs  r 
)
static

changes argument inline: a:= -a return -a! (no copy is returned) the result should be assigned to the original argument: e.g. a = n_Neg(a,r)

return -a

Definition at line 160 of file nforder_elt.cc.

162 {
163  Werror("%s called\n", __func__);
164  return NULL;
165 }
#define NULL
Definition: omList.c:10
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static const char* EltRead ( const char *  s,
number *  a,
const coeffs  r 
)
static

Definition at line 177 of file nforder_elt.cc.

178 {
179 // Print("%s called with ->%s-<\n", __func__, s);
180  return s;
181 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static nMapFunc EltSetMap ( const coeffs  src,
const coeffs  dst 
)
static

Definition at line 213 of file nforder_elt.cc.

214 {
215  Print("%s called\n", __func__, src, dst);
216  return NULL;
217 }
#define Print
Definition: emacs.cc:83
#define NULL
Definition: omList.c:10
static int EltSize ( number  n,
const coeffs  r 
)
static

how complicated, (0) => 0, or positive

Definition at line 138 of file nforder_elt.cc.

140 {
141  Werror("%s called\n", __func__);
142  return NULL;
143 }
#define NULL
Definition: omList.c:10
void Werror(const char *fmt,...)
Definition: reporter.cc:199
static number EltSub ( number  a,
number  b,
const coeffs  r 
)
static

Definition at line 78 of file nforder_elt.cc.

79 {
80  nforder *O = (nforder*) (r->data);
81  bigintmat *c = new bigintmat((bigintmat*)a);
82  O->elSub(c, (bigintmat*) b);
83  return (number) c;
84 }
const poly a
Definition: syzextra.cc:212
Matrices of numbers.
Definition: bigintmat.h:32
void elSub(bigintmat *a, bigintmat *b)
Definition: nforder.cpp:311
const poly b
Definition: syzextra.cc:213
static void EltWrite ( number  a,
const coeffs  r 
)
static

Definition at line 22 of file nforder_elt.cc.

23 {
24  bigintmat * b = (bigintmat*)a;
25  if (a) {
26  bigintmat * c = b->transpose();
27  c->Write();
28  StringAppendS("^t ");
29  } else {
30  StringAppendS("(Null)\n");
31  }
32 }
bigintmat * transpose()
Definition: bigintmat.cc:38
const poly a
Definition: syzextra.cc:212
Matrices of numbers.
Definition: bigintmat.h:32
void Write()
IO: writes the matrix into the current internal string buffer which must be started/ allocated before...
Definition: bigintmat.cc:413
void StringAppendS(const char *st)
Definition: reporter.cc:107
const poly b
Definition: syzextra.cc:213
static void KillChar ( coeffs  r)
static

Definition at line 55 of file nforder_elt.cc.

55  {
56  Print("KillChar %lx\n", r);
57 }
#define Print
Definition: emacs.cc:83
BOOLEAN n_nfOrderInit ( coeffs  r,
void *  parameter 
)

Definition at line 227 of file nforder_elt.cc.

228 {
230  r->nCoeffIsEqual=order_cmp;
231  r->cfKillChar = KillChar;
232  r->cfSetChar = SetChar;
233  r->cfCoeffString=CoeffString;
234  r->cfCoeffWrite=WriteRing;
235  r->cfWriteShort=EltWrite;
236  r->cfInit = EltInit;
237  r->cfMult = EltMult;
238  r->cfSub = EltSub;
239  r->cfAdd = EltAdd;
240  r->cfDiv = EltDiv;
241  r->cfExactDiv = EltExactDiv;
242  r->cfInitMPZ = EltInitMPZ;
243  r->cfSize = EltSize;
244  r->cfInt = EltInt;
245  r->cfMPZ = EltMPZ;
246  r->cfInpNeg = EltNeg;
247  r->cfInvers = EltInvers;
248  r->cfCopy = EltCopy;
249  r->data = parameter;
250 
251  r->cfWriteLong = EltWrite;
252  r->cfRead =EltRead;
253  r->cfGreater = EltGreater;
254  r->cfEqual = EltEqual;
255  r->cfIsZero = EltIsZero;
256  r->cfIsOne = EltIsOne;
257  r->cfIsMOne = EltIsMOne;
258  r->cfGreaterZero = EltGreaterZero;
259  r->cfDelete = EltDelete;
260  r->cfSetMap = EltSetMap;
261  if (parameter)
262  r->nNULL = EltInit(0, r);
263 #ifdef LDEBUG
264  r->cfDBTest = EltDBTest;
265 #endif
266  return FALSE;
267 }
static BOOLEAN EltGreater(number a, number b, const coeffs r)
Definition: nforder_elt.cc:188
static number EltInitMPZ(mpz_t i, const coeffs r)
init with a GMP integer
Definition: nforder_elt.cc:131
#define FALSE
Definition: auxiliary.h:140
static void KillChar(coeffs r)
Definition: nforder_elt.cc:55
static number EltCopy(number a, const coeffs r)
Definition: nforder_elt.cc:172
static void EltDelete(number *a, const coeffs r)
Definition: nforder_elt.cc:219
static char * CoeffString(const coeffs r)
Definition: nforder_elt.cc:18
static BOOLEAN EltEqual(number a, number b, const coeffs r)
Definition: nforder_elt.cc:183
n_coeffType nforder_type
Definition: singular.cc:16
static BOOLEAN EltIsZero(number a, const coeffs r)
Definition: nforder_elt.cc:208
static long EltInt(number &n, const coeffs r)
convertion to int, 0 if impossible
Definition: nforder_elt.cc:145
static BOOLEAN EltGreaterZero(number a, const coeffs r)
Definition: nforder_elt.cc:203
#define assume(x)
Definition: mod2.h:405
static number EltDiv(number a, number b, const coeffs r)
Definition: nforder_elt.cc:92
static number EltSub(number a, number b, const coeffs r)
Definition: nforder_elt.cc:78
static void EltWrite(number a, const coeffs r)
Definition: nforder_elt.cc:22
static BOOLEAN order_cmp(coeffs n, n_coeffType t, void *parameter)
Definition: nforder_elt.cc:50
static number EltAdd(number a, number b, const coeffs r)
Definition: nforder_elt.cc:85
static nMapFunc EltSetMap(const coeffs src, const coeffs dst)
Definition: nforder_elt.cc:213
static void SetChar(const coeffs r)
Definition: nforder_elt.cc:65
static BOOLEAN EltIsOne(number a, const coeffs r)
Definition: nforder_elt.cc:193
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
static number EltMult(number a, number b, const coeffs r)
Definition: nforder_elt.cc:71
static number EltInit(long i, const coeffs r)
init with an integer
Definition: nforder_elt.cc:113
static int EltSize(number n, const coeffs r)
how complicated, (0) => 0, or positive
Definition: nforder_elt.cc:138
static void EltMPZ(mpz_t result, number &n, const coeffs r)
Converts a non-negative number n into a GMP number, 0 if impossible.
Definition: nforder_elt.cc:152
static BOOLEAN EltIsMOne(number a, const coeffs r)
Definition: nforder_elt.cc:198
static number EltNeg(number a, const coeffs r)
changes argument inline: a:= -a return -a! (no copy is returned) the result should be assigned to the...
Definition: nforder_elt.cc:160
BOOLEAN EltDBTest(number, const char *, const int, const coeffs)
Definition: nforder_elt.cc:59
static number EltInvers(number a, const coeffs r)
return 1/a
Definition: nforder_elt.cc:166
static number EltExactDiv(number a, number b, const coeffs r)
Definition: nforder_elt.cc:107
static void WriteRing(const coeffs r, BOOLEAN details)
Definition: nforder_elt.cc:13
static const char * EltRead(const char *s, number *a, const coeffs r)
Definition: nforder_elt.cc:177
static BOOLEAN order_cmp ( coeffs  n,
n_coeffType  t,
void *  parameter 
)
static

Definition at line 50 of file nforder_elt.cc.

51 {
52  return (t==nforder_type) && (n->data == parameter);
53 }
n_coeffType nforder_type
Definition: singular.cc:16
static void SetChar ( const coeffs  r)
static

Definition at line 65 of file nforder_elt.cc.

66 {
67  Print("%s called\n", __func__);
68 }
#define Print
Definition: emacs.cc:83
static void WriteRing ( const coeffs  r,
BOOLEAN  details 
)
static

Definition at line 13 of file nforder_elt.cc.

14 {
15  ((nforder *)r->data)->Print();
16 }

Variable Documentation

n_coeffType nforder_type

Definition at line 16 of file singular.cc.