Macros | Functions
ncSAFormula.cc File Reference
#include <misc/auxiliary.h>
#include <reporter/reporter.h>
#include <coeffs/numbers.h>
#include "coeffrings.h"
#include "nc/ncSAFormula.h"
#include "monomials/ring.h"
#include "monomials/p_polys.h"
#include "nc/sca.h"

Go to the source code of this file.

Macros

#define MYTEST   0
 
#define PLURAL_INTERNAL_DECLARATIONS
 
#define OUTPUT   MYTEST
 

Functions

bool ncInitSpecialPowersMultiplication (ring r)
 
static BOOLEAN AreCommutingVariables (const ring r, int i, int j)
 
static Enum_ncSAType AnalyzePairType (const ring r, int i, int j)
 
static void CorrectPolyWRTOrdering (poly &pResult, const ring r)
 
static poly ncSA_1xy0x0y0 (const int i, const int j, const int n, const int m, const ring r)
 
static poly ncSA_Mxy0x0y0 (const int i, const int j, const int n, const int m, const ring r)
 
static poly ncSA_Qxy0x0y0 (const int i, const int j, const int n, const int m, const number m_q, const ring r)
 
static poly ncSA_1xy0x0yG (const int i, const int j, const int n, const int m, const number m_g, const ring r)
 
static poly ncSA_1xy0x0yT2 (const int i, const int j, const int n, const int m, const int m_k, const ring r)
 
static poly ncSA_ShiftAx (int i, int j, int n, int m, const number m_shiftCoef, const ring r)
 
static poly ncSA_1xyAx0y0 (const int i, const int j, const int n, const int m, const number m_shiftCoef, const ring r)
 
static poly ncSA_1xy0xBy0 (const int i, const int j, const int n, const int m, const number m_shiftCoef, const ring r)
 
static poly ncSA_Multiply (Enum_ncSAType type, const int i, const int j, const int n, const int m, const ring r)
 

Macro Definition Documentation

#define MYTEST   0

Definition at line 11 of file ncSAFormula.cc.

#define OUTPUT   MYTEST

Definition at line 30 of file ncSAFormula.cc.

#define PLURAL_INTERNAL_DECLARATIONS

Definition at line 27 of file ncSAFormula.cc.

Function Documentation

static Enum_ncSAType AnalyzePairType ( const ring  r,
int  i,
int  j 
)
inlinestatic

Definition at line 135 of file ncSAFormula.cc.

136 {
137 #if OUTPUT
138  Print("AnalyzePair(ring, i: %d, j: %d):", i, j);
139  PrintLn();
140 #endif
141 
142  const int N = r->N;
143 
144  assume(i < j);
145  assume(i > 0);
146  assume(j <= N);
147 
148 
149  const poly c = GetC(r, i, j);
150  const number q = p_GetCoeff(c, r);
151  const poly d = GetD(r, i, j);
152 
153 #if 0 && OUTPUT
154  Print("C_{%d, %d} = ", i, j); p_Write(c, r); PrintLn();
155  Print("D_{%d, %d} = ", i, j); p_Write(d, r);
156 #endif
157 
158 // const number q = p_GetCoeff(c, r);
159 
160  if( d == NULL)
161  {
162 
163  if( n_IsOne(q, r) ) // commutative
164  return _ncSA_1xy0x0y0;
165 
166  if( n_IsMOne(q, r) ) // anti-commutative
167  return _ncSA_Mxy0x0y0;
168 
169  return _ncSA_Qxy0x0y0; // quasi-commutative
170  } else
171  {
172  if( n_IsOne(q, r) ) // "Lie" case
173  {
174  if( pNext(d) == NULL ) // Our Main Special Case: d is only a term!
175  {
176 // const number g = p_GetCoeff(d, r); // not used for now
177  if( p_LmIsConstantComp(d, r) ) // Weyl
178  return _ncSA_1xy0x0yG;
179 
180  const int k = p_IsPurePower(d, r); // k if not pure power
181 
182  if( k > 0 ) // d = var(k)^??
183  {
184  const int exp = p_GetExp(d, k, r);
185 
186  if (exp == 1)
187  {
188  if(k == i) // 2 -ubalgebra in var(i) & var(j), with linear relation...?
189  return _ncSA_1xyAx0y0;
190 
191  if(k == j)
192  return _ncSA_1xy0xBy0;
193  } else if ( exp == 2 && k!= i && k != j) // Homogenized Weyl algebra [x, Dx] = t^2?
194  {
195 // number qi, qj;
196  if (AreCommutingVariables(r, k, i/*, &qi*/) && AreCommutingVariables(r, k, j/*, &qj*/) ) // [x, t] = [Dx, t] = 0?
197  {
198  const number g = p_GetCoeff(d, r);
199 
200  if (n_IsOne(g, r))
201  return _ncSA_1xy0x0yT2; // save k!?, G = LC(d) == qi == qj == 1!!!
202  }
203  }
204  }
205  }
206  }
207  // Hmm, what about a more general case of q != 1???
208  }
209 #if OUTPUT
210  Print("C_{%d, %d} = ", i, j); p_Write(c, r);
211  Print("D_{%d, %d} = ", i, j); p_Write(d, r);
212  PrintS("====>>>>_ncSA_notImplemented\n");
213 #endif
214 
215  return _ncSA_notImplemented;
216 }
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:937
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:469
static BOOLEAN AreCommutingVariables(const ring r, int i, int j)
Definition: ncSAFormula.cc:83
g
Definition: cfModGcd.cc:4031
int k
Definition: cfEzgcd.cc:93
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
Definition: p_polys.cc:1224
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly GetC(const ring r, int i, int j)
Definition: nc.h:397
p exp[i]
Definition: DebugPrint.cc:39
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:473
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
polyrec * poly
Definition: hilb.h:10
static poly GetD(const ring r, int i, int j)
Definition: nc.h:408
static BOOLEAN AreCommutingVariables ( const ring  r,
int  i,
int  j 
)
inlinestatic

Definition at line 83 of file ncSAFormula.cc.

84 {
85 #if OUTPUT
86  Print("AreCommutingVariables(ring, k: %d, i: %d)!", j, i);
87  PrintLn();
88 #endif
89 
90  assume(i != j);
91 
92  assume(i > 0);
93  assume(i <= r->N);
94 
95 
96  assume(j > 0);
97  assume(j <= r->N);
98 
99  const BOOLEAN reverse = (i > j);
100 
101  if (reverse) { int k = j; j = i; i = k; }
102 
103  assume(i < j);
104 
105  {
106  const poly d = GetD(r, i, j);
107 
108 #if OUTPUT
109  Print("D_{%d, %d} = ", i, j); p_Write(d, r);
110 #endif
111 
112  if( d != NULL)
113  return FALSE;
114  }
115 
116 
117  {
118  const number q = p_GetCoeff(GetC(r, i, j), r);
119 
120  if( !n_IsOne(q, r) )
121  return FALSE;
122  }
123 
124  return TRUE; // [VAR(I), VAR(J)] = 0!!
125 
126 /*
127  if (reverse)
128  *qq = n_Invers(q, r);
129  else
130  *qq = n_Copy(q, r);
131  return TRUE;
132 */
133 }
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:469
#define TRUE
Definition: auxiliary.h:144
int k
Definition: cfEzgcd.cc:93
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly GetC(const ring r, int i, int j)
Definition: nc.h:397
CanonicalForm reverse(const CanonicalForm &F, int d)
Definition: facMul.cc:3101
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
polyrec * poly
Definition: hilb.h:10
int BOOLEAN
Definition: auxiliary.h:131
static poly GetD(const ring r, int i, int j)
Definition: nc.h:408
static void CorrectPolyWRTOrdering ( poly pResult,
const ring  r 
)
inlinestatic

Definition at line 250 of file ncSAFormula.cc.

251 {
252  if( pNext(pResult) != NULL )
253  {
254  const int cmp = p_LmCmp(pResult, pNext(pResult), r);
255  assume( cmp != 0 ); // must not be equal!!!
256  if( cmp != 1 ) // Wrong order!!!
257  pResult = pReverse(pResult); // Reverse!!!
258  }
259  p_Test(pResult, r);
260 }
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1472
static poly pReverse(poly p)
Definition: p_polys.h:324
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
bool ncInitSpecialPowersMultiplication ( ring  r)

Definition at line 51 of file ncSAFormula.cc.

52 {
53 #if OUTPUT
54  Print("ncInitSpecialPowersMultiplication(ring), ring: \n");
55  rWrite(r, TRUE);
56  PrintLn();
57 #endif
58 
60  assume(!rIsSCA(r));
61 
62 
63  if( r->GetNC()->GetFormulaPowerMultiplier() != NULL )
64  {
65  WarnS("Already defined!");
66  return false;
67  }
68 
69 
70  r->GetNC()->GetFormulaPowerMultiplier() = new CFormulaPowerMultiplier(r);
71 
72  return true;
73 
74 }
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
#define NULL
Definition: omList.c:10
static bool rIsSCA(const ring r)
Definition: nc.h:206
static poly ncSA_1xy0x0y0 ( const int  i,
const int  j,
const int  n,
const int  m,
const ring  r 
)
inlinestatic

Definition at line 262 of file ncSAFormula.cc.

263 {
264 #if OUTPUT
265  Print("ncSA_1xy0x0y0(var(%d)^{%d}, var(%d)^{%d}, r)!", j, m, i, n);
266  PrintLn();
267 #endif
268 
269  poly p = p_One( r);
270  p_SetExp(p, j, m, r);
271  p_SetExp(p, i, n, r);
272  p_Setm(p, r);
273 
274  p_Test(p, r);
275 
276  return p;
277 
278 } // return ncSA_1xy0x0y0(GetI(), GetJ(), expRight, expLeft, r);
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define p_Test(p, r)
Definition: p_polys.h:160
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
polyrec * poly
Definition: hilb.h:10
static poly ncSA_1xy0x0yG ( const int  i,
const int  j,
const int  n,
const int  m,
const number  m_g,
const ring  r 
)
inlinestatic

Definition at line 349 of file ncSAFormula.cc.

350 {
351 #if OUTPUT
352  Print("ncSA_1xy0x0yG(var(%d)^{%d}, var(%d)^{%d}, G, r)!", j, m, i, n);
353  PrintLn();
354  number t = n_Copy(m_g, r);
355  PrintS("Parameter G: "); n_Write(t, r);
356  n_Delete(&t, r);
357 #endif
358 
359  int kn = n;
360  int km = m;
361 
362  number c = n_Init(1, r);
363 
364  poly p = p_One( r);
365 
366  p_SetExp(p, j, km--, r); // y ^ (m-k)
367  p_SetExp(p, i, kn--, r); // x ^ (n-k)
368 
369  p_Setm(p, r); // pResult = x^n * y^m
370 
371 
372  poly pResult = p;
373  poly pLast = p;
374 
375  int min = si_min(m, n);
376 
377  int k = 1;
378 
379  for(; k < min; k++ )
380  {
381  number t = n_Init(km + 1, r);
382  n_InpMult(t, m_g, r); // t = ((m - k) + 1) * gamma
383  n_InpMult(c, t, r); // c = c'* ((m - k) + 1) * gamma
384  n_Delete(&t, r);
385 
386  t = n_Init(kn + 1, r);
387  n_InpMult(c, t, r); // c = (c'* ((m - k) + 1) * gamma) * ((n - k) + 1)
388  n_Delete(&t, r);
389 
390  t = n_Init(k, r);
391  c = n_Div(c, t, r);
392  n_Delete(&t, r);
393 
394 // n_Normalize(c, r);
395 
396  t = n_Copy(c, r); // not the last!
397 
398  p = p_NSet(t, r);
399 
400  p_SetExp(p, j, km--, r); // y ^ (m-k)
401  p_SetExp(p, i, kn--, r); // x ^ (n-k)
402 
403  p_Setm(p, r); // pResult = x^n * y^m
404 
405  pNext(pLast) = p;
406  pLast = p;
407  }
408 
409  assume(k == min);
410  assume((km == 0) || (kn == 0) );
411 
412  {
413  n_InpMult(c, m_g, r); // c = c'* gamma
414 
415  if( km > 0 )
416  {
417  number t = n_Init(km + 1, r);
418  n_InpMult(c, t, r); // c = (c'* gamma) * (m - k + 1)
419  n_Delete(&t, r);
420  }
421 
422  if( kn > 0 )
423  {
424  number t = n_Init(kn + 1, r);
425  n_InpMult(c, t, r); // c = (c'* gamma) * (n - k + 1)
426  n_Delete(&t, r);
427  }
428 
429  number t = n_Init(k, r); // c = ((c'* gamma) * ((n - k + 1) * (m - k + 1))) / k;
430  c = n_Div(c, t, r);
431  n_Delete(&t, r);
432  }
433 
434  p = p_NSet(c, r);
435 
436  p_SetExp(p, j, km, r); // y ^ (m-k)
437  p_SetExp(p, i, kn, r); // x ^ (n-k)
438 
439  p_Setm(p, r); //
440 
441  pNext(pLast) = p;
442 
443  CorrectPolyWRTOrdering(pResult, r);
444 
445  return pResult;
446 }
static poly pLast(poly a, int &length)
returns the length of a polynomial (numbers of monomials) respect syzComp
Definition: polys.h:378
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
static int min(int a, int b)
Definition: fast_mult.cc:268
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
multiplication of &#39;a&#39; and &#39;b&#39;; replacement of &#39;a&#39; by the product a*b
Definition: coeffs.h:640
return P p
Definition: myNF.cc:203
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1448
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 k
Definition: cfEzgcd.cc:93
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static FORCE_INLINE void n_Write(number &n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:592
static void CorrectPolyWRTOrdering(poly &pResult, const ring r)
Definition: ncSAFormula.cc:250
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:452
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:456
polyrec * poly
Definition: hilb.h:10
static poly ncSA_1xy0x0yT2 ( const int  i,
const int  j,
const int  n,
const int  m,
const int  m_k,
const ring  r 
)
inlinestatic

Definition at line 449 of file ncSAFormula.cc.

450 {
451 #if OUTPUT
452  Print("ncSA_1xy0x0yT2(var(%d)^{%d}, var(%d)^{%d}, t: var(%d), r)!", j, m, i, n, m_k);
453  PrintLn();
454 #endif
455 
456  int kn = n;
457  int km = m;
458 
459  // k == 0!
460  number c = n_Init(1, r);
461 
462  poly p = p_One( r );
463 
464  p_SetExp(p, j, km--, r); // y ^ (m)
465  p_SetExp(p, i, kn--, r); // x ^ (n)
466 // p_SetExp(p, m_k, k << 1, r); // homogenization with var(m_k) ^ (2*k)
467 
468  p_Setm(p, r); // pResult = x^n * y^m
469 
470 
471  poly pResult = p;
472  poly pLast = p;
473 
474  int min = si_min(m, n);
475 
476  int k = 1;
477 
478  for(; k < min; k++ )
479  {
480  number t = n_Init(km + 1, r);
481 // n_InpMult(t, m_g, r); // t = ((m - k) + 1) * gamma
482  n_InpMult(c, t, r); // c = c'* ((m - k) + 1) * gamma
483  n_Delete(&t, r);
484 
485  t = n_Init(kn + 1, r);
486  n_InpMult(c, t, r); // c = (c'* ((m - k) + 1) * gamma) * ((n - k) + 1)
487  n_Delete(&t, r);
488 
489  t = n_Init(k, r);
490  c = n_Div(c, t, r);
491  n_Delete(&t, r);
492 
493 // // n_Normalize(c, r);
494 
495  t = n_Copy(c, r); // not the last!
496 
497  p = p_NSet(t, r);
498 
499  p_SetExp(p, j, km--, r); // y ^ (m-k)
500  p_SetExp(p, i, kn--, r); // x ^ (n-k)
501 
502  p_SetExp(p, m_k, k << 1, r); // homogenization with var(m_k) ^ (2*k)
503 
504  p_Setm(p, r); // pResult = x^(n-k) * y^(m-k)
505 
506  pNext(pLast) = p;
507  pLast = p;
508  }
509 
510  assume(k == min);
511  assume((km == 0) || (kn == 0) );
512 
513  {
514 // n_InpMult(c, m_g, r); // c = c'* gamma
515 
516  if( km > 0 )
517  {
518  number t = n_Init(km + 1, r);
519  n_InpMult(c, t, r); // c = (c'* gamma) * (m - k + 1)
520  n_Delete(&t, r);
521  }
522 
523  if( kn > 0 )
524  {
525  number t = n_Init(kn + 1, r);
526  n_InpMult(c, t, r); // c = (c'* gamma) * (n - k + 1)
527  n_Delete(&t, r);
528  }
529 
530  number t = n_Init(k, r); // c = ((c'* gamma) * ((n - k + 1) * (m - k + 1))) / k;
531  c = n_Div(c, t, r);
532  n_Delete(&t, r);
533  }
534 
535  p = p_NSet(c, r);
536 
537  p_SetExp(p, j, km, r); // y ^ (m-k)
538  p_SetExp(p, i, kn, r); // x ^ (n-k)
539 
540  p_SetExp(p, m_k, k << 1, r); // homogenization with var(m_k) ^ (2*k)
541 
542  p_Setm(p, r); //
543 
544  pNext(pLast) = p;
545 
546  CorrectPolyWRTOrdering(pResult, r);
547 
548  return pResult;
549 }
static poly pLast(poly a, int &length)
returns the length of a polynomial (numbers of monomials) respect syzComp
Definition: polys.h:378
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
static int min(int a, int b)
Definition: fast_mult.cc:268
static int si_min(const int a, const int b)
Definition: auxiliary.h:167
static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
multiplication of &#39;a&#39; and &#39;b&#39;; replacement of &#39;a&#39; by the product a*b
Definition: coeffs.h:640
return P p
Definition: myNF.cc:203
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1448
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 k
Definition: cfEzgcd.cc:93
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static void CorrectPolyWRTOrdering(poly &pResult, const ring r)
Definition: ncSAFormula.cc:250
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:452
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:456
polyrec * poly
Definition: hilb.h:10
static poly ncSA_1xy0xBy0 ( const int  i,
const int  j,
const int  n,
const int  m,
const number  m_shiftCoef,
const ring  r 
)
inlinestatic

Definition at line 645 of file ncSAFormula.cc.

646 {
647 #if OUTPUT
648  Print("ncSA_1xy0xBy0(var(%d)^{%d}, var(%d)^{%d}, B, r)!", j, m, i, n);
649  PrintLn();
650  number t = n_Copy(m_shiftCoef, r);
651  PrintS("Parameter B: "); n_Write(t, r);
652  n_Delete(&t, r);
653 #endif
654 
655  return ncSA_ShiftAx(j, i, m, n, m_shiftCoef, r);
656 }
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
static poly ncSA_ShiftAx(int i, int j, int n, int m, const number m_shiftCoef, const ring r)
Definition: ncSAFormula.cc:555
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
static FORCE_INLINE void n_Write(number &n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:592
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:452
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:456
static poly ncSA_1xyAx0y0 ( const int  i,
const int  j,
const int  n,
const int  m,
const number  m_shiftCoef,
const ring  r 
)
inlinestatic

Definition at line 632 of file ncSAFormula.cc.

633 {
634 #if OUTPUT
635  Print("ncSA_1xyAx0y0(var(%d)^{%d}, var(%d)^{%d}, A, r)!", j, m, i, n);
636  PrintLn();
637  number t = n_Copy(m_shiftCoef, r);
638  PrintS("Parameter A: "); n_Write(t, r);
639  n_Delete(&t, r);
640 #endif
641 
642  return ncSA_ShiftAx(i, j, n, m, m_shiftCoef, r);
643 }
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
static poly ncSA_ShiftAx(int i, int j, int n, int m, const number m_shiftCoef, const ring r)
Definition: ncSAFormula.cc:555
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
static FORCE_INLINE void n_Write(number &n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:592
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:452
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:456
static poly ncSA_Multiply ( Enum_ncSAType  type,
const int  i,
const int  j,
const int  n,
const int  m,
const ring  r 
)
inlinestatic

Definition at line 663 of file ncSAFormula.cc.

664 {
665 #if OUTPUT
666  Print("ncSA_Multiply(type: %d, ring, (var(%d)^{%d} * var(%d)^{%d}, r)!", (int)type, j, m, i, n);
667  PrintLn();
668 #endif
669 
670  assume( type != _ncSA_notImplemented );
671  assume( (n > 0) && (m > 0) );
672 
673  if( type == _ncSA_1xy0x0y0 )
674  return ::ncSA_1xy0x0y0(i, j, n, m, r);
675 
676  if( type == _ncSA_Mxy0x0y0 )
677  return ::ncSA_Mxy0x0y0(i, j, n, m, r);
678 
679  if( type == _ncSA_Qxy0x0y0 )
680  {
681  const number q = p_GetCoeff(GetC(r, i, j), r);
682  return ::ncSA_Qxy0x0y0(i, j, n, m, q, r);
683  }
684 
685  const poly d = GetD(r, i, j);
686  const number g = p_GetCoeff(d, r);
687 
688  if( type == _ncSA_1xy0x0yG ) // Weyl
689  return ::ncSA_1xy0x0yG(i, j, n, m, g, r);
690 
691  if( type == _ncSA_1xy0x0yT2 ) // Homogenous Weyl...
693 
694  if( type == _ncSA_1xyAx0y0 ) // Shift 1
695  return ::ncSA_1xyAx0y0(i, j, n, m, g, r);
696 
697  if( type == _ncSA_1xy0xBy0 ) // Shift 2
698  return ::ncSA_1xy0xBy0(i, j, n, m, g, r);
699 
700  assume( type == _ncSA_notImplemented );
701 
702  return NULL;
703 }
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
static poly ncSA_1xy0x0yG(const int i, const int j, const int n, const int m, const number m_g, const ring r)
Definition: ncSAFormula.cc:349
g
Definition: cfModGcd.cc:4031
static poly ncSA_Mxy0x0y0(const int i, const int j, const int n, const int m, const ring r)
Definition: ncSAFormula.cc:280
static poly ncSA_1xy0x0yT2(const int i, const int j, const int n, const int m, const int m_k, const ring r)
Definition: ncSAFormula.cc:449
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
static poly ncSA_Qxy0x0y0(const int i, const int j, const int n, const int m, const number m_q, const ring r)
Definition: ncSAFormula.cc:300
static poly ncSA_1xyAx0y0(const int i, const int j, const int n, const int m, const number m_shiftCoef, const ring r)
Definition: ncSAFormula.cc:632
static poly ncSA_1xy0x0y0(const int i, const int j, const int n, const int m, const ring r)
Definition: ncSAFormula.cc:262
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
Definition: p_polys.cc:1224
#define NULL
Definition: omList.c:10
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static poly GetC(const ring r, int i, int j)
Definition: nc.h:397
polyrec * poly
Definition: hilb.h:10
static poly ncSA_1xy0xBy0(const int i, const int j, const int n, const int m, const number m_shiftCoef, const ring r)
Definition: ncSAFormula.cc:645
static poly GetD(const ring r, int i, int j)
Definition: nc.h:408
static poly ncSA_Mxy0x0y0 ( const int  i,
const int  j,
const int  n,
const int  m,
const ring  r 
)
inlinestatic

Definition at line 280 of file ncSAFormula.cc.

281 {
282 #if OUTPUT
283  Print("ncSA_{M = -1}xy0x0y0(var(%d)^{%d}, var(%d)^{%d}, r)!", j, m, i, n);
284  PrintLn();
285 #endif
286 
287  const int sign = 1 - ((n & (m & 1)) << 1);
288  poly p = p_ISet(sign, r);
289  p_SetExp(p, j, m, r);
290  p_SetExp(p, i, n, r);
291  p_Setm(p, r);
292 
293 
294  p_Test(p, r);
295 
296  return p;
297 
298 } // return ncSA_Mxy0x0y0(GetI(), GetJ(), expRight, expLeft, r);
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define p_Test(p, r)
Definition: p_polys.h:160
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
polyrec * poly
Definition: hilb.h:10
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1302
int sign(const CanonicalForm &a)
static poly ncSA_Qxy0x0y0 ( const int  i,
const int  j,
const int  n,
const int  m,
const number  m_q,
const ring  r 
)
inlinestatic

Definition at line 300 of file ncSAFormula.cc.

301 {
302 #if OUTPUT
303  Print("ncSA_Qxy0x0y0(var(%d)^{%d}, var(%d)^{%d}, Q, r)!", j, m, i, n);
304  PrintLn();
305 #endif
306 
307  int min, max;
308 
309  if( n < m )
310  {
311  min = n;
312  max = m;
313  } else
314  {
315  min = m;
316  max = n;
317  }
318 
319  number qN;
320 
321  if( max == 1 )
322  qN = n_Copy(m_q, r);
323  else
324  {
325  number t;
326  n_Power(m_q, max, &t, r);
327 
328  if( min > 1 )
329  {
330  n_Power(t, min, &qN, r);
331  n_Delete(&t, r);
332  }
333  else
334  qN = t;
335  }
336 
337  poly p = p_NSet(qN, r);
338  p_SetExp(p, j, m, r);
339  p_SetExp(p, i, n, r);
340  p_Setm(p, r);
341 
342 
343  p_Test(p, r);
344 
345  return p;
346 
347 } // return ncSA_Qxy0x0y0(GetI(), GetJ(), expRight, expLeft, m_q, r);
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
static int min(int a, int b)
Definition: fast_mult.cc:268
return P p
Definition: myNF.cc:203
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1448
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
static int max(int a, int b)
Definition: fast_mult.cc:264
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define p_Test(p, r)
Definition: p_polys.h:160
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
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:631
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:452
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:456
polyrec * poly
Definition: hilb.h:10
static poly ncSA_ShiftAx ( int  i,
int  j,
int  n,
int  m,
const number  m_shiftCoef,
const ring  r 
)
inlinestatic

Definition at line 555 of file ncSAFormula.cc.

556 {
557  // Char == 0, otherwise - problem!
558 
559  int k = m; // to 0
560 
561  number c = n_Init(1, r); // k = m, C_k = 1
562  poly p = p_One( r);
563 
564  p_SetExp(p, j, k, r); // Y^{k}
565  p_SetExp(p, i, n, r);
566 
567  p_Setm(p, r); // pResult = C_k * x^n * y^k, k == m
568 
569 
570  poly pResult = p;
571  poly pLast = p;
572 
573  number nn = n_Init(n, r); // number(n)!
574  n_InpMult(nn, m_shiftCoef, r); // nn = (alpha*n)
575 
576  --k;
577 
578  int mk = 1; // mk = (m - k)
579 
580  for(; k > 0; k-- )
581  {
582  number t = n_Init(k + 1, r); // t = k+1
583  n_InpMult(c, t, r); // c = c' * (k+1)
584  n_InpMult(c, nn, r); // c = (c' * (k+1)) * (alpha * n)
585 
586  n_Delete(&t, r);
587  t = n_Init(mk++, r);
588  c = n_Div(c, t, r); // c = ((c' * (k+1)) * (alpha * n)) / (m-k);
589  n_Delete(&t, r);
590 
591 // n_Normalize(c, r);
592 
593  t = n_Copy(c, r); // not the last!
594 
595  p = p_NSet(t, r);
596 
597  p_SetExp(p, j, k, r); // y^k
598  p_SetExp(p, i, n, r); // x^n
599 
600  p_Setm(p, r); // pResult = x^n * y^m
601 
602  pNext(pLast) = p;
603  pLast = p;
604  }
605 
606  assume(k == 0);
607 
608  {
609  n_InpMult(c, nn, r); // c = (c' * (0+1)) * (alpha * n)
610 
611  number t = n_Init(m, r);
612  c = n_Div(c, t, r); // c = ((c' * (0+1)) * (alpha * n)) / (m-0);
613  n_Delete(&t, r);
614  }
615 
616  n_Delete(&nn, r);
617 
618  p = p_NSet(c, r);
619 
620  p_SetExp(p, j, k, r); // y^k
621  p_SetExp(p, i, n, r); // x^n
622 
623  p_Setm(p, r); //
624 
625  pNext(pLast) = p;
626 
627  CorrectPolyWRTOrdering(pResult, r);
628 
629  return pResult;
630 }
static poly pLast(poly a, int &length)
returns the length of a polynomial (numbers of monomials) respect syzComp
Definition: polys.h:378
static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
multiplication of &#39;a&#39; and &#39;b&#39;; replacement of &#39;a&#39; by the product a*b
Definition: coeffs.h:640
return P p
Definition: myNF.cc:203
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1448
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 k
Definition: cfEzgcd.cc:93
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static void CorrectPolyWRTOrdering(poly &pResult, const ring r)
Definition: ncSAFormula.cc:250
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:452
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of &#39;a&#39; and &#39;b&#39;, i.e., a/b; raises an error if &#39;b&#39; is not invertible in r exceptio...
Definition: coeffs.h:615
#define pNext(p)
Definition: monomials.h:43
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:456
polyrec * poly
Definition: hilb.h:10