Functions
nforder_ideal.cc File Reference
#include <coeffs/bigintmat.h>
#include "nforder.h"
#include <reporter/reporter.h>
#include <coeffs/numbers.h>
#include <coeffs/coeffs.h>
#include "Singular/ipid.h"
#include "nforder_ideal.h"

Go to the source code of this file.

Functions

nforder_idealnf_idAdd (nforder_ideal *A, nforder_ideal *B)
 
nforder_idealnf_idMult (nforder_ideal *A, nforder_ideal *B)
 
nforder_idealnf_idMult (nforder_ideal *A, number b)
 
nforder_idealnf_idInit (int i, coeffs O)
 
nforder_idealnf_idInit (number I, coeffs O)
 
nforder_idealnf_idMult (nforder_ideal *A, int b)
 
nforder_idealnf_idPower (nforder_ideal *A, int i)
 

Function Documentation

§ nf_idAdd()

nforder_ideal* nf_idAdd ( nforder_ideal A,
nforder_ideal B 
)

Definition at line 101 of file nforder_ideal.cc.

102 {
103  assume(A->order() == B->order());
104  nforder * O = (nforder*) A->order()->data;
105  coeffs C = O->basecoeffs();
106  bigintmat * r = new bigintmat(O->getDim(), 2*O->getDim(), C),
107  *s1, *s2;
108  number den = NULL;
109  if (B->isFractional()) {
110  s1 = A->getBasis();
111  s1->skalmult(B->viewBasisDen(), C);
112  den = n_Copy(B->viewBasisDen(), C);
113  } else {
114  s1 = A->viewBasis();
115  }
116  if (A->isFractional()) {
117  s2 = B->getBasis();
118  s2->skalmult(A->viewBasisDen(), C);
119  if (den) {
120  number d = n_Mult(den, A->viewBasisDen(), C);
121  n_Delete(&den, C);
122  den = d;
123  } else {
124  den = n_Copy(A->viewBasisDen(), C);
125  }
126  } else {
127  s2 = B->viewBasis();
128  }
129  r->concatcol(s1, s2);
130 
131  if (A->isFractional())
132  delete s2;
133  if (B->isFractional())
134  delete s1;
135 
136  number modA = NULL, modB = NULL;
137  if (!(modA = A->viewMin())) {
138  modA = A->viewNorm();
139  }
140  if (!(modB = B->viewMin())) {
141  modB = B->viewNorm();
142  }
143  bigintmat *t2;
144  if (modA && modB) {
145  number mod = n_Gcd(modA, modB, C);
146  t2 = r->modhnf(mod, C);
147  n_Delete(&mod, C);
148  } else {
149  r->hnf();
150  t2 = new bigintmat(O->getDim(), O->getDim(), C);
151  t2->copySubmatInto(r, 1, O->getDim()+1, O->getDim(), O->getDim(), 1,1);
152  }
153  delete r;
154  if (den) {
155  t2->simplifyContentDen(&den);
156  }
157  nforder_ideal *D = new nforder_ideal(t2, A->order());
158  if (den)
159  D->setBasisDenTransfer(den);
160 
161  if (O->oneIsOne())
162  D->setMinTransfer(t2->get(1,1), den ? n_Copy(den, C) : n_Init(1, C));
163  D->setNormTransfer(t2->det(), den ? n_Copy(den, C) : n_Init(1, C));
164  delete t2;
165  return D;
166 }
void concatcol(bigintmat *a, bigintmat *b)
Definition: bigintmat.cc:1108
number viewMin()
Definition: nforder_ideal.h:53
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of &#39;a&#39; and &#39;b&#39; in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:690
#define D(A)
Definition: gentable.cc:121
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
number det()
det (via LaPlace in general, hnf for euc. rings)
Definition: bigintmat.cc:1522
bigintmat * viewBasis()
Definition: nforder_ideal.h:46
void simplifyContentDen(number *den)
ensures that Gcd(den, content)=1 < enden hier wieder
Definition: bigintmat.cc:2698
void setMinTransfer(number a, number b)
Definition: nforder_ideal.h:50
Matrices of numbers.
Definition: bigintmat.h:51
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:542
number viewBasisDen()
Definition: nforder_ideal.h:48
void setNormTransfer(number a, number b)
Definition: nforder_ideal.h:51
bigintmat * getBasis()
Definition: nforder_ideal.h:47
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
const ring r
Definition: syzextra.cc:208
void copySubmatInto(bigintmat *, int sr, int sc, int nr, int nc, int tr, int tc)
copy the submatrix of b, staring at (a,b) having n rows, m cols into the given matrix at pos...
Definition: bigintmat.cc:1297
#define assume(x)
Definition: mod2.h:403
The main handler for Singular numbers which are suitable for Singular polynomials.
int isFractional()
Definition: nforder_ideal.h:49
bool skalmult(number b, coeffs c)
Multipliziert zur Matrix den Skalar b hinzu.
Definition: bigintmat.cc:948
void setBasisDenTransfer(number a)
Definition: nforder_ideal.h:54
void hnf()
transforms INPLACE to HNF
Definition: bigintmat.cc:1670
coeffs order() const
Definition: nforder_ideal.h:45
bigintmat * modhnf(number p, coeffs c)
computes HNF(this | p*I)
Definition: bigintmat.cc:1842
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
CanonicalForm den(const CanonicalForm &f)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
number viewNorm()
Definition: nforder_ideal.h:52
number get(int i, int j) const
get a copy of an entry. NOTE: starts at [1,1]
Definition: bigintmat.cc:120

§ nf_idInit() [1/2]

nforder_ideal* nf_idInit ( int  i,
coeffs  O 
)

Definition at line 259 of file nforder_ideal.cc.

260 {
261  nforder *ord = (nforder*) O->data;
262  coeffs C = ord->basecoeffs();
263  bigintmat * r = new bigintmat(ord->getDim(), ord->getDim(), C);
264  r->one();
265  number I = n_Init(i, C);
266  r->skalmult(I, C);
267  nforder_ideal * A = new nforder_ideal(r, O);
268  delete r;
269  number n;
270  n_Power(I, ord->getDim(), &n, C);
271  A->setNormTransfer(n, n_Init(1, C));
272  A->setMinTransfer(I, n_Init(1, C));
273  return A;
274 }
void setMinTransfer(number a, number b)
Definition: nforder_ideal.h:50
Matrices of numbers.
Definition: bigintmat.h:51
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:542
void setNormTransfer(number a, number b)
Definition: nforder_ideal.h:51
const ring r
Definition: syzextra.cc:208
The main handler for Singular numbers which are suitable for Singular polynomials.
#define A
Definition: sirandom.c:23
bool skalmult(number b, coeffs c)
Multipliziert zur Matrix den Skalar b hinzu.
Definition: bigintmat.cc:948
coeffs basecoeffs() const
Definition: nforder.h:76
int i
Definition: cfEzgcd.cc:123
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition: coeffs.h:636
int getDim()
Definition: nforder.cpp:235
void one()
Macht Matrix (Falls quadratisch) zu Einheitsmatrix.
Definition: bigintmat.cc:1335

§ nf_idInit() [2/2]

nforder_ideal* nf_idInit ( number  I,
coeffs  O 
)

Definition at line 276 of file nforder_ideal.cc.

277 {
278  nforder *ord = (nforder*) O->data;
279  bigintmat * r = ord->elRepMat((bigintmat*)I);
280  nforder_ideal * A = new nforder_ideal(r, O);
281  delete r;
282  return A;
283 }
Matrices of numbers.
Definition: bigintmat.h:51
bigintmat * elRepMat(bigintmat *a)
Definition: nforder.cpp:395
const ring r
Definition: syzextra.cc:208
#define A
Definition: sirandom.c:23

§ nf_idMult() [1/3]

nforder_ideal* nf_idMult ( nforder_ideal A,
nforder_ideal B 
)

Definition at line 170 of file nforder_ideal.cc.

171 {
172  assume(A->order() == B->order());
173  nforder * O = (nforder*) A->order()->data;
174  coeffs C = O->basecoeffs();
175  number den = NULL;
176 
177  bigintmat * r= NULL;
178  bigintmat * c = new bigintmat(O->getDim(), 1, C),
179  *rep = new bigintmat(O->getDim(), O->getDim(), C);
180  for(int i=0; i<O->getDim(); i++) {
181  A->viewBasis()->getcol(i+1, c);
182  O->multmap(c, rep);
183  bigintmat * cc = bimMult(rep, B->viewBasis());
184  if (r) {
185  bigintmat * s = new bigintmat(O->getDim(), r->cols()+O->getDim(), C);
186  s->concatcol(r, cc);
187  delete r;
188  delete cc;
189  r = s;
190  } else {
191  r = cc;
192  }
193  }
194  delete c;
195 
196  number modA = NULL, modB = NULL;
197  if (!(modA = A->viewMin())) {
198  modA = A->viewNorm();
199  }
200  if (!(modB = B->viewMin())) {
201  modB = B->viewNorm();
202  }
203 
204 
205  bigintmat * t1;
206  if (modA && modB) {
207  number mod = n_Mult(modA, modB, C);
208  t1 = r->modhnf(mod, C);
209  n_Delete(&mod, C);
210  } else {
211  r->hnf();
212  t1 = new bigintmat(O->getDim(), O->getDim(), C);
213  r->getColRange(r->cols()-O->getDim()+1, O->getDim(), t1);
214  }
215  delete r;
216 
217  if (A->isFractional()) {
218  den = A->viewBasisDen();
219  }
220  if (B->isFractional()) {
221  if (den)
222  den = n_Mult(den, B->viewBasisDen(), C);
223  else
224  den = n_Copy(B->viewBasisDen(), C);
225  }
226  if (den) {
227  t1->simplifyContentDen(&den);
228  }
229  nforder_ideal *D = new nforder_ideal(t1, A->order());
230  if (den)
231  D->setBasisDenTransfer(den);
232 
233  if (O->oneIsOne())
234  D->setMinTransfer(t1->get(1,1), den ? n_Copy(den, C) : n_Init(1, C));
235  D->setNormTransfer(t1->det(), den ? n_Copy(den, C) : n_Init(1, C));
236  delete t1;
237  return D;
238 }
void concatcol(bigintmat *a, bigintmat *b)
Definition: bigintmat.cc:1108
number viewMin()
Definition: nforder_ideal.h:53
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define D(A)
Definition: gentable.cc:121
CF_NO_INLINE CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
Definition: cf_inline.cc:564
number det()
det (via LaPlace in general, hnf for euc. rings)
Definition: bigintmat.cc:1522
bigintmat * viewBasis()
Definition: nforder_ideal.h:46
void simplifyContentDen(number *den)
ensures that Gcd(den, content)=1 < enden hier wieder
Definition: bigintmat.cc:2698
void setMinTransfer(number a, number b)
Definition: nforder_ideal.h:50
Matrices of numbers.
Definition: bigintmat.h:51
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:542
number viewBasisDen()
Definition: nforder_ideal.h:48
void getColRange(int j, int no, bigintmat *a)
copies the no-columns staring by j (so j...j+no-1) into the pre-allocated a
Definition: bigintmat.cc:788
void setNormTransfer(number a, number b)
Definition: nforder_ideal.h:51
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of &#39;a&#39; and &#39;b&#39;, i.e., a*b
Definition: coeffs.h:640
const ring r
Definition: syzextra.cc:208
bigintmat * bimMult(bigintmat *a, bigintmat *b)
Definition: bigintmat.cc:256
#define assume(x)
Definition: mod2.h:403
The main handler for Singular numbers which are suitable for Singular polynomials.
int isFractional()
Definition: nforder_ideal.h:49
int cols() const
Definition: bigintmat.h:145
void setBasisDenTransfer(number a)
Definition: nforder_ideal.h:54
void hnf()
transforms INPLACE to HNF
Definition: bigintmat.cc:1670
coeffs order() const
Definition: nforder_ideal.h:45
int i
Definition: cfEzgcd.cc:123
void getcol(int j, bigintmat *a)
copies the j-th column into the matrix a - which needs to be pre-allocated with the correct size...
Definition: bigintmat.cc:757
bigintmat * modhnf(number p, coeffs c)
computes HNF(this | p*I)
Definition: bigintmat.cc:1842
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
CanonicalForm den(const CanonicalForm &f)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
number viewNorm()
Definition: nforder_ideal.h:52
number get(int i, int j) const
get a copy of an entry. NOTE: starts at [1,1]
Definition: bigintmat.cc:120

§ nf_idMult() [2/3]

nforder_ideal* nf_idMult ( nforder_ideal A,
number  b 
)

Definition at line 241 of file nforder_ideal.cc.

242 {
243  nforder * O = (nforder*) A->order()->data;
244  coeffs C = O->basecoeffs();
245  bigintmat * r = O->elRepMat((bigintmat*) b);
246  bigintmat * s = bimMult(r, A->viewBasis());
247  delete r;
248  if (A->isFractional()) {
249  number d = n_Copy(A->viewBasisDen(), C);
250  s->simplifyContentDen(&d);
251  nforder_ideal * res = new nforder_ideal(s, A->order());
252  res->setBasisDenTransfer(d);
253  return res;
254  } else {
255  return new nforder_ideal(s, A->order());
256  }
257 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
bigintmat * viewBasis()
Definition: nforder_ideal.h:46
void simplifyContentDen(number *den)
ensures that Gcd(den, content)=1 < enden hier wieder
Definition: bigintmat.cc:2698
Matrices of numbers.
Definition: bigintmat.h:51
number viewBasisDen()
Definition: nforder_ideal.h:48
bigintmat * elRepMat(bigintmat *a)
Definition: nforder.cpp:395
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
bigintmat * bimMult(bigintmat *a, bigintmat *b)
Definition: bigintmat.cc:256
The main handler for Singular numbers which are suitable for Singular polynomials.
int isFractional()
Definition: nforder_ideal.h:49
coeffs basecoeffs() const
Definition: nforder.h:76
void setBasisDenTransfer(number a)
Definition: nforder_ideal.h:54
coeffs order() const
Definition: nforder_ideal.h:45
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
const poly b
Definition: syzextra.cc:213

§ nf_idMult() [3/3]

nforder_ideal* nf_idMult ( nforder_ideal A,
int  b 
)

Definition at line 285 of file nforder_ideal.cc.

286 {
287  nforder * O = (nforder*) A->order()->data;
288  coeffs C = O->basecoeffs();
289  bigintmat * s = new bigintmat(A->viewBasis());
290  number bb = n_Init(b, C);
291  s->skalmult(bb, C);
292  n_Delete(&bb, C);
293 
294  if (A->isFractional()) {
295  number d = n_Copy(A->viewBasisDen(), C);
296  s->simplifyContentDen(&d);
297  nforder_ideal * res = new nforder_ideal(s, A->order());
298  res->setBasisDenTransfer(d);
299  return res;
300  } else {
301  return new nforder_ideal(s, A->order());
302  }
303 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
bigintmat * viewBasis()
Definition: nforder_ideal.h:46
void simplifyContentDen(number *den)
ensures that Gcd(den, content)=1 < enden hier wieder
Definition: bigintmat.cc:2698
Matrices of numbers.
Definition: bigintmat.h:51
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:542
number viewBasisDen()
Definition: nforder_ideal.h:48
poly res
Definition: myNF.cc:322
The main handler for Singular numbers which are suitable for Singular polynomials.
int isFractional()
Definition: nforder_ideal.h:49
bool skalmult(number b, coeffs c)
Multipliziert zur Matrix den Skalar b hinzu.
Definition: bigintmat.cc:948
coeffs basecoeffs() const
Definition: nforder.h:76
void setBasisDenTransfer(number a)
Definition: nforder_ideal.h:54
coeffs order() const
Definition: nforder_ideal.h:45
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:455
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
const poly b
Definition: syzextra.cc:213

§ nf_idPower()

nforder_ideal* nf_idPower ( nforder_ideal A,
int  i 
)

Definition at line 305 of file nforder_ideal.cc.

306 {
307  if (i==0) {
308  return nf_idInit(1, A->order());
309  } else if (i==1) {
310  return new nforder_ideal(A, 1);
311  } else if (i<0) {
312  Werror("not done yet");
313  } else {
314  nforder_ideal *B = nf_idPower(A, i/2);
315  nforder_ideal *res = nf_idMult(B, B);
316  delete B;
317  if (i&1) {
318  nforder_ideal * C = nf_idMult(res, B);
319  delete res;
320  return C;
321  } else {
322  return res;
323  }
324  }
325 }
nforder_ideal * nf_idMult(nforder_ideal *A, nforder_ideal *B)
nforder_ideal * nf_idInit(int i, coeffs O)
poly res
Definition: myNF.cc:322
nforder_ideal * nf_idPower(nforder_ideal *A, int i)
coeffs order() const
Definition: nforder_ideal.h:45
int i
Definition: cfEzgcd.cc:123
b *CanonicalForm B
Definition: facBivar.cc:51
void Werror(const char *fmt,...)
Definition: reporter.cc:189