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

nforder_ideal* nf_idAdd ( nforder_ideal A,
nforder_ideal B 
)

Definition at line 100 of file nforder_ideal.cc.

101 {
102  assume(A->order() == B->order());
103  nforder * O = (nforder*) A->order()->data;
104  coeffs C = O->basecoeffs();
105  bigintmat * r = new bigintmat(O->getDim(), 2*O->getDim(), C),
106  *s1, *s2;
107  number den = NULL;
108  if (B->isFractional()) {
109  s1 = A->getBasis();
110  s1->skalmult(B->viewBasisDen(), C);
111  den = n_Copy(B->viewBasisDen(), C);
112  } else {
113  s1 = A->viewBasis();
114  }
115  if (A->isFractional()) {
116  s2 = B->getBasis();
117  s2->skalmult(A->viewBasisDen(), C);
118  if (den) {
119  number d = n_Mult(den, A->viewBasisDen(), C);
120  n_Delete(&den, C);
121  den = d;
122  } else {
123  den = n_Copy(A->viewBasisDen(), C);
124  }
125  } else {
126  s2 = B->viewBasis();
127  }
128  r->concatcol(s1, s2);
129 
130  if (A->isFractional())
131  delete s2;
132  if (B->isFractional())
133  delete s1;
134 
135  number modA = NULL, modB = NULL;
136  if (!(modA = A->viewMin())) {
137  modA = A->viewNorm();
138  }
139  if (!(modB = B->viewMin())) {
140  modB = B->viewNorm();
141  }
142  bigintmat *t2;
143  if (modA && modB) {
144  number mod = n_Gcd(modA, modB, C);
145  t2 = r->modhnf(mod, C);
146  n_Delete(&mod, C);
147  } else {
148  r->hnf();
149  t2 = new bigintmat(O->getDim(), O->getDim(), C);
150  t2->copySubmatInto(r, 1, O->getDim()+1, O->getDim(), O->getDim(), 1,1);
151  }
152  delete r;
153  if (den) {
154  t2->simplifyContentDen(&den);
155  }
156  nforder_ideal *D = new nforder_ideal(t2, A->order());
157  if (den)
158  D->setBasisDenTransfer(den);
159 
160  if (O->oneIsOne())
161  D->setMinTransfer(t2->get(1,1), den ? n_Copy(den, C) : n_Init(1, C));
162  D->setNormTransfer(t2->det(), den ? n_Copy(den, C) : n_Init(1, C));
163  delete t2;
164  return D;
165 }
void concatcol(bigintmat *a, bigintmat *b)
Definition: bigintmat.cc:1047
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 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ...
Definition: coeffs.h:683
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:1412
bigintmat * viewBasis()
Definition: nforder_ideal.h:46
void simplifyContentDen(number *den)
ensures that Gcd(den, content)=1 < enden hier wieder
Definition: bigintmat.cc:2486
void setMinTransfer(number a, number b)
Definition: nforder_ideal.h:50
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:537
coeffs order() const
Definition: nforder_ideal.h:45
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 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
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:1202
#define assume(x)
Definition: mod2.h:405
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:904
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
void setBasisDenTransfer(number a)
Definition: nforder_ideal.h:54
void hnf()
transforms INPLACE to HNF
Definition: bigintmat.cc:1560
bigintmat * modhnf(number p, coeffs c)
computes HNF(this | p*I)
Definition: bigintmat.cc:1715
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
CanonicalForm den(const CanonicalForm &f)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
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:115
nforder_ideal* nf_idInit ( int  i,
coeffs  O 
)

Definition at line 256 of file nforder_ideal.cc.

257 {
258  nforder *ord = (nforder*) O->data;
259  coeffs C = ord->basecoeffs();
260  bigintmat * r = new bigintmat(ord->getDim(), ord->getDim(), C);
261  r->one();
262  number I = n_Init(i, C);
263  r->skalmult(I, C);
264  nforder_ideal * A = new nforder_ideal(r, O);
265  delete r;
266  number n;
267  n_Power(I, ord->getDim(), &n, C);
268  A->setNormTransfer(n, n_Init(1, C));
269  A->setMinTransfer(I, n_Init(1, C));
270  return A;
271 }
void setMinTransfer(number a, number b)
Definition: nforder_ideal.h:50
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:537
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
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:904
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:629
coeffs basecoeffs() const
Definition: nforder.h:76
int getDim()
Definition: nforder.cpp:235
void one()
Macht Matrix (Falls quadratisch) zu Einheitsmatrix.
Definition: bigintmat.cc:1236
nforder_ideal* nf_idInit ( number  I,
coeffs  O 
)

Definition at line 273 of file nforder_ideal.cc.

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

Definition at line 168 of file nforder_ideal.cc.

169 {
170  assume(A->order() == B->order());
171  nforder * O = (nforder*) A->order()->data;
172  coeffs C = O->basecoeffs();
173  number den = NULL;
174 
175  bigintmat * r= NULL;
176  bigintmat * c = new bigintmat(O->getDim(), 1, C),
177  *rep = new bigintmat(O->getDim(), O->getDim(), C);
178  for(int i=0; i<O->getDim(); i++) {
179  A->viewBasis()->getcol(i+1, c);
180  O->multmap(c, rep);
181  bigintmat * cc = bimMult(rep, B->viewBasis());
182  if (r) {
183  bigintmat * s = new bigintmat(O->getDim(), r->cols()+O->getDim(), C);
184  s->concatcol(r, cc);
185  delete r;
186  delete cc;
187  r = s;
188  } else {
189  r = cc;
190  }
191  }
192  delete c;
193 
194  number modA = NULL, modB = NULL;
195  if (!(modA = A->viewMin())) {
196  modA = A->viewNorm();
197  }
198  if (!(modB = B->viewMin())) {
199  modB = B->viewNorm();
200  }
201 
202 
203  bigintmat * t1;
204  if (modA && modB) {
205  number mod = n_Mult(modA, modB, C);
206  t1 = r->modhnf(mod, C);
207  n_Delete(&mod, C);
208  } else {
209  r->hnf();
210  t1 = new bigintmat(O->getDim(), O->getDim(), C);
211  r->getColRange(r->cols()-O->getDim()+1, O->getDim(), t1);
212  }
213  delete r;
214 
215  if (A->isFractional()) {
216  den = A->viewBasisDen();
217  }
218  if (B->isFractional()) {
219  if (den)
220  den = n_Mult(den, B->viewBasisDen(), C);
221  else
222  den = n_Copy(B->viewBasisDen(), C);
223  }
224  if (den) {
225  t1->simplifyContentDen(&den);
226  }
227  nforder_ideal *D = new nforder_ideal(t1, A->order());
228  if (den)
229  D->setBasisDenTransfer(den);
230 
231  if (O->oneIsOne())
232  D->setMinTransfer(t1->get(1,1), den ? n_Copy(den, C) : n_Init(1, C));
233  D->setNormTransfer(t1->det(), den ? n_Copy(den, C) : n_Init(1, C));
234  delete t1;
235  return D;
236 }
void concatcol(bigintmat *a, bigintmat *b)
Definition: bigintmat.cc:1047
number viewMin()
Definition: nforder_ideal.h:53
const CanonicalForm int s
Definition: facAbsFact.cc:55
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:1412
bigintmat * viewBasis()
Definition: nforder_ideal.h:46
void simplifyContentDen(number *den)
ensures that Gcd(den, content)=1 < enden hier wieder
Definition: bigintmat.cc:2486
void setMinTransfer(number a, number b)
Definition: nforder_ideal.h:50
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:537
coeffs order() const
Definition: nforder_ideal.h:45
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:768
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 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
const ring r
Definition: syzextra.cc:208
bigintmat * bimMult(bigintmat *a, bigintmat *b)
Definition: bigintmat.cc:251
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
int isFractional()
Definition: nforder_ideal.h:49
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
void setBasisDenTransfer(number a)
Definition: nforder_ideal.h:54
void hnf()
transforms INPLACE to HNF
Definition: bigintmat.cc:1560
int i
Definition: cfEzgcd.cc:123
int cols() const
Definition: bigintmat.h:128
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:741
bigintmat * modhnf(number p, coeffs c)
computes HNF(this | p*I)
Definition: bigintmat.cc:1715
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
CanonicalForm den(const CanonicalForm &f)
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
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:115
nforder_ideal* nf_idMult ( nforder_ideal A,
number  b 
)

Definition at line 238 of file nforder_ideal.cc.

239 {
240  nforder * O = (nforder*) A->order()->data;
241  coeffs C = O->basecoeffs();
242  bigintmat * r = O->elRepMat((bigintmat*) b);
243  bigintmat * s = bimMult(r, A->viewBasis());
244  delete r;
245  if (A->isFractional()) {
246  number d = n_Copy(A->viewBasisDen(), C);
247  s->simplifyContentDen(&d);
248  nforder_ideal * res = new nforder_ideal(s, A->order());
249  res->setBasisDenTransfer(d);
250  return res;
251  } else {
252  return new nforder_ideal(s, A->order());
253  }
254 }
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:2486
Matrices of numbers.
Definition: bigintmat.h:32
coeffs order() const
Definition: nforder_ideal.h:45
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:251
The main handler for Singular numbers which are suitable for Singular polynomials.
int isFractional()
Definition: nforder_ideal.h:49
void setBasisDenTransfer(number a)
Definition: nforder_ideal.h:54
coeffs basecoeffs() const
Definition: nforder.h:76
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
const poly b
Definition: syzextra.cc:213
nforder_ideal* nf_idMult ( nforder_ideal A,
int  b 
)

Definition at line 282 of file nforder_ideal.cc.

283 {
284  nforder * O = (nforder*) A->order()->data;
285  coeffs C = O->basecoeffs();
286  bigintmat * s = new bigintmat(A->viewBasis());
287  number bb = n_Init(b, C);
288  s->skalmult(bb, C);
289  n_Delete(&bb, C);
290 
291  if (A->isFractional()) {
292  number d = n_Copy(A->viewBasisDen(), C);
293  s->simplifyContentDen(&d);
294  nforder_ideal * res = new nforder_ideal(s, A->order());
295  res->setBasisDenTransfer(d);
296  return res;
297  } else {
298  return new nforder_ideal(s, A->order());
299  }
300 }
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:2486
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:537
coeffs order() const
Definition: nforder_ideal.h:45
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:904
void setBasisDenTransfer(number a)
Definition: nforder_ideal.h:54
coeffs basecoeffs() const
Definition: nforder.h:76
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:455
const poly b
Definition: syzextra.cc:213
nforder_ideal* nf_idPower ( nforder_ideal A,
int  i 
)

Definition at line 302 of file nforder_ideal.cc.

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