Macros | Functions
sca.cc File Reference
#include <misc/auxiliary.h>
#include <polys/nc/sca.h>
#include <polys/nc/nc.h>
#include <polys/nc/gb_hack.h>
#include <coeffs/numbers.h>
#include <misc/options.h>
#include <polys/monomials/p_polys.h>
#include <polys/simpleideals.h>
#include <misc/intvec.h>
#include <polys/monomials/ring.h>
#include <polys/kbuckets.h>
#include <polys/sbuckets.h>
#include <polys/prCopy.h>
#include <polys/operations/p_Mult_q.h>
#include <polys/templates/p_MemAdd.h>
#include <polys/weight.h>

Go to the source code of this file.

Macros

#define OUTPUT   0
 
#define MYTEST   0
 
#define PLURAL_INTERNAL_DECLARATIONS
 

Functions

poly sca_pp_Mult_mm (const poly pPoly, const poly pMonom, const ring rRing, poly &)
 
static poly sca_mm_Mult_pp (const poly pMonom, const poly pPoly, const ring rRing)
 
poly sca_p_Mult_mm (poly pPoly, const poly pMonom, const ring rRing)
 
static poly sca_mm_Mult_p (const poly pMonom, poly pPoly, const ring rRing)
 
poly sca_SPoly (const poly p1, const poly p2, const ring r)
 
poly sca_ReduceSpoly (const poly p1, poly p2, const ring r)
 
static int sca_Sign_mm_Mult_mm (const poly pMonomM, const poly pMonomMM, const ring rRing)
 
static poly sca_m_Mult_mm (poly pMonomM, const poly pMonomMM, const ring rRing)
 
static poly sca_mm_Mult_m (const poly pMonomMM, poly pMonomM, const ring rRing)
 
static poly sca_mm_Mult_mm (poly pMonom1, const poly pMonom2, const ring rRing)
 
static poly sca_xi_Mult_mm (short i, const poly pMonom, const ring rRing)
 
poly sca_pp_Mult_mm (const poly pPoly, const poly pMonom, const ring rRing)
 
static poly sca_xi_Mult_pp (short i, const poly pPoly, const ring rRing)
 
bool sca_SetupQuotient (ring rGR, ring rG, bool bCopy)
 
bool sca_Force (ring rGR, int b, int e)
 
poly sca_pp_Mult_xi_pp (short i, const poly pPoly, const ring rRing)
 
void sca_p_ProcsSet (ring rGR, p_Procs_s *p_Procs)
 
static void m_GetBiDegree (const poly m, const intvec *wx, const intvec *wy, const intvec *wCx, const intvec *wCy, int &dx, int &dy, const ring r)
 
bool p_IsBiHomogeneous (const poly p, const intvec *wx, const intvec *wy, const intvec *wCx, const intvec *wCy, int &dx, int &dy, const ring r)
 
bool id_IsBiHomogeneous (const ideal id, const intvec *wx, const intvec *wy, const intvec *wCx, const intvec *wCy, const ring r)
 
intvecivGetSCAXVarWeights (const ring r)
 
intvecivGetSCAYVarWeights (const ring r)
 
static poly m_KillSquares (const poly m, const short iFirstAltVar, const short iLastAltVar, const ring r)
 
poly p_KillSquares (const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
 
ideal id_KillSquares (const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
 

Macro Definition Documentation

§ MYTEST

#define MYTEST   0

Definition at line 13 of file sca.cc.

§ OUTPUT

#define OUTPUT   0

Definition at line 12 of file sca.cc.

§ PLURAL_INTERNAL_DECLARATIONS

#define PLURAL_INTERNAL_DECLARATIONS

Definition at line 29 of file sca.cc.

Function Documentation

§ id_IsBiHomogeneous()

bool id_IsBiHomogeneous ( const ideal  id,
const intvec wx,
const intvec wy,
const intvec wCx,
const intvec wCy,
const ring  r 
)

Definition at line 1372 of file sca.cc.

1376 {
1377  if (id == NULL) return true; // zero ideal
1378 
1379  const int iSize = IDELEMS(id);
1380 
1381  if (iSize == 0) return true;
1382 
1383  bool b = true;
1384  int x, y;
1385 
1386  for(int i = iSize - 1; (i >= 0 ) && b; i--)
1387  b = p_IsBiHomogeneous(id->m[i], wx, wy, wCx, wCy, x, y, r);
1388 
1389  return b;
1390 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
const ring r
Definition: syzextra.cc:208
bool p_IsBiHomogeneous(const poly p, const intvec *wx, const intvec *wy, const intvec *wCx, const intvec *wCy, int &dx, int &dy, const ring r)
Definition: sca.cc:1333
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:24
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
const poly b
Definition: syzextra.cc:213

§ id_KillSquares()

ideal id_KillSquares ( const ideal  id,
const short  iFirstAltVar,
const short  iLastAltVar,
const ring  r,
const bool  bSkipZeroes 
)

Definition at line 1533 of file sca.cc.

1536 {
1537  if (id == NULL) return id; // zero ideal
1538 
1539  assume( (iFirstAltVar >= 1) && (iLastAltVar <= rVar(r)) && (iFirstAltVar <= iLastAltVar) );
1540 
1541  const int iSize = IDELEMS(id);
1542 
1543  if (iSize == 0) return id;
1544 
1545  ideal temp = idInit(iSize, id->rank);
1546 
1547 #if 0
1548  PrintS("<id_KillSquares>\n");
1549  {
1550  PrintS("ideal id: \n");
1551  for (unsigned int i = 0; i < IDELEMS(id); i++)
1552  {
1553  Print("; id[%d] = ", i+1);
1554  p_Write(id->m[i], r);
1555  }
1556  PrintS(";\n");
1557  PrintLn();
1558  }
1559 #endif
1560 
1561 
1562  for (int j = 0; j < iSize; j++)
1563  temp->m[j] = p_KillSquares(id->m[j], iFirstAltVar, iLastAltVar, r);
1564 
1565  if( bSkipZeroes )
1566  idSkipZeroes(temp);
1567 
1568 #if 0
1569  PrintS("<id_KillSquares>\n");
1570  {
1571  PrintS("ideal temp: \n");
1572  for (int i = 0; i < IDELEMS(temp); i++)
1573  {
1574  Print("; temp[%d] = ", i+1);
1575  p_Write(temp->m[i], r);
1576  }
1577  PrintS(";\n");
1578  PrintLn();
1579  }
1580  PrintS("</id_KillSquares>\n");
1581 #endif
1582 
1583 // temp->rank = idRankFreeModule(temp, r);
1584 
1585  return temp;
1586 }
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition: sca.cc:1478
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
#define IDELEMS(i)
Definition: simpleideals.h:24
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:38
#define NULL
Definition: omList.c:10
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206

§ ivGetSCAXVarWeights()

intvec* ivGetSCAXVarWeights ( const ring  r)

Definition at line 1396 of file sca.cc.

1397 {
1398  const unsigned int N = r->N;
1399 
1400  const int CommutativeVariable = 0; // bug correction!
1401  const int AntiCommutativeVariable = 0;
1402 
1403  intvec* w = new intvec(N, 1, CommutativeVariable);
1404 
1405  if(AntiCommutativeVariable != CommutativeVariable)
1406  if( rIsSCA(r) )
1407  {
1408  const unsigned int m_iFirstAltVar = scaFirstAltVar(r);
1409  const unsigned int m_iLastAltVar = scaLastAltVar(r);
1410 
1411  for (unsigned int i = m_iFirstAltVar; i<= m_iLastAltVar; i++)
1412  {
1413  (*w)[i-1] = AntiCommutativeVariable;
1414  }
1415  }
1416 
1417  return w;
1418 }
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int i
Definition: cfEzgcd.cc:123
static short scaFirstAltVar(ring r)
Definition: sca.h:18
const CanonicalForm & w
Definition: facAbsFact.cc:55
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206

§ ivGetSCAYVarWeights()

intvec* ivGetSCAYVarWeights ( const ring  r)

Definition at line 1424 of file sca.cc.

1425 {
1426  const unsigned int N = r->N;
1427 
1428  const int CommutativeVariable = 0;
1429  const int AntiCommutativeVariable = 1;
1430 
1431  intvec* w = new intvec(N, 1, CommutativeVariable);
1432 
1433  if(AntiCommutativeVariable != CommutativeVariable)
1434  if( rIsSCA(r) )
1435  {
1436  const unsigned int m_iFirstAltVar = scaFirstAltVar(r);
1437  const unsigned int m_iLastAltVar = scaLastAltVar(r);
1438 
1439  for (unsigned int i = m_iFirstAltVar; i<= m_iLastAltVar; i++)
1440  {
1441  (*w)[i-1] = AntiCommutativeVariable;
1442  }
1443  }
1444  return w;
1445 }
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int i
Definition: cfEzgcd.cc:123
static short scaFirstAltVar(ring r)
Definition: sca.h:18
const CanonicalForm & w
Definition: facAbsFact.cc:55
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206

§ m_GetBiDegree()

static void m_GetBiDegree ( const poly  m,
const intvec wx,
const intvec wy,
const intvec wCx,
const intvec wCy,
int &  dx,
int &  dy,
const ring  r 
)
inlinestatic

Definition at line 1288 of file sca.cc.

1292 {
1293  const unsigned int N = r->N;
1294 
1295  p_Test(m, r);
1296 
1297  assume( wx != NULL );
1298  assume( wy != NULL );
1299 
1300  assume( wx->cols() == 1 );
1301  assume( wy->cols() == 1 );
1302 
1303  assume( (unsigned int)wx->rows() >= N );
1304  assume( (unsigned int)wy->rows() >= N );
1305 
1306  int x = 0;
1307  int y = 0;
1308 
1309  for(int i = N; i > 0; i--)
1310  {
1311  const int d = p_GetExp(m, i, r);
1312  x += d * (*wx)[i-1];
1313  y += d * (*wy)[i-1];
1314  }
1315 
1316  if( (wCx != NULL) && (wCy != NULL) )
1317  {
1318  const int c = p_GetComp(m, r);
1319 
1320  if( wCx->range(c) )
1321  x += (*wCx)[c];
1322 
1323  if( wCy->range(c) )
1324  x += (*wCy)[c];
1325  }
1326 
1327  dx = x;
1328  dy = y;
1329 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
#define p_GetComp(p, r)
Definition: monomials.h:72
int rows() const
Definition: intvec.h:88
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:464
#define assume(x)
Definition: mod2.h:403
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
#define p_Test(p, r)
Definition: p_polys.h:160
int range(int i) const
Definition: intvec.h:51
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87
Variable x
Definition: cfModGcd.cc:4023

§ m_KillSquares()

static poly m_KillSquares ( const poly  m,
const short  iFirstAltVar,
const short  iLastAltVar,
const ring  r 
)
inlinestatic

Definition at line 1452 of file sca.cc.

1455 {
1456 #ifdef PDEBUG
1457  p_Test(m, r);
1458  assume( (iFirstAltVar >= 1) && (iLastAltVar <= rVar(r)) && (iFirstAltVar <= iLastAltVar) );
1459 
1460 #if 0
1461  PrintS("m_KillSquares, m = "); // !
1462  p_Write(m, r);
1463 #endif
1464 #endif
1465 
1466  assume( m != NULL );
1467 
1468  for(short k = iFirstAltVar; k <= iLastAltVar; k++)
1469  if( p_GetExp(m, k, r) > 1 )
1470  return NULL;
1471 
1472  return p_Head(m, r);
1473 }
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
int k
Definition: cfEzgcd.cc:93
static poly p_Head(poly p, const ring r)
Definition: p_polys.h:812
const ring r
Definition: syzextra.cc:208
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:464
#define assume(x)
Definition: mod2.h:403
int m
Definition: cfEzgcd.cc:119
void PrintS(const char *s)
Definition: reporter.cc:284
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206

§ p_IsBiHomogeneous()

bool p_IsBiHomogeneous ( const poly  p,
const intvec wx,
const intvec wy,
const intvec wCx,
const intvec wCy,
int &  dx,
int &  dy,
const ring  r 
)

Definition at line 1333 of file sca.cc.

1338 {
1339  if( p == NULL )
1340  {
1341  dx = 0;
1342  dy = 0;
1343  return true;
1344  }
1345 
1346  poly q = p;
1347 
1348 
1349  int ddx, ddy;
1350 
1351  m_GetBiDegree( q, wx, wy, wCx, wCy, ddx, ddy, r); // get bi degree of lm(p)
1352 
1353  pIter(q);
1354 
1355  for(; q != NULL; pIter(q) )
1356  {
1357  int x, y;
1358 
1359  m_GetBiDegree( q, wx, wy, wCx, wCy, x, y, r); // get bi degree of q
1360 
1361  if ( (x != ddx) || (y != ddy) ) return false;
1362  }
1363 
1364  dx = ddx;
1365  dy = ddy;
1366 
1367  return true;
1368 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
#define NULL
Definition: omList.c:10
Variable x
Definition: cfModGcd.cc:4023
polyrec * poly
Definition: hilb.h:10
static void m_GetBiDegree(const poly m, const intvec *wx, const intvec *wy, const intvec *wCx, const intvec *wCy, int &dx, int &dy, const ring r)
Definition: sca.cc:1288

§ p_KillSquares()

poly p_KillSquares ( const poly  p,
const short  iFirstAltVar,
const short  iLastAltVar,
const ring  r 
)

Definition at line 1478 of file sca.cc.

1481 {
1482 #ifdef PDEBUG
1483  p_Test(p, r);
1484 
1485  assume( (iFirstAltVar >= 1) && (iLastAltVar <= r->N) && (iFirstAltVar <= iLastAltVar) );
1486 
1487 #if 0
1488  PrintS("p_KillSquares, p = "); // !
1489  p_Write(p, r);
1490 #endif
1491 #endif
1492 
1493 
1494  if( p == NULL )
1495  return NULL;
1496 
1497  poly pResult = NULL;
1498  poly* ppPrev = &pResult;
1499 
1500  for( poly q = p; q!= NULL; pIter(q) )
1501  {
1502 #ifdef PDEBUG
1503  p_Test(q, r);
1504 #endif
1505 
1506  // terms will be in the same order because of quasi-ordering!
1507  poly v = m_KillSquares(q, iFirstAltVar, iLastAltVar, r);
1508 
1509  if( v != NULL )
1510  {
1511  *ppPrev = v;
1512  ppPrev = &pNext(v);
1513  }
1514 
1515  }
1516 
1517 #ifdef PDEBUG
1518  p_Test(pResult, r);
1519 #if 0
1520  PrintS("p_KillSquares => "); // !
1521  p_Write(pResult, r);
1522 #endif
1523 #endif
1524 
1525  return(pResult);
1526 }
return P p
Definition: myNF.cc:203
static poly m_KillSquares(const poly m, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition: sca.cc:1452
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
#define assume(x)
Definition: mod2.h:403
void PrintS(const char *s)
Definition: reporter.cc:284
#define p_Test(p, r)
Definition: p_polys.h:160
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
#define pNext(p)
Definition: monomials.h:43
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
polyrec * poly
Definition: hilb.h:10

§ sca_Force()

bool sca_Force ( ring  rGR,
int  b,
int  e 
)

Definition at line 1174 of file sca.cc.

1175 {
1176  assume(rGR != NULL);
1177  assume(rIsPluralRing(rGR));
1178  assume(!rIsSCA(rGR));
1179 
1180  const int N = rGR->N;
1181 
1182 // ring rSaveRing = currRing;
1183 // if(rSaveRing != rGR)
1184 // rChangeCurrRing(rGR);
1185 
1186  const ideal idQuotient = rGR->qideal;
1187 
1188  ideal tempQ = idQuotient;
1189 
1190  if( b <= N && e >= 1 )
1191  tempQ = id_KillSquares(idQuotient, b, e, rGR);
1192 
1193  idSkipZeroes( tempQ );
1194 
1195  ncRingType( rGR, nc_exterior );
1196 
1197  if( idIs0(tempQ) )
1198  rGR->GetNC()->SCAQuotient() = NULL;
1199  else
1200  rGR->GetNC()->SCAQuotient() = tempQ;
1201 
1202 
1203  scaFirstAltVar( rGR, b );
1204  scaLastAltVar( rGR, e );
1205 
1206 
1207  nc_p_ProcsSet(rGR, rGR->p_Procs);
1208 
1209 // if(rSaveRing != rGR)
1210 // rChangeCurrRing(rSaveRing);
1211 
1212  return true;
1213 }
void nc_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: old.gring.cc:3263
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static short scaFirstAltVar(ring r)
Definition: sca.h:18
Definition: nc.h:29
#define NULL
Definition: omList.c:10
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1533
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
const poly b
Definition: syzextra.cc:213

§ sca_m_Mult_mm()

static poly sca_m_Mult_mm ( poly  pMonomM,
const poly  pMonomMM,
const ring  rRing 
)
inlinestatic

Definition at line 141 of file sca.cc.

142 {
143 #ifdef PDEBUG
144  p_Test(pMonomM, rRing);
145  p_Test(pMonomMM, rRing);
146 #endif
147 
148  const unsigned int iFirstAltVar = scaFirstAltVar(rRing);
149  const unsigned int iLastAltVar = scaLastAltVar(rRing);
150 
151  register unsigned int tpower = 0;
152  register unsigned int cpower = 0;
153 
154  for( register unsigned int j = iLastAltVar; j >= iFirstAltVar; j-- )
155  {
156  const unsigned int iExpM = p_GetExp(pMonomM, j, rRing);
157  const unsigned int iExpMM = p_GetExp(pMonomMM, j, rRing);
158 
159 #ifdef PDEBUG
160  assume( iExpM <= 1);
161  assume( iExpMM <= 1);
162 #endif
163 
164  if( iExpMM != 0 )
165  {
166  if( iExpM != 0 ) // result is zero!
167  {
168  return NULL; // we do nothing with pMonomM in this case!
169  }
170 
171  tpower ^= cpower; // compute degree of (-1).
172  }
173 
174  cpower ^= iExpM;
175  }
176 
177 #ifdef PDEBUG
178  assume(tpower <= 1);
179 #endif
180 
181  p_ExpVectorAdd(pMonomM, pMonomMM, rRing); // "exponents" are additive!!!
182 
183  number nCoeffM = p_GetCoeff(pMonomM, rRing); // no new copy! should be deleted!
184 
185  if( (tpower) != 0 ) // degree is odd => negate coeff.
186  nCoeffM = n_InpNeg(nCoeffM, rRing->cf); // negate nCoeff (will destroy the original number)
187 
188  const number nCoeffMM = p_GetCoeff(pMonomMM, rRing); // no new copy!
189 
190  number nCoeff = n_Mult(nCoeffM, nCoeffMM, rRing->cf); // new number!
191 
192  p_SetCoeff(pMonomM, nCoeff, rRing); // delete lc(pMonomM) and set lc(pMonomM) = nCoeff
193 
194 #ifdef PDEBUG
195  p_LmTest(pMonomM, rRing);
196 #endif
197 
198  return(pMonomM);
199 }
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
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
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:464
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1334
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_LmTest(p, r)
Definition: p_polys.h:161
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
#define p_GetCoeff(p, r)
Definition: monomials.h:57

§ sca_mm_Mult_m()

static poly sca_mm_Mult_m ( const poly  pMonomMM,
poly  pMonomM,
const ring  rRing 
)
inlinestatic

Definition at line 205 of file sca.cc.

206 {
207 #ifdef PDEBUG
208  p_Test(pMonomM, rRing);
209  p_Test(pMonomMM, rRing);
210 #endif
211 
212  const unsigned int iFirstAltVar = scaFirstAltVar(rRing);
213  const unsigned int iLastAltVar = scaLastAltVar(rRing);
214 
215  register unsigned int tpower = 0;
216  register unsigned int cpower = 0;
217 
218  for( register unsigned int j = iLastAltVar; j >= iFirstAltVar; j-- )
219  {
220  const unsigned int iExpMM = p_GetExp(pMonomMM, j, rRing);
221  const unsigned int iExpM = p_GetExp(pMonomM, j, rRing);
222 
223 #ifdef PDEBUG
224  assume( iExpM <= 1);
225  assume( iExpMM <= 1);
226 #endif
227 
228  if( iExpM != 0 )
229  {
230  if( iExpMM != 0 ) // result is zero!
231  {
232  return NULL; // we do nothing with pMonomM in this case!
233  }
234 
235  tpower ^= cpower; // compute degree of (-1).
236  }
237 
238  cpower ^= iExpMM;
239  }
240 
241 #ifdef PDEBUG
242  assume(tpower <= 1);
243 #endif
244 
245  p_ExpVectorAdd(pMonomM, pMonomMM, rRing); // "exponents" are additive!!!
246 
247  number nCoeffM = p_GetCoeff(pMonomM, rRing); // no new copy! should be deleted!
248 
249  if( (tpower) != 0 ) // degree is odd => negate coeff.
250  nCoeffM = n_InpNeg(nCoeffM, rRing->cf); // negate nCoeff (will destroy the original number), creates new number!
251 
252  const number nCoeffMM = p_GetCoeff(pMonomMM, rRing); // no new copy!
253 
254  number nCoeff = n_Mult(nCoeffM, nCoeffMM, rRing->cf); // new number!
255 
256  p_SetCoeff(pMonomM, nCoeff, rRing); // delete lc(pMonomM) and set lc(pMonomM) = nCoeff
257 
258 #ifdef PDEBUG
259  p_LmTest(pMonomM, rRing);
260 #endif
261 
262  return(pMonomM);
263 }
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
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
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:464
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
static void p_ExpVectorAdd(poly p1, poly p2, const ring r)
Definition: p_polys.h:1334
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_LmTest(p, r)
Definition: p_polys.h:161
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
#define p_GetCoeff(p, r)
Definition: monomials.h:57

§ sca_mm_Mult_mm()

static poly sca_mm_Mult_mm ( poly  pMonom1,
const poly  pMonom2,
const ring  rRing 
)
inlinestatic

Definition at line 270 of file sca.cc.

271 {
272 #ifdef PDEBUG
273  p_Test(pMonom1, rRing);
274  p_Test(pMonom2, rRing);
275 #endif
276 
277  const unsigned int iFirstAltVar = scaFirstAltVar(rRing);
278  const unsigned int iLastAltVar = scaLastAltVar(rRing);
279 
280  register unsigned int tpower = 0;
281  register unsigned int cpower = 0;
282 
283  for( register unsigned int j = iLastAltVar; j >= iFirstAltVar; j-- )
284  {
285  const unsigned int iExp1 = p_GetExp(pMonom1, j, rRing);
286  const unsigned int iExp2 = p_GetExp(pMonom2, j, rRing);
287 
288 #ifdef PDEBUG
289  assume( iExp1 <= 1);
290  assume( iExp2 <= 1);
291 #endif
292 
293  if( iExp2 != 0 )
294  {
295  if( iExp1 != 0 ) // result is zero!
296  {
297  return NULL;
298  }
299  tpower ^= cpower; // compute degree of (-1).
300  }
301  cpower ^= iExp1;
302  }
303 
304 #ifdef PDEBUG
305  assume(cpower <= 1);
306 #endif
307 
308  poly pResult;
309  p_AllocBin(pResult,rRing->PolyBin,rRing);
310 
311  p_ExpVectorSum(pResult, pMonom1, pMonom2, rRing); // "exponents" are additive!!!
312 
313  pNext(pResult) = NULL;
314 
315  const number nCoeff1 = p_GetCoeff(pMonom1, rRing); // no new copy!
316  const number nCoeff2 = p_GetCoeff(pMonom2, rRing); // no new copy!
317 
318  number nCoeff = n_Mult(nCoeff1, nCoeff2, rRing->cf); // new number!
319 
320  if( (tpower) != 0 ) // degree is odd => negate coeff.
321  nCoeff = n_InpNeg(nCoeff, rRing->cf); // negate nCoeff (will destroy the original number)
322 
323  p_SetCoeff0(pResult, nCoeff, rRing); // set lc(pResult) = nCoeff, no destruction!
324 
325 #ifdef PDEBUG
326  p_LmTest(pResult, rRing);
327 #endif
328 
329  return(pResult);
330 }
#define p_AllocBin(p, bin, r)
Definition: monomials.h:256
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
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:464
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_LmTest(p, r)
Definition: p_polys.h:161
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
#define pNext(p)
Definition: monomials.h:43
#define p_GetCoeff(p, r)
Definition: monomials.h:57
#define p_SetCoeff0(p, n, r)
Definition: monomials.h:68
static void p_ExpVectorSum(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1348
polyrec * poly
Definition: hilb.h:10

§ sca_mm_Mult_p()

static poly sca_mm_Mult_p ( const poly  pMonom,
poly  pPoly,
const ring  rRing 
)
static

Definition at line 644 of file sca.cc.

645 {
646  assume( rIsSCA(rRing) );
647 
648 #ifdef PDEBUG
649  p_Test(pPoly, rRing);
650  p_Test(pMonom, rRing);
651 #endif
652 
653  if( pPoly == NULL )
654  return NULL;
655 
656  assume(pMonom!=NULL);
657  //if( pMonom == NULL )
658  //{
659  // // pPoly != NULL =>
660  // p_Delete( &pPoly, rRing );
661  // return NULL;
662  //}
663 
664  const int iComponentMonomM = p_GetComp(pMonom, rRing);
665 
666  poly p = pPoly; poly* ppPrev = &pPoly;
667 
668  loop
669  {
670 #ifdef PDEBUG
671  if( !p_Test(p, rRing) )
672  {
673  PrintS("p is wrong!");
674  p_Write(p,rRing);
675  }
676 #endif
677 
678  const int iComponent = p_GetComp(p, rRing);
679 
680  if( iComponentMonomM!=0 )
681  {
682  if( iComponent!=0 )
683  {
684  // REPORT_ERROR
685  Werror("sca_mm_Mult_p: exponent mismatch %d and %d\n", iComponent, iComponentMonomM);
686  // what should we do further?!?
687 
688  p_Delete( &pPoly, rRing); // delete the result
689  return NULL;
690  }
691 #ifdef PDEBUG
692  if(iComponent==0)
693  {
694  dReportError("sca_mm_Mult_p: Multiplication in the left module from the right!");
695 // PrintS("mm = "); p_Write(pMonom, rRing);
696 // PrintS("p = "); p_Write(pPoly, rRing);
697 // assume(iComponent!=0);
698  }
699 #endif
700  }
701 
702  // terms will be in the same order because of quasi-ordering!
703  poly v = sca_mm_Mult_m(pMonom, p, rRing);
704 
705  if( v != NULL )
706  {
707  ppPrev = &pNext(p);
708 
709  // *p is changed if v != NULL ( p == v )
710  pIter(p);
711 
712  if( p == NULL )
713  break;
714  }
715  else
716  { // Upps! Zero!!! we must kill this term!
717  p = p_LmDeleteAndNext(p, rRing);
718 
719  *ppPrev = p;
720 
721  if( p == NULL )
722  break;
723  }
724  }
725 
726 #ifdef PDEBUG
727  if( !p_Test(pPoly, rRing) )
728  {
729  PrintS("pPoly is wrong!");
730  p_Write(pPoly, rRing);
731  }
732 #endif
733 
734  return(pPoly);
735 }
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:720
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define pIter(p)
Definition: monomials.h:44
#define assume(x)
Definition: mod2.h:403
void PrintS(const char *s)
Definition: reporter.cc:284
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
static poly sca_mm_Mult_m(const poly pMonomMM, poly pMonomM, const ring rRing)
Definition: sca.cc:205
static bool rIsSCA(const ring r)
Definition: nc.h:206
#define pNext(p)
Definition: monomials.h:43
int dReportError(const char *fmt,...)
Definition: dError.cc:45
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:206
polyrec * poly
Definition: hilb.h:10
void Werror(const char *fmt,...)
Definition: reporter.cc:189

§ sca_mm_Mult_pp()

static poly sca_mm_Mult_pp ( const poly  pMonom,
const poly  pPoly,
const ring  rRing 
)
static

Definition at line 576 of file sca.cc.

577 {
578  assume( rIsSCA(rRing) );
579 
580 #ifdef PDEBUG
581 // PrintS("sca_mm_Mult_pp\n"); // !
582 
583  p_Test(pPoly, rRing);
584  p_Test(pMonom, rRing);
585 #endif
586 
587  if ((pPoly==NULL) || (pMonom==NULL)) return NULL;
588 
589  assume( (pPoly != NULL) && (pMonom !=NULL));
590 
591  const int iComponentMonomM = p_GetComp(pMonom, rRing);
592 
593  poly pResult = NULL;
594  poly* ppPrev = &pResult;
595 
596  for( poly p = pPoly; p!= NULL; pIter(p) )
597  {
598 #ifdef PDEBUG
599  p_Test(p, rRing);
600 #endif
601  const int iComponent = p_GetComp(p, rRing);
602 
603  if( iComponentMonomM!=0 )
604  {
605  if( iComponent!=0 ) // TODO: make global if on iComponentMonomM =?= 0
606  {
607  // REPORT_ERROR
608  Werror("sca_mm_Mult_pp: exponent mismatch %d and %d\n", iComponent, iComponentMonomM);
609  // what should we do further?!?
610 
611  p_Delete( &pResult, rRing); // delete the result
612  return NULL;
613  }
614 #ifdef PDEBUG
615  if(iComponent==0 )
616  {
617  dReportError("sca_mm_Mult_pp: Multiplication in the left module from the right!");
618 // PrintS("mm = "); p_Write(pMonom, rRing);
619 // PrintS("pp = "); p_Write(pPoly, rRing);
620 // assume(iComponent!=0);
621  }
622 #endif
623  }
624 
625  // terms will be in the same order because of quasi-ordering!
626  poly v = sca_mm_Mult_mm(pMonom, p, rRing);
627 
628  if( v != NULL )
629  {
630  *ppPrev = v;
631  ppPrev = &pNext(*ppPrev); // nice line ;-)
632  }
633  }
634 
635 #ifdef PDEBUG
636  p_Test(pResult,rRing);
637 #endif
638 
639  return(pResult);
640 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define pIter(p)
Definition: monomials.h:44
#define assume(x)
Definition: mod2.h:403
static poly sca_mm_Mult_mm(poly pMonom1, const poly pMonom2, const ring rRing)
Definition: sca.cc:270
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
static bool rIsSCA(const ring r)
Definition: nc.h:206
#define pNext(p)
Definition: monomials.h:43
int dReportError(const char *fmt,...)
Definition: dError.cc:45
polyrec * poly
Definition: hilb.h:10
void Werror(const char *fmt,...)
Definition: reporter.cc:189

§ sca_p_Mult_mm()

poly sca_p_Mult_mm ( poly  pPoly,
const poly  pMonom,
const ring  rRing 
)

Definition at line 380 of file sca.cc.

381 {
382  assume( rIsSCA(rRing) );
383 
384 #ifdef PDEBUG
385 // PrintS("sca_p_Mult_mm\n"); // !
386 
387  p_Test(pPoly, rRing);
388  p_Test(pMonom, rRing);
389 #endif
390 
391  if( pPoly == NULL )
392  return NULL;
393 
394  assume(pMonom !=NULL);
395  //if( pMonom == NULL )
396  //{
397  // // pPoly != NULL =>
398  // p_Delete( &pPoly, rRing );
399  // return NULL;
400  //}
401 
402  const int iComponentMonomM = p_GetComp(pMonom, rRing);
403 
404  poly p = pPoly; poly* ppPrev = &pPoly;
405 
406  loop
407  {
408 #ifdef PDEBUG
409  p_Test(p, rRing);
410 #endif
411  const int iComponent = p_GetComp(p, rRing);
412 
413  if( iComponent!=0 )
414  {
415  if( iComponentMonomM!=0 ) // TODO: make global if on iComponentMonomM =?= 0
416  {
417  // REPORT_ERROR
418  Werror("sca_p_Mult_mm: exponent mismatch %d and %d\n", iComponent, iComponentMonomM);
419  // what should we do further?!?
420 
421  p_Delete( &pPoly, rRing); // delete the result AND rest
422  return NULL;
423  }
424 #ifdef PDEBUG
425  if(iComponentMonomM==0 )
426  {
427  dReportError("sca_p_Mult_mm: Multiplication in the left module from the right");
428  }
429 #endif
430  }
431 
432  // terms will be in the same order because of quasi-ordering!
433  poly v = sca_m_Mult_mm(p, pMonom, rRing);
434 
435  if( v != NULL )
436  {
437  ppPrev = &pNext(p); // fixed!
438 
439  // *p is changed if v != NULL ( p == v )
440  pIter(p);
441 
442  if( p == NULL )
443  break;
444  }
445  else
446  { // Upps! Zero!!! we must kill this term!
447 
448  //
449  p = p_LmDeleteAndNext(p, rRing);
450 
451  *ppPrev = p;
452 
453  if( p == NULL )
454  break;
455  }
456  }
457 
458 #ifdef PDEBUG
459  p_Test(pPoly,rRing);
460 #endif
461 
462  return(pPoly);
463 }
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:720
loop
Definition: myNF.cc:98
return P p
Definition: myNF.cc:203
static poly sca_m_Mult_mm(poly pMonomM, const poly pMonomMM, const ring rRing)
Definition: sca.cc:141
#define p_GetComp(p, r)
Definition: monomials.h:72
#define pIter(p)
Definition: monomials.h:44
#define assume(x)
Definition: mod2.h:403
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
static bool rIsSCA(const ring r)
Definition: nc.h:206
#define pNext(p)
Definition: monomials.h:43
int dReportError(const char *fmt,...)
Definition: dError.cc:45
polyrec * poly
Definition: hilb.h:10
void Werror(const char *fmt,...)
Definition: reporter.cc:189

§ sca_p_ProcsSet()

void sca_p_ProcsSet ( ring  rGR,
p_Procs_s p_Procs 
)

Definition at line 1238 of file sca.cc.

1239 {
1240 
1241  // "commutative" procedures:
1242  rGR->p_Procs->p_Mult_mm = sca_p_Mult_mm;
1243  rGR->p_Procs->pp_Mult_mm = sca_pp_Mult_mm;
1244 
1245  p_Procs->p_Mult_mm = sca_p_Mult_mm;
1246  p_Procs->pp_Mult_mm = sca_pp_Mult_mm;
1247 
1248  // non-commutaitve
1249  rGR->GetNC()->p_Procs.mm_Mult_p = sca_mm_Mult_p;
1250  rGR->GetNC()->p_Procs.mm_Mult_pp = sca_mm_Mult_pp;
1251 
1252 // rGR->GetNC()->p_Procs.SPoly = sca_SPoly;
1253 // rGR->GetNC()->p_Procs.ReduceSPoly = sca_ReduceSpoly;
1254 
1255 #if 0
1256 
1257  // Multiplication procedures:
1258 
1259  p_Procs->p_Mult_mm = sca_p_Mult_mm;
1260  _p_procs->p_Mult_mm = sca_p_Mult_mm;
1261 
1262  p_Procs->pp_Mult_mm = sca_pp_Mult_mm;
1263  _p_procs->pp_Mult_mm = sca_pp_Mult_mm;
1264 
1265  r->GetNC()->mmMultP() = sca_mm_Mult_p;
1266  r->GetNC()->mmMultPP() = sca_mm_Mult_pp;
1267 
1268 /*
1269  // ??????????????????????????????????????? coefficients swell...
1270  r->GetNC()->SPoly() = sca_SPoly;
1271  r->GetNC()->ReduceSPoly() = sca_ReduceSpoly;
1272 */
1273 // r->GetNC()->BucketPolyRed() = gnc_kBucketPolyRed;
1274 // r->GetNC()->BucketPolyRed_Z()= gnc_kBucketPolyRed_Z;
1275 #endif
1276 
1277  // local ordering => Mora, otherwise - Buchberger!
1278  if (rHasLocalOrMixedOrdering(rGR))
1279  rGR->GetNC()->p_Procs.GB = cast_A_to_vptr(sca_mora);
1280  else
1281  rGR->GetNC()->p_Procs.GB = cast_A_to_vptr(sca_bba); // sca_gr_bba?
1282 }
BOOLEAN rHasLocalOrMixedOrdering(const ring r)
Definition: ring.h:747
BBA_Proc sca_mora
Definition: old.gring.cc:75
static poly sca_mm_Mult_p(const poly pMonom, poly pPoly, const ring rRing)
Definition: sca.cc:644
poly sca_p_Mult_mm(poly pPoly, const poly pMonom, const ring rRing)
Definition: sca.cc:380
const ring r
Definition: syzextra.cc:208
BBA_Proc sca_bba
Definition: old.gring.cc:74
poly sca_pp_Mult_mm(const poly pPoly, const poly pMonom, const ring rRing, poly &)
static poly sca_mm_Mult_pp(const poly pMonom, const poly pPoly, const ring rRing)
Definition: sca.cc:576
void * cast_A_to_vptr(A a)
Definition: auxiliary.h:385
static p_Procs_s * _p_procs
Definition: p_Procs_Set.h:113

§ sca_pp_Mult_mm() [1/2]

poly sca_pp_Mult_mm ( const poly  pPoly,
const poly  pMonom,
const ring  rRing,
poly  
)

§ sca_pp_Mult_mm() [2/2]

poly sca_pp_Mult_mm ( const poly  pPoly,
const poly  pMonom,
const ring  rRing 
)

Definition at line 466 of file sca.cc.

467 {
468  assume( rIsSCA(rRing) );
469 
470 #ifdef PDEBUG
471 // PrintS("sca_pp_Mult_mm\n"); // !
472 
473  p_Test(pPoly, rRing);
474  p_Test(pMonom, rRing);
475 #endif
476 
477  if (/*(*/ pPoly == NULL /*)*/) /*|| ( pMonom == NULL )*/
478  return NULL;
479 
480  const int iComponentMonomM = p_GetComp(pMonom, rRing);
481 
482  poly pResult = NULL;
483  poly* ppPrev = &pResult;
484 
485  for( poly p = pPoly; p!= NULL; pIter(p) )
486  {
487 #ifdef PDEBUG
488  p_Test(p, rRing);
489 #endif
490  const int iComponent = p_GetComp(p, rRing);
491 
492  if( iComponent!=0 )
493  {
494  if( iComponentMonomM!=0 ) // TODO: make global if on iComponentMonomM =?= 0
495  {
496  // REPORT_ERROR
497  Werror("sca_pp_Mult_mm: exponent mismatch %d and %d\n", iComponent, iComponentMonomM);
498  // what should we do further?!?
499 
500  p_Delete( &pResult, rRing); // delete the result
501  return NULL;
502  }
503 
504 #ifdef PDEBUG
505  if(iComponentMonomM==0 )
506  {
507  dReportError("sca_pp_Mult_mm: Multiplication in the left module from the right");
508  }
509 #endif
510  }
511 
512  // terms will be in the same order because of quasi-ordering!
513  poly v = sca_mm_Mult_mm(p, pMonom, rRing);
514 
515  if( v != NULL )
516  {
517  *ppPrev = v;
518  ppPrev = &pNext(v);
519  }
520  }
521 
522 #ifdef PDEBUG
523  p_Test(pResult,rRing);
524 #endif
525 
526  return(pResult);
527 }
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define pIter(p)
Definition: monomials.h:44
#define assume(x)
Definition: mod2.h:403
static poly sca_mm_Mult_mm(poly pMonom1, const poly pMonom2, const ring rRing)
Definition: sca.cc:270
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
static bool rIsSCA(const ring r)
Definition: nc.h:206
#define pNext(p)
Definition: monomials.h:43
int dReportError(const char *fmt,...)
Definition: dError.cc:45
polyrec * poly
Definition: hilb.h:10
void Werror(const char *fmt,...)
Definition: reporter.cc:189

§ sca_pp_Mult_xi_pp()

poly sca_pp_Mult_xi_pp ( short  i,
const poly  pPoly,
const ring  rRing 
)

Definition at line 1216 of file sca.cc.

1217 {
1218  assume(1 <= i);
1219  assume(i <= rVar(rRing));
1220 
1221  if(rIsSCA(rRing))
1222  return sca_xi_Mult_pp(i, pPoly, rRing);
1223 
1224 
1225 
1226  poly xi = p_One( rRing);
1227  p_SetExp(xi, i, 1, rRing);
1228  p_Setm(xi, rRing);
1229 
1230  poly pResult = pp_Mult_qq(xi, pPoly, rRing);
1231 
1232  p_Delete( &xi, rRing);
1233 
1234  return pResult;
1235 
1236 }
static poly sca_xi_Mult_pp(short i, const poly pPoly, const ring rRing)
Definition: sca.cc:532
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:580
poly p_One(const ring r)
Definition: p_polys.cc:1312
#define assume(x)
Definition: mod2.h:403
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition: p_polys.h:1070
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
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:483
static bool rIsSCA(const ring r)
Definition: nc.h:206
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
polyrec * poly
Definition: hilb.h:10

§ sca_ReduceSpoly()

poly sca_ReduceSpoly ( const poly  p1,
poly  p2,
const ring  r 
)

Definition at line 841 of file sca.cc.

842 {
843  assume( rIsSCA(r) );
844 
845  assume( p1 != NULL );
846 
847  const long lCompP1 = p_GetComp (p1, r);
848  const long lCompP2 = p_GetComp (p2, r);
849 
850  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
851  {
852 #ifdef PDEBUG
853  dReportError("sca_ReduceSpoly: different non-zero components!");
854 #endif
855  return(NULL);
856  }
857 
858  poly m = p_ISet (1, r);
859  p_ExpVectorDiff (m, p2, p1, r); // m = lm(p2) / lm(p1)
860  //p_Setm(m,r);
861 #ifdef PDEBUG
862  p_Test (m,r);
863 #endif
864 
865  number C1 = n_Copy( pGetCoeff(p1), r->cf);
866  number C2 = n_Copy( pGetCoeff(p2), r->cf);
867 
868  /* GCD stuff */
869  number C = n_Gcd(C1, C2, r->cf);
870 
871  if (!n_IsOne(C, r->cf))
872  {
873  C1 = n_Div(C1, C, r->cf);
874  C2 = n_Div(C2, C, r->cf);
875  }
876  n_Delete(&C,r->cf);
877 
878  const int iSign = sca_Sign_mm_Mult_mm( m, p1, r );
879 
880  if(iSign == 1)
881  C2 = n_InpNeg(C2,r->cf);
882 
883  p_SetCoeff(m, C2, r);
884 
885 #ifdef PDEBUG
886  p_Test(m,r);
887 #endif
888 
889  p2 = p_LmDeleteAndNext( p2, r );
890 
891  p2 = p_Mult_nn(p2, C1, r); // p2 !!!
892  n_Delete(&C1,r->cf);
893 
894  poly T = nc_mm_Mult_pp(m, pNext(p1), r);
895  p_Delete(&m, r);
896 
897  p2 = p_Add_q(p2, T, r);
898 
899  if ( p2!=NULL ) p_Content(p2,r);
900 
901 #ifdef PDEBUG
902  p_Test(p2,r);
903 #endif
904 
905  return(p2);
906 }
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
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:720
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
#define p_GetComp(p, r)
Definition: monomials.h:72
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static int sca_Sign_mm_Mult_mm(const poly pMonomM, const poly pMonomMM, const ring rRing)
Definition: sca.cc:90
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:403
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
static poly p_Mult_nn(poly p, number n, const ring r)
Definition: p_polys.h:895
void p_Content(poly ph, const ring r)
Definition: p_polys.cc:2215
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1397
#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
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:619
static bool rIsSCA(const ring r)
Definition: nc.h:206
#define pNext(p)
Definition: monomials.h:43
int dReportError(const char *fmt,...)
Definition: dError.cc:45
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
static jList * T
Definition: janet.cc:37
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1296

§ sca_SetupQuotient()

bool sca_SetupQuotient ( ring  rGR,
ring  rG,
bool  bCopy 
)

Definition at line 921 of file sca.cc.

922 {
923 
924  //////////////////////////////////////////////////////////////////////////
925  // checks...
926  //////////////////////////////////////////////////////////////////////////
927  if( rG == NULL )
928  rG = rGR;
929 
930  assume(rGR != NULL);
931  assume(rG != NULL);
932  assume(rIsPluralRing(rG));
933 
934 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
935  PrintS("sca_SetupQuotient(rGR, rG, bCopy)");
936 
937  {
938  PrintS("\nrG: \n"); rWrite(rG);
939  PrintS("\nrGR: \n"); rWrite(rGR);
940  PrintLn();
941  }
942 #endif
943 
944 
945  if(bCopy)
946  {
947  if(rIsSCA(rG) && (rG != rGR))
948  return sca_Force(rGR, scaFirstAltVar(rG), scaLastAltVar(rG));
949  else
950  return false;
951  }
952 
953  assume(!bCopy);
954 
955  const int N = rG->N;
956 
957  if(N < 2)
958  return false;
959 
960 
961 // if( (ncRingType(rG) != nc_skew) || (ncRingType(rG) != nc_comm) )
962 // return false;
963 
964 #if OUTPUT
965  PrintS("sca_SetupQuotient: qring?\n");
966 #endif
967 
968  if(rGR->qideal == NULL) // there should be a factor!
969  return false;
970 
971 #if OUTPUT
972  PrintS("sca_SetupQuotient: qideal!!!\n");
973 #endif
974 
975 // if((rG->qideal != NULL) && (rG != rGR) ) // we cannot change from factor to factor at the time, sorry!
976 // return false;
977 
978 
979  int iAltVarEnd = -1;
980  int iAltVarStart = N+1;
981 
982  const nc_struct* NC = rG->GetNC();
983  const ring rBase = rG; //NC->basering;
984  const matrix C = NC->C; // live in rBase!
985  const matrix D = NC->D; // live in rBase!
986 
987 #if OUTPUT
988  PrintS("sca_SetupQuotient: AltVars?!\n");
989 #endif
990 
991  for(int i = 1; i < N; i++)
992  {
993  for(int j = i + 1; j <= N; j++)
994  {
995  if( MATELEM(D,i,j) != NULL) // !!!???
996  {
997 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
998  Print("Nonzero D[%d, %d]\n", i, j);
999 #endif
1000  return false;
1001  }
1002 
1003 
1004  assume(MATELEM(C,i,j) != NULL); // after CallPlural!
1005  number c = p_GetCoeff(MATELEM(C,i,j), rBase);
1006 
1007  if( n_IsMOne(c, rBase->cf) ) // !!!???
1008  {
1009  if( i < iAltVarStart)
1010  iAltVarStart = i;
1011 
1012  if( j > iAltVarEnd)
1013  iAltVarEnd = j;
1014  } else
1015  {
1016  if( !n_IsOne(c, rBase->cf) )
1017  {
1018 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1019  Print("Wrong Coeff at: [%d, %d]\n", i, j);
1020 #endif
1021  return false;
1022  }
1023  }
1024  }
1025  }
1026 
1027 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1028  Print("AltVars?1: [%d, %d]\n", iAltVarStart, iAltVarEnd);
1029 #endif
1030 
1031 
1032  if( (iAltVarEnd == -1) || (iAltVarStart == (N+1)) )
1033  return false; // either no alternating varables, or a single one => we are in commutative case!
1034 
1035 
1036  for(int i = 1; i < N; i++)
1037  {
1038  for(int j = i + 1; j <= N; j++)
1039  {
1040  assume(MATELEM(C,i,j) != NULL); // after CallPlural!
1041  number c = p_GetCoeff(MATELEM(C,i,j), rBase);
1042 
1043  if( (iAltVarStart <= i) && (j <= iAltVarEnd) ) // S <= i < j <= E
1044  { // anticommutative part
1045  if( !n_IsMOne(c, rBase->cf) )
1046  {
1047 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1048  Print("Wrong Coeff at: [%d, %d]\n", i, j);
1049 #endif
1050  return false;
1051  }
1052  }
1053  else
1054  { // should commute
1055  if( !n_IsOne(c, rBase->cf) )
1056  {
1057 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1058  Print("Wrong Coeff at: [%d, %d]\n", i, j);
1059 #endif
1060  return false;
1061  }
1062  }
1063  }
1064  }
1065 
1066 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1067  Print("AltVars!?: [%d, %d]\n", iAltVarStart, iAltVarEnd);
1068 #endif
1069 
1070  assume( 1 <= iAltVarStart );
1071  assume( iAltVarStart < iAltVarEnd );
1072  assume( iAltVarEnd <= N );
1073 
1074 
1075 // ring rSaveRing = assureCurrentRing(rG);
1076 
1077 
1078  assume(rGR->qideal != NULL);
1079  assume(rGR->N == rG->N);
1080 // assume(rG->qideal == NULL); // ?
1081 
1082  const ideal idQuotient = rGR->qideal;
1083 
1084 
1085 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1086  PrintS("Analyzing quotient ideal:\n");
1087  idPrint(idQuotient); // in rG!!!
1088 #endif
1089 
1090 
1091  // check for
1092  // y_{iAltVarStart}^2, y_{iAltVarStart+1}^2, \ldots, y_{iAltVarEnd}^2 (iAltVarEnd > iAltVarStart)
1093  // to be within quotient ideal.
1094 
1095  bool bSCA = true;
1096 
1097  int b = N+1;
1098  int e = -1;
1099 
1100  if(rIsSCA(rG))
1101  {
1102  b = si_min(b, scaFirstAltVar(rG));
1103  e = si_max(e, scaLastAltVar(rG));
1104 
1105 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1106  Print("AltVars!?: [%d, %d]\n", b, e);
1107 #endif
1108  }
1109 
1110  for ( int i = iAltVarStart; (i <= iAltVarEnd) && bSCA; i++ )
1111  if( (i < b) || (i > e) ) // otherwise it's ok since rG is an SCA!
1112  {
1113  poly square = p_One( rG);
1114  p_SetExp(square, i, 2, rG); // square = var(i)^2.
1115  p_Setm(square, rG);
1116 
1117  // square = NF( var(i)^2 | Q )
1118  // NOTE: there is no better way to check this in general!
1119  square = nc_NF(idQuotient, NULL, square, 0, 1, rG); // must ran in currRing == rG!
1120 
1121  if( square != NULL ) // var(i)^2 is not in Q?
1122  {
1123  p_Delete(&square, rG);
1124  bSCA = false;
1125  break;
1126  }
1127  }
1128 
1129 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1130  Print("ScaVars!: [%d, %d]\n", iAltVarStart, iAltVarEnd);
1131 #endif
1132 
1133 
1134  //////////////////////////////////////////////////////////////////////////
1135  // ok... here we go. let's setup it!!!
1136  //////////////////////////////////////////////////////////////////////////
1137  ideal tempQ = id_KillSquares(idQuotient, iAltVarStart, iAltVarEnd, rG); // in rG!!!
1138 
1139 
1140 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1141  PrintS("Quotient: \n");
1142  iiWriteMatrix((matrix)idQuotient,"__",1, rG, 0);
1143  PrintS("tempSCAQuotient: \n");
1144  iiWriteMatrix((matrix)tempQ,"__",1, rG, 0);
1145 #endif
1146 
1147  idSkipZeroes( tempQ );
1148 
1149  ncRingType( rGR, nc_exterior );
1150 
1151  scaFirstAltVar( rGR, iAltVarStart );
1152  scaLastAltVar( rGR, iAltVarEnd );
1153 
1154  if( idIs0(tempQ) )
1155  rGR->GetNC()->SCAQuotient() = NULL;
1156  else
1157  rGR->GetNC()->SCAQuotient() = idrMoveR(tempQ, rG, rGR); // deletes tempQ!
1158 
1159  nc_p_ProcsSet(rGR, rGR->p_Procs); // !!!!!!!!!!!!!!!!!
1160 
1161 
1162 #if ((defined(PDEBUG) && OUTPUT) || MYTEST)
1163  PrintS("SCAQuotient: \n");
1164  if(tempQ != NULL)
1165  iiWriteMatrix((matrix)tempQ,"__",1, rGR, 0);
1166  else
1167  PrintS("(NULL)\n");
1168 #endif
1169 
1170  return true;
1171 }
#define D(A)
Definition: gentable.cc:121
void PrintLn()
Definition: reporter.cc:310
#define Print
Definition: emacs.cc:83
static int si_min(const int a, const int b)
Definition: auxiliary.h:122
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
void nc_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: old.gring.cc:3263
Definition: nc.h:83
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition: matpol.cc:746
bool sca_Force(ring rGR, int b, int e)
Definition: sca.cc:1174
#define idPrint(id)
Definition: ideals.h:46
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
poly p_One(const ring r)
Definition: p_polys.cc:1312
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:404
ideal idrMoveR(ideal &id, ring src_r, ring dest_r)
Definition: prCopy.cc:249
static int si_max(const int a, const int b)
Definition: auxiliary.h:121
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:284
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
void idSkipZeroes(ideal ide)
gives an ideal/module the minimal possible size
static short scaFirstAltVar(ring r)
Definition: sca.h:18
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
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:483
Definition: nc.h:29
#define NULL
Definition: omList.c:10
ideal id_KillSquares(const ideal id, const short iFirstAltVar, const short iLastAltVar, const ring r, const bool bSkipZeroes)
Definition: sca.cc:1533
matrix D
Definition: nc.h:92
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
matrix C
Definition: nc.h:91
NF_Proc nc_NF
Definition: old.gring.cc:71
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:476
polyrec * poly
Definition: hilb.h:10
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
const poly b
Definition: syzextra.cc:213
#define MATELEM(mat, i, j)
Definition: matpol.h:29

§ sca_Sign_mm_Mult_mm()

static int sca_Sign_mm_Mult_mm ( const poly  pMonomM,
const poly  pMonomMM,
const ring  rRing 
)
inlinestatic

Definition at line 90 of file sca.cc.

91 {
92 #ifdef PDEBUG
93  p_Test(pMonomM, rRing);
94  p_Test(pMonomMM, rRing);
95 #endif
96 
97  const short iFirstAltVar = scaFirstAltVar(rRing);
98  const short iLastAltVar = scaLastAltVar(rRing);
99 
100  register unsigned int tpower = 0;
101  register unsigned int cpower = 0;
102 
103  for( register short j = iLastAltVar; j >= iFirstAltVar; j-- )
104  {
105  const unsigned int iExpM = p_GetExp(pMonomM, j, rRing);
106  const unsigned int iExpMM = p_GetExp(pMonomMM, j, rRing);
107 
108 #ifdef PDEBUG
109  assume( iExpM <= 1);
110  assume( iExpMM <= 1);
111 #endif
112 
113  if( iExpMM != 0 ) // TODO: think about eliminating there if-s...
114  {
115  if( iExpM != 0 )
116  {
117  return 0; // lm(pMonomM) * lm(pMonomMM) == 0
118  }
119  tpower ^= cpower; // compute degree of (-1).
120  }
121  cpower ^= iExpM;
122  }
123 
124 #ifdef PDEBUG
125  assume(tpower <= 1);
126 #endif
127 
128  // 1 => -1 // degree is odd => negate coeff.
129  // 0 => 1
130 
131  return(1 - (tpower << 1) );
132 }
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:464
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_Test(p, r)
Definition: p_polys.h:160
static short scaLastAltVar(ring r)
Definition: sca.h:25

§ sca_SPoly()

poly sca_SPoly ( const poly  p1,
const poly  p2,
const ring  r 
)

Definition at line 753 of file sca.cc.

754 {
755  assume( rIsSCA(r) );
756 
757  const long lCompP1 = p_GetComp(p1,r);
758  const long lCompP2 = p_GetComp(p2,r);
759 
760  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
761  {
762 #ifdef PDEBUG
763  dReportError("sca_SPoly: different non-zero components!\n");
764 #endif
765  return(NULL);
766  }
767 
768  poly pL = p_Lcm(p1, p2, si_max(lCompP1, lCompP2), r); // pL = lcm( lm(p1), lm(p2) )
769 
770  poly m1 = p_One( r);
771  p_ExpVectorDiff(m1, pL, p1, r); // m1 = pL / lm(p1)
772 
773  //p_SetComp(m1,0,r);
774  //p_Setm(m1,r);
775 #ifdef PDEBUG
776  p_Test(m1,r);
777 #endif
778 
779 
780  poly m2 = p_One( r);
781  p_ExpVectorDiff (m2, pL, p2, r); // m2 = pL / lm(p2)
782 
783  //p_SetComp(m2,0,r);
784  //p_Setm(m2,r);
785 #ifdef PDEBUG
786  p_Test(m2,r);
787 #endif
788 
789  p_Delete(&pL,r);
790 
791  number C1 = n_Copy(pGetCoeff(p1),r->cf); // C1 = lc(p1)
792  number C2 = n_Copy(pGetCoeff(p2),r->cf); // C2 = lc(p2)
793 
794  number C = n_Gcd(C1,C2,r->cf); // C = gcd(C1, C2)
795 
796  if (!n_IsOne(C, r->cf)) // if C != 1
797  {
798  C1=n_Div(C1, C, r->cf); // C1 = C1 / C
799  C2=n_Div(C2, C, r->cf); // C2 = C2 / C
800  }
801 
802  n_Delete(&C,r->cf); // destroy the number C
803 
804  const int iSignSum = sca_Sign_mm_Mult_mm (m1, p1, r) + sca_Sign_mm_Mult_mm (m2, p2, r);
805  // zero if different signs
806 
807  assume( (iSignSum*iSignSum == 0) || (iSignSum*iSignSum == 4) );
808 
809  if( iSignSum != 0 ) // the same sign!
810  C2=n_InpNeg (C2, r->cf);
811 
812  p_SetCoeff(m1, C2, r); // lc(m1) = C2!!!
813  p_SetCoeff(m2, C1, r); // lc(m2) = C1!!!
814 
815  poly tmp1 = nc_mm_Mult_pp (m1, pNext(p1), r); // tmp1 = m1 * tail(p1),
816  p_Delete(&m1,r); // => n_Delete(&C1,r);
817 
818  poly tmp2 = nc_mm_Mult_pp (m2, pNext(p2), r); // tmp1 = m2 * tail(p2),
819  p_Delete(&m2,r); // => n_Delete(&C1,r);
820 
821  poly spoly = p_Add_q (tmp1, tmp2, r); // spoly = spoly(lt(p1), lt(p2)) + m1 * tail(p1), delete tmp1,2
822 
823  if (spoly!=NULL) p_Cleardenom (spoly, r);
824 // if (spoly!=NULL) p_Content (spoly); // r?
825 
826 #ifdef PDEBUG
827  p_Test (spoly, r);
828 #endif
829 
830  return(spoly);
831 }
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
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff &#39;n&#39; represents the one element.
Definition: coeffs.h:472
#define p_GetComp(p, r)
Definition: monomials.h:72
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1582
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
static number p_SetCoeff(poly p, number n, ring r)
Definition: p_polys.h:407
static int sca_Sign_mm_Mult_mm(const poly pMonomM, const poly pMonomMM, const ring rRing)
Definition: sca.cc:90
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1312
#define assume(x)
Definition: mod2.h:403
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
static int si_max(const int a, const int b)
Definition: auxiliary.h:121
CFList tmp2
Definition: facFqBivar.cc:70
#define p_Test(p, r)
Definition: p_polys.h:160
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:843
static void p_ExpVectorDiff(poly pr, poly p1, poly p2, const ring r)
Definition: p_polys.h:1397
#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
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:619
CFList tmp1
Definition: facFqBivar.cc:70
static bool rIsSCA(const ring r)
Definition: nc.h:206
#define pNext(p)
Definition: monomials.h:43
int dReportError(const char *fmt,...)
Definition: dError.cc:45
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:240
END_NAMESPACE const void * p2
Definition: syzextra.cc:202
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:459
polyrec * poly
Definition: hilb.h:10
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:877
poly p_Cleardenom(poly p, const ring r)
Definition: p_polys.cc:2715

§ sca_xi_Mult_mm()

static poly sca_xi_Mult_mm ( short  i,
const poly  pMonom,
const ring  rRing 
)
inlinestatic

Definition at line 335 of file sca.cc.

336 {
337 #ifdef PDEBUG
338  p_Test(pMonom, rRing);
339 #endif
340 
341  assume( i <= scaLastAltVar(rRing));
342  assume( scaFirstAltVar(rRing) <= i );
343 
344  if( p_GetExp(pMonom, i, rRing) != 0 ) // => result is zero!
345  return NULL;
346 
347  const short iFirstAltVar = scaFirstAltVar(rRing);
348 
349  register unsigned int cpower = 0;
350 
351  for( register short j = iFirstAltVar; j < i ; j++ )
352  cpower ^= p_GetExp(pMonom, j, rRing);
353 
354 #ifdef PDEBUG
355  assume(cpower <= 1);
356 #endif
357 
358  poly pResult = p_LmInit(pMonom, rRing);
359 
360  p_SetExp(pResult, i, 1, rRing); // pResult*=X_i &&
361  p_Setm(pResult, rRing); // addjust degree after previous step!
362 
363  number nCoeff = n_Copy(pGetCoeff(pMonom), rRing->cf); // new number!
364 
365  if( cpower != 0 ) // degree is odd => negate coeff.
366  nCoeff = n_InpNeg(nCoeff, rRing->cf); // negate nCoeff (will destroy the original number)
367 
368  p_SetCoeff0(pResult, nCoeff, rRing); // set lc(pResult) = nCoeff, no destruction!
369 
370 #ifdef PDEBUG
371  p_LmTest(pResult, rRing);
372 #endif
373 
374  return(pResult);
375 }
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
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:464
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:403
static FORCE_INLINE number n_InpNeg(number n, const coeffs r)
in-place negation of n MUST BE USED: n = n_InpNeg(n) (no copy is returned)
Definition: coeffs.h:561
int i
Definition: cfEzgcd.cc:123
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_LmTest(p, r)
Definition: p_polys.h:161
#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:483
#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
static short scaLastAltVar(ring r)
Definition: sca.h:25
static poly p_LmInit(poly p, const ring r)
Definition: p_polys.h:1258
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:228
#define p_SetCoeff0(p, n, r)
Definition: monomials.h:68
polyrec * poly
Definition: hilb.h:10

§ sca_xi_Mult_pp()

static poly sca_xi_Mult_pp ( short  i,
const poly  pPoly,
const ring  rRing 
)
inlinestatic

Definition at line 532 of file sca.cc.

533 {
534  assume( rIsSCA(rRing) );
535 
536 #ifdef PDEBUG
537  p_Test(pPoly, rRing);
538 #endif
539 
540  assume(i <= scaLastAltVar(rRing));
541  assume(scaFirstAltVar(rRing) <= i);
542 
543  if( pPoly == NULL )
544  return NULL;
545 
546  poly pResult = NULL;
547  poly* ppPrev = &pResult;
548 
549  for( poly p = pPoly; p!= NULL; pIter(p) )
550  {
551 
552  // terms will be in the same order because of quasi-ordering!
553  poly v = sca_xi_Mult_mm(i, p, rRing);
554 
555 #ifdef PDEBUG
556  p_Test(v, rRing);
557 #endif
558 
559  if( v != NULL )
560  {
561  *ppPrev = v;
562  ppPrev = &pNext(*ppPrev);
563  }
564  }
565 
566 
567 #ifdef PDEBUG
568  p_Test(pResult, rRing);
569 #endif
570 
571  return(pResult);
572 }
static poly sca_xi_Mult_mm(short i, const poly pMonom, const ring rRing)
Definition: sca.cc:335
return P p
Definition: myNF.cc:203
#define pIter(p)
Definition: monomials.h:44
#define assume(x)
Definition: mod2.h:403
int i
Definition: cfEzgcd.cc:123
static short scaFirstAltVar(ring r)
Definition: sca.h:18
#define p_Test(p, r)
Definition: p_polys.h:160
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define NULL
Definition: omList.c:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
static bool rIsSCA(const ring r)
Definition: nc.h:206
#define pNext(p)
Definition: monomials.h:43
polyrec * poly
Definition: hilb.h:10