My Project
Macros | Functions
ncSAFormula.cc File Reference
#include "misc/auxiliary.h"
#include "reporter/reporter.h"
#include "coeffs/numbers.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

◆ MYTEST

#define MYTEST   0

Definition at line 11 of file ncSAFormula.cc.

◆ OUTPUT

#define OUTPUT   MYTEST

Definition at line 30 of file ncSAFormula.cc.

◆ PLURAL_INTERNAL_DECLARATIONS

#define PLURAL_INTERNAL_DECLARATIONS

Definition at line 27 of file ncSAFormula.cc.

Function Documentation

◆ AnalyzePairType()

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

Definition at line 133 of file ncSAFormula.cc.

134 {
135 #if OUTPUT
136  Print("AnalyzePair(ring, i: %d, j: %d):\n", i, j);
137 #endif
138 
139  const int N = r->N;
140 
141  assume(i < j);
142  assume(i > 0);
143  assume(j <= N);
144 
145 
146  const poly c = GetC(r, i, j);
147  const number q = pGetCoeff(c);
148  const poly d = GetD(r, i, j);
149 
150 #if 0 && OUTPUT
151  Print("C_{%d, %d} = ", i, j); p_Write(c, r); PrintLn();
152  Print("D_{%d, %d} = ", i, j); p_Write(d, r);
153 #endif
154 
155 // const number q = p_GetCoeff(c, r);
156 
157  if( d == NULL)
158  {
159 
160  if( n_IsOne(q, r->cf) ) // commutative
161  return _ncSA_1xy0x0y0;
162 
163  if( n_IsMOne(q, r->cf) ) // anti-commutative
164  return _ncSA_Mxy0x0y0;
165 
166  return _ncSA_Qxy0x0y0; // quasi-commutative
167  } else
168  {
169  if( n_IsOne(q, r->cf) ) // "Lie" case
170  {
171  if( pNext(d) == NULL ) // Our Main Special Case: d is only a term!
172  {
173 // const number g = p_GetCoeff(d, r); // not used for now
174  if( p_LmIsConstantComp(d, r) ) // Weyl
175  return _ncSA_1xy0x0yG;
176 
177  const int k = p_IsPurePower(d, r); // k if not pure power
178 
179  if( k > 0 ) // d = var(k)^??
180  {
181  const int exp = p_GetExp(d, k, r);
182 
183  if (exp == 1)
184  {
185  if(k == i) // 2 -ubalgebra in var(i) & var(j), with linear relation...?
186  return _ncSA_1xyAx0y0;
187 
188  if(k == j)
189  return _ncSA_1xy0xBy0;
190  } else if ( exp == 2 && k!= i && k != j) // Homogenized Weyl algebra [x, Dx] = t^2?
191  {
192 // number qi, qj;
193  if (AreCommutingVariables(r, k, i/*, &qi*/) && AreCommutingVariables(r, k, j/*, &qj*/) ) // [x, t] = [Dx, t] = 0?
194  {
195  const number g = pGetCoeff(d);
196 
197  if (n_IsOne(g, r->cf))
198  return _ncSA_1xy0x0yT2; // save k!?, G = LC(d) == qi == qj == 1!!!
199  }
200  }
201  }
202  }
203  }
204  // Hmm, what about a more general case of q != 1???
205  }
206 #if OUTPUT
207  Print("C_{%d, %d} = ", i, j); p_Write(c, r);
208  Print("D_{%d, %d} = ", i, j); p_Write(d, r);
209  PrintS("====>>>>_ncSA_notImplemented\n");
210 #endif
211 
212  return _ncSA_notImplemented;
213 }
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
int i
Definition: cfEzgcd.cc:132
int k
Definition: cfEzgcd.cc:99
g
Definition: cfModGcd.cc:4092
static FORCE_INLINE BOOLEAN n_IsMOne(number n, const coeffs r)
TRUE iff 'n' represents the additive inverse of the one element, i.e. -1.
Definition: coeffs.h:473
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:469
#define Print
Definition: emacs.cc:80
int j
Definition: facHensel.cc:110
static poly GetD(const ring r, int i, int j)
Definition: nc.h:377
static poly GetC(const ring r, int i, int j)
Definition: nc.h:366
#define assume(x)
Definition: mod2.h:387
#define pNext(p)
Definition: monomials.h:36
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
gmp_float exp(const gmp_float &a)
Definition: mpr_complex.cc:357
static BOOLEAN AreCommutingVariables(const ring r, int i, int j)
Definition: ncSAFormula.cc:82
@ _ncSA_1xy0x0yT2
Definition: ncSAFormula.h:24
@ _ncSA_Mxy0x0y0
Definition: ncSAFormula.h:19
@ _ncSA_1xyAx0y0
Definition: ncSAFormula.h:21
@ _ncSA_1xy0x0yG
Definition: ncSAFormula.h:23
@ _ncSA_Qxy0x0y0
Definition: ncSAFormula.h:20
@ _ncSA_notImplemented
Definition: ncSAFormula.h:17
@ _ncSA_1xy0x0y0
Definition: ncSAFormula.h:18
@ _ncSA_1xy0xBy0
Definition: ncSAFormula.h:22
#define NULL
Definition: omList.c:12
int p_IsPurePower(const poly p, const ring r)
return i, if head depends only on var(i)
Definition: p_polys.cc:1221
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:342
static BOOLEAN p_LmIsConstantComp(const poly p, const ring r)
Definition: p_polys.h:966
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:469
void PrintS(const char *s)
Definition: reporter.cc:284
void PrintLn()
Definition: reporter.cc:310

◆ AreCommutingVariables()

static BOOLEAN AreCommutingVariables ( const ring  r,
int  i,
int  j 
)
inlinestatic

Definition at line 82 of file ncSAFormula.cc.

83 {
84 #if OUTPUT
85  Print("AreCommutingVariables(ring, k: %d, i: %d)!\n", j, i);
86 #endif
87 
88  assume(i != j);
89 
90  assume(i > 0);
91  assume(i <= r->N);
92 
93 
94  assume(j > 0);
95  assume(j <= r->N);
96 
97  const BOOLEAN reverse = (i > j);
98 
99  if (reverse) { int k = j; j = i; i = k; }
100 
101  assume(i < j);
102 
103  {
104  const poly d = GetD(r, i, j);
105 
106 #if OUTPUT
107  Print("D_{%d, %d} = ", i, j); p_Write(d, r);
108 #endif
109 
110  if( d != NULL)
111  return FALSE;
112  }
113 
114 
115  {
116  const number q = p_GetCoeff(GetC(r, i, j), r);
117 
118  if( !n_IsOne(q, r->cf) )
119  return FALSE;
120  }
121 
122  return TRUE; // [VAR(I), VAR(J)] = 0!!
123 
124 /*
125  if (reverse)
126  *qq = n_Invers(q, r);
127  else
128  *qq = n_Copy(q, r);
129  return TRUE;
130 */
131 }
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
CanonicalForm reverse(const CanonicalForm &F, int d)
Definition: facMul.cc:3234
#define p_GetCoeff(p, r)
Definition: monomials.h:50

◆ CorrectPolyWRTOrdering()

static void CorrectPolyWRTOrdering ( poly &  pResult,
const ring  r 
)
inlinestatic

Definition at line 247 of file ncSAFormula.cc.

248 {
249  if( pNext(pResult) != NULL )
250  {
251  const int cmp = p_LmCmp(pResult, pNext(pResult), r);
252  assume( cmp != 0 ); // must not be equal!!!
253  if( cmp != 1 ) // Wrong order!!!
254  pResult = pReverse(pResult); // Reverse!!!
255  }
256  p_Test(pResult, r);
257 }
static poly pReverse(poly p)
Definition: p_polys.h:335
static int p_LmCmp(poly p, poly q, const ring r)
Definition: p_polys.h:1540
#define p_Test(p, r)
Definition: p_polys.h:162

◆ ncInitSpecialPowersMultiplication()

bool ncInitSpecialPowersMultiplication ( ring  r)

Definition at line 50 of file ncSAFormula.cc.

51 {
52 #if OUTPUT
53  PrintS("ncInitSpecialPowersMultiplication(ring), ring: \n");
54  rWrite(r, TRUE);
55  PrintLn();
56 #endif
57 
59  assume(!rIsSCA(r));
60 
61 
62  if( r->GetNC()->GetFormulaPowerMultiplier() != NULL )
63  {
64  WarnS("Already defined!");
65  return false;
66  }
67 
68 
69  r->GetNC()->GetFormulaPowerMultiplier() = new CFormulaPowerMultiplier(r);
70 
71  return true;
72 
73 }
#define WarnS
Definition: emacs.cc:78
static bool rIsSCA(const ring r)
Definition: nc.h:190
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:226
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400

◆ ncSA_1xy0x0y0()

static poly ncSA_1xy0x0y0 ( const int  i,
const int  j,
const int  n,
const int  m,
const ring  r 
)
inlinestatic

Definition at line 259 of file ncSAFormula.cc.

260 {
261 #if OUTPUT
262  Print("ncSA_1xy0x0y0(var(%d)^{%d}, var(%d)^{%d}, r)!\n", j, m, i, n);
263 #endif
264 
265  poly p = p_One( r);
266  p_SetExp(p, j, m, r);
267  p_SetExp(p, i, n, r);
268  p_Setm(p, r);
269 
270  p_Test(p, r);
271 
272  return p;
273 
274 } // return ncSA_1xy0x0y0(GetI(), GetJ(), expRight, expLeft, r);
int m
Definition: cfEzgcd.cc:128
int p
Definition: cfModGcd.cc:4080
poly p_One(const ring r)
Definition: p_polys.cc:1308
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:488
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:233

◆ ncSA_1xy0x0yG()

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 344 of file ncSAFormula.cc.

345 {
346 #if OUTPUT
347  Print("ncSA_1xy0x0yG(var(%d)^{%d}, var(%d)^{%d}, G, r)!\n", j, m, i, n);
348  number t = n_Copy(m_g, r->cf);
349  PrintS("Parameter G: "); n_Write(t, r->cf);
350  n_Delete(&t, r->cf);
351 #endif
352 
353  int kn = n;
354  int km = m;
355 
356  number c = n_Init(1, r->cf);
357 
358  poly p = p_One( r);
359 
360  p_SetExp(p, j, km--, r); // y ^ (m-k)
361  p_SetExp(p, i, kn--, r); // x ^ (n-k)
362 
363  p_Setm(p, r); // pResult = x^n * y^m
364 
365 
366  poly pResult = p;
367  poly pLast = p;
368 
369  int min = si_min(m, n);
370 
371  int k = 1;
372 
373  for(; k < min; k++ )
374  {
375  number t = n_Init(km + 1, r->cf);
376  n_InpMult(t, m_g, r->cf); // t = ((m - k) + 1) * gamma
377  n_InpMult(c, t, r->cf); // c = c'* ((m - k) + 1) * gamma
378  n_Delete(&t, r->cf);
379 
380  t = n_Init(kn + 1, r->cf);
381  n_InpMult(c, t, r->cf); // c = (c'* ((m - k) + 1) * gamma) * ((n - k) + 1)
382  n_Delete(&t, r->cf);
383 
384  t = n_Init(k, r->cf);
385  c = n_Div(c, t, r->cf);
386  n_Delete(&t, r->cf);
387 
388 // n_Normalize(c, r->cf);
389 
390  t = n_Copy(c, r->cf); // not the last!
391 
392  p = p_NSet(t, r);
393 
394  p_SetExp(p, j, km--, r); // y ^ (m-k)
395  p_SetExp(p, i, kn--, r); // x ^ (n-k)
396 
397  p_Setm(p, r); // pResult = x^n * y^m
398 
399  pNext(pLast) = p;
400  pLast = p;
401  }
402 
403  assume(k == min);
404  assume((km == 0) || (kn == 0) );
405 
406  {
407  n_InpMult(c, m_g, r->cf); // c = c'* gamma
408 
409  if( km > 0 )
410  {
411  number t = n_Init(km + 1, r->cf);
412  n_InpMult(c, t, r->cf); // c = (c'* gamma) * (m - k + 1)
413  n_Delete(&t, r->cf);
414  }
415 
416  if( kn > 0 )
417  {
418  number t = n_Init(kn + 1, r->cf);
419  n_InpMult(c, t, r->cf); // c = (c'* gamma) * (n - k + 1)
420  n_Delete(&t, r->cf);
421  }
422 
423  number t = n_Init(k, r->cf); // c = ((c'* gamma) * ((n - k + 1) * (m - k + 1))) / k;
424  c = n_Div(c, t, r->cf);
425  n_Delete(&t, r->cf);
426  }
427 
428  p = p_NSet(c, r);
429 
430  p_SetExp(p, j, km, r); // y ^ (m-k)
431  p_SetExp(p, i, kn, r); // x ^ (n-k)
432 
433  p_Setm(p, r); //
434 
435  pNext(pLast) = p;
436 
437  CorrectPolyWRTOrdering(pResult, r);
438 
439  return pResult;
440 }
static int si_min(const int a, const int b)
Definition: auxiliary.h:125
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:452
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:616
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:456
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:592
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
static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
multiplication of 'a' and 'b'; replacement of 'a' by the product a*b
Definition: coeffs.h:642
static int min(int a, int b)
Definition: fast_mult.cc:268
static void CorrectPolyWRTOrdering(poly &pResult, const ring r)
Definition: ncSAFormula.cc:247
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1460
static poly pLast(poly a, int &length)
returns the length of a polynomial (numbers of monomials) respect syzComp
Definition: polys.h:406

◆ ncSA_1xy0x0yT2()

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 443 of file ncSAFormula.cc.

444 {
445 #if OUTPUT
446  Print("ncSA_1xy0x0yT2(var(%d)^{%d}, var(%d)^{%d}, t: var(%d), r)!\n", j, m, i, n, m_k);
447 #endif
448 
449  int kn = n;
450  int km = m;
451 
452  // k == 0!
453  number c = n_Init(1, r->cf);
454 
455  poly p = p_One( r );
456 
457  p_SetExp(p, j, km--, r); // y ^ (m)
458  p_SetExp(p, i, kn--, r); // x ^ (n)
459 // p_SetExp(p, m_k, k << 1, r); // homogenization with var(m_k) ^ (2*k)
460 
461  p_Setm(p, r); // pResult = x^n * y^m
462 
463 
464  poly pResult = p;
465  poly pLast = p;
466 
467  int min = si_min(m, n);
468 
469  int k = 1;
470 
471  for(; k < min; k++ )
472  {
473  number t = n_Init(km + 1, r->cf);
474 // n_InpMult(t, m_g, r->cf); // t = ((m - k) + 1) * gamma
475  n_InpMult(c, t, r->cf); // c = c'* ((m - k) + 1) * gamma
476  n_Delete(&t, r->cf);
477 
478  t = n_Init(kn + 1, r->cf);
479  n_InpMult(c, t, r->cf); // c = (c'* ((m - k) + 1) * gamma) * ((n - k) + 1)
480  n_Delete(&t, r->cf);
481 
482  t = n_Init(k, r->cf);
483  c = n_Div(c, t, r->cf);
484  n_Delete(&t, r->cf);
485 
486 // // n_Normalize(c, r);
487 
488  t = n_Copy(c, r->cf); // not the last!
489 
490  p = p_NSet(t, r);
491 
492  p_SetExp(p, j, km--, r); // y ^ (m-k)
493  p_SetExp(p, i, kn--, r); // x ^ (n-k)
494 
495  p_SetExp(p, m_k, k << 1, r); // homogenization with var(m_k) ^ (2*k)
496 
497  p_Setm(p, r); // pResult = x^(n-k) * y^(m-k)
498 
499  pNext(pLast) = p;
500  pLast = p;
501  }
502 
503  assume(k == min);
504  assume((km == 0) || (kn == 0) );
505 
506  {
507 // n_InpMult(c, m_g, r); // c = c'* gamma
508 
509  if( km > 0 )
510  {
511  number t = n_Init(km + 1, r->cf);
512  n_InpMult(c, t, r->cf); // c = (c'* gamma) * (m - k + 1)
513  n_Delete(&t, r->cf);
514  }
515 
516  if( kn > 0 )
517  {
518  number t = n_Init(kn + 1, r->cf);
519  n_InpMult(c, t, r->cf); // c = (c'* gamma) * (n - k + 1)
520  n_Delete(&t, r->cf);
521  }
522 
523  number t = n_Init(k, r->cf); // c = ((c'* gamma) * ((n - k + 1) * (m - k + 1))) / k;
524  c = n_Div(c, t, r->cf);
525  n_Delete(&t, r->cf);
526  }
527 
528  p = p_NSet(c, r);
529 
530  p_SetExp(p, j, km, r); // y ^ (m-k)
531  p_SetExp(p, i, kn, r); // x ^ (n-k)
532 
533  p_SetExp(p, m_k, k << 1, r); // homogenization with var(m_k) ^ (2*k)
534 
535  p_Setm(p, r); //
536 
537  pNext(pLast) = p;
538 
539  CorrectPolyWRTOrdering(pResult, r);
540 
541  return pResult;
542 }

◆ ncSA_1xy0xBy0()

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 637 of file ncSAFormula.cc.

638 {
639 #if OUTPUT
640  Print("ncSA_1xy0xBy0(var(%d)^{%d}, var(%d)^{%d}, B, r)!\n", j, m, i, n);
641  number t = n_Copy(m_shiftCoef, r);
642  PrintS("Parameter B: "); n_Write(t, r);
643  n_Delete(&t, r);
644 #endif
645 
646  return ncSA_ShiftAx(j, i, m, n, m_shiftCoef, r);
647 }
static poly ncSA_ShiftAx(int i, int j, int n, int m, const number m_shiftCoef, const ring r)
Definition: ncSAFormula.cc:548

◆ ncSA_1xyAx0y0()

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 625 of file ncSAFormula.cc.

626 {
627 #if OUTPUT
628  Print("ncSA_1xyAx0y0(var(%d)^{%d}, var(%d)^{%d}, A, r)!\n", j, m, i, n);
629  number t = n_Copy(m_shiftCoef, r);
630  PrintS("Parameter A: "); n_Write(t, r);
631  n_Delete(&t, r);
632 #endif
633 
634  return ncSA_ShiftAx(i, j, n, m, m_shiftCoef, r);
635 }

◆ ncSA_Multiply()

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 654 of file ncSAFormula.cc.

655 {
656 #if OUTPUT
657  Print("ncSA_Multiply(type: %d, ring, (var(%d)^{%d} * var(%d)^{%d}, r)!\n", (int)type, j, m, i, n);
658 #endif
659 
660  assume( type != _ncSA_notImplemented );
661  assume( (n > 0) && (m > 0) );
662 
663  if( type == _ncSA_1xy0x0y0 )
664  return ::ncSA_1xy0x0y0(i, j, n, m, r);
665 
666  if( type == _ncSA_Mxy0x0y0 )
667  return ::ncSA_Mxy0x0y0(i, j, n, m, r);
668 
669  if( type == _ncSA_Qxy0x0y0 )
670  {
671  const number q = p_GetCoeff(GetC(r, i, j), r);
672  return ::ncSA_Qxy0x0y0(i, j, n, m, q, r);
673  }
674 
675  const poly d = GetD(r, i, j);
676  const number g = p_GetCoeff(d, r);
677 
678  if( type == _ncSA_1xy0x0yG ) // Weyl
679  return ::ncSA_1xy0x0yG(i, j, n, m, g, r);
680 
681  if( type == _ncSA_1xy0x0yT2 ) // Homogenous Weyl...
682  return ::ncSA_1xy0x0yT2(i, j, n, m, p_IsPurePower(d, r), r);
683 
684  if( type == _ncSA_1xyAx0y0 ) // Shift 1
685  return ::ncSA_1xyAx0y0(i, j, n, m, g, r);
686 
687  if( type == _ncSA_1xy0xBy0 ) // Shift 2
688  return ::ncSA_1xy0xBy0(i, j, n, m, g, r);
689 
690  assume( type == _ncSA_notImplemented );
691 
692  return NULL;
693 }
static poly ncSA_Mxy0x0y0(const int i, const int j, const int n, const int m, const ring r)
Definition: ncSAFormula.cc:276
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:637
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:443
static poly ncSA_1xy0x0y0(const int i, const int j, const int n, const int m, const ring r)
Definition: ncSAFormula.cc:259
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:625
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:295
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:344

◆ ncSA_Mxy0x0y0()

static poly ncSA_Mxy0x0y0 ( const int  i,
const int  j,
const int  n,
const int  m,
const ring  r 
)
inlinestatic

Definition at line 276 of file ncSAFormula.cc.

277 {
278 #if OUTPUT
279  Print("ncSA_{M = -1}xy0x0y0(var(%d)^{%d}, var(%d)^{%d}, r)!\n", j, m, i, n);
280 #endif
281 
282  const int sign = 1 - ((n & (m & 1)) << 1);
283  poly p = p_ISet(sign, r);
284  p_SetExp(p, j, m, r);
285  p_SetExp(p, i, n, r);
286  p_Setm(p, r);
287 
288 
289  p_Test(p, r);
290 
291  return p;
292 
293 } // return ncSA_Mxy0x0y0(GetI(), GetJ(), expRight, expLeft, r);
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1292
static int sign(int x)
Definition: ring.cc:3377

◆ ncSA_Qxy0x0y0()

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 295 of file ncSAFormula.cc.

296 {
297 #if OUTPUT
298  Print("ncSA_Qxy0x0y0(var(%d)^{%d}, var(%d)^{%d}, Q, r)!\n", j, m, i, n);
299 #endif
300 
301  int min, max;
302 
303  if( n < m )
304  {
305  min = n;
306  max = m;
307  }
308  else
309  {
310  min = m;
311  max = n;
312  }
313 
314  number qN;
315 
316  if( max == 1 )
317  qN = n_Copy(m_q, r->cf);
318  else
319  {
320  number t;
321  n_Power(m_q, max, &t, r->cf);
322 
323  if( min > 1 )
324  {
325  n_Power(t, min, &qN, r->cf);
326  n_Delete(&t, r->cf);
327  }
328  else
329  qN = t;
330  }
331 
332  poly p = p_NSet(qN, r);
333  p_SetExp(p, j, m, r);
334  p_SetExp(p, i, n, r);
335  p_Setm(p, r);
336 
337 
338  p_Test(p, r);
339 
340  return p;
341 
342 } // return ncSA_Qxy0x0y0(GetI(), GetJ(), expRight, expLeft, m_q, r);
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:633
static int max(int a, int b)
Definition: fast_mult.cc:264

◆ ncSA_ShiftAx()

static poly ncSA_ShiftAx ( int  i,
int  j,
int  n,
int  m,
const number  m_shiftCoef,
const ring  r 
)
inlinestatic

Definition at line 548 of file ncSAFormula.cc.

549 {
550  // Char == 0, otherwise - problem!
551 
552  int k = m; // to 0
553 
554  number c = n_Init(1, r->cf); // k = m, C_k = 1
555  poly p = p_One( r);
556 
557  p_SetExp(p, j, k, r); // Y^{k}
558  p_SetExp(p, i, n, r);
559 
560  p_Setm(p, r); // pResult = C_k * x^n * y^k, k == m
561 
562 
563  poly pResult = p;
564  poly pLast = p;
565 
566  number nn = n_Init(n, r->cf); // number(n)!
567  n_InpMult(nn, m_shiftCoef, r->cf); // nn = (alpha*n)
568 
569  --k;
570 
571  int mk = 1; // mk = (m - k)
572 
573  for(; k > 0; k-- )
574  {
575  number t = n_Init(k + 1, r->cf); // t = k+1
576  n_InpMult(c, t, r->cf); // c = c' * (k+1)
577  n_InpMult(c, nn, r->cf); // c = (c' * (k+1)) * (alpha * n)
578 
579  n_Delete(&t, r->cf);
580  t = n_Init(mk++, r->cf);
581  c = n_Div(c, t, r->cf); // c = ((c' * (k+1)) * (alpha * n)) / (m-k);
582  n_Delete(&t, r->cf);
583 
584 // n_Normalize(c, r->cf);
585 
586  t = n_Copy(c, r->cf); // not the last!
587 
588  p = p_NSet(t, r);
589 
590  p_SetExp(p, j, k, r); // y^k
591  p_SetExp(p, i, n, r); // x^n
592 
593  p_Setm(p, r); // pResult = x^n * y^m
594 
595  pNext(pLast) = p;
596  pLast = p;
597  }
598 
599  assume(k == 0);
600 
601  {
602  n_InpMult(c, nn, r->cf); // c = (c' * (0+1)) * (alpha * n)
603 
604  number t = n_Init(m, r->cf);
605  c = n_Div(c, t, r->cf); // c = ((c' * (0+1)) * (alpha * n)) / (m-0);
606  n_Delete(&t, r->cf);
607  }
608 
609  n_Delete(&nn, r->cf);
610 
611  p = p_NSet(c, r);
612 
613  p_SetExp(p, j, k, r); // y^k
614  p_SetExp(p, i, n, r); // x^n
615 
616  p_Setm(p, r); //
617 
618  pNext(pLast) = p;
619 
620  CorrectPolyWRTOrdering(pResult, r);
621 
622  return pResult;
623 }