Functions
sca.h File Reference
#include <polys/nc/nc.h>
#include <misc/intvec.h>

Go to the source code of this file.

Functions

ideal SCAQuotient (const ring r)
 
static short scaFirstAltVar (ring r)
 
static short scaLastAltVar (ring r)
 
static void scaFirstAltVar (ring r, short n)
 
static void scaLastAltVar (ring r, short n)
 
poly sca_pp_Mult_xi_pp (short i, const poly pPoly, const ring rRing)
 
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 bool p_IsSCAHomogeneous (const poly p, const intvec *wCx, const intvec *wCy, const ring r)
 
static bool id_IsSCAHomogeneous (const ideal id, const intvec *wCx, const intvec *wCy, 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=false)
 
bool sca_Force (ring rGR, int b, int e)
 
void sca_p_ProcsSet (ring rGR, p_Procs_s *p_Procs)
 
bool sca_SetupQuotient (ring rGR, ring rG, bool bCopy)
 

Function Documentation

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

Definition at line 1373 of file sca.cc.

1377 {
1378  if (id == NULL) return true; // zero ideal
1379 
1380  const int iSize = IDELEMS(id);
1381 
1382  if (iSize == 0) return true;
1383 
1384  bool b = true;
1385  int x, y;
1386 
1387  for(int i = iSize - 1; (i >= 0 ) && b; i--)
1388  b = p_IsBiHomogeneous(id->m[i], wx, wy, wCx, wCy, x, y, r);
1389 
1390  return b;
1391 }
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:1334
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
static bool id_IsSCAHomogeneous ( const ideal  id,
const intvec wCx,
const intvec wCy,
const ring  r 
)
inlinestatic

Definition at line 115 of file sca.h.

118 {
119  // inefficient! don't use it in time-critical code!
122 
123  bool homog = id_IsBiHomogeneous( id, wx, wy, wCx, wCy, r );
124 
125  delete wx;
126  delete wy;
127 
128  return homog;
129 }
intvec * ivGetSCAYVarWeights(const ring r)
Definition: sca.cc:1425
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
intvec * ivGetSCAXVarWeights(const ring r)
Definition: sca.cc:1397
bool id_IsBiHomogeneous(const ideal id, const intvec *wx, const intvec *wy, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.cc:1373
ideal id_KillSquares ( const ideal  id,
const short  iFirstAltVar,
const short  iLastAltVar,
const ring  r,
const bool  bSkipZeroes = false 
)

Definition at line 1534 of file sca.cc.

1537 {
1538  if (id == NULL) return id; // zero ideal
1539 
1540  assume( (iFirstAltVar >= 1) && (iLastAltVar <= rVar(r)) && (iFirstAltVar <= iLastAltVar) );
1541 
1542  const int iSize = IDELEMS(id);
1543 
1544  if (iSize == 0) return id;
1545 
1546  ideal temp = idInit(iSize, id->rank);
1547 
1548 #if 0
1549  PrintS("<id_KillSquares>\n");
1550  {
1551  PrintS("ideal id: \n");
1552  for (unsigned int i = 0; i < IDELEMS(id); i++)
1553  {
1554  Print("; id[%d] = ", i+1);
1555  p_Write(id->m[i], r);
1556  }
1557  PrintS(";\n");
1558  PrintLn();
1559  }
1560 #endif
1561 
1562 
1563  for (int j = 0; j < iSize; j++)
1564  temp->m[j] = p_KillSquares(id->m[j], iFirstAltVar, iLastAltVar, r);
1565 
1566  if( bSkipZeroes )
1567  idSkipZeroes(temp);
1568 
1569 #if 0
1570  PrintS("<id_KillSquares>\n");
1571  {
1572  PrintS("ideal temp: \n");
1573  for (int i = 0; i < IDELEMS(temp); i++)
1574  {
1575  Print("; temp[%d] = ", i+1);
1576  p_Write(temp->m[i], r);
1577  }
1578  PrintS(";\n");
1579  PrintLn();
1580  }
1581  PrintS("</id_KillSquares>\n");
1582 #endif
1583 
1584 // temp->rank = idRankFreeModule(temp, r);
1585 
1586  return temp;
1587 }
void PrintLn()
Definition: reporter.cc:327
#define Print
Definition: emacs.cc:83
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
poly p_KillSquares(const poly p, const short iFirstAltVar, const short iLastAltVar, const ring r)
Definition: sca.cc:1479
const ring r
Definition: syzextra.cc:208
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
#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
intvec* ivGetSCAXVarWeights ( const ring  r)

Definition at line 1397 of file sca.cc.

1398 {
1399  const unsigned int N = r->N;
1400 
1401  const int CommutativeVariable = 0; // bug correction!
1402  const int AntiCommutativeVariable = 0;
1403 
1404  intvec* w = new intvec(N, 1, CommutativeVariable);
1405 
1406  if(AntiCommutativeVariable != CommutativeVariable)
1407  if( rIsSCA(r) )
1408  {
1409  const unsigned int m_iFirstAltVar = scaFirstAltVar(r);
1410  const unsigned int m_iLastAltVar = scaLastAltVar(r);
1411 
1412  for (unsigned int i = m_iFirstAltVar; i<= m_iLastAltVar; i++)
1413  {
1414  (*w)[i-1] = AntiCommutativeVariable;
1415  }
1416  }
1417 
1418  return w;
1419 }
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
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
intvec* ivGetSCAYVarWeights ( const ring  r)

Definition at line 1425 of file sca.cc.

1426 {
1427  const unsigned int N = r->N;
1428 
1429  const int CommutativeVariable = 0;
1430  const int AntiCommutativeVariable = 1;
1431 
1432  intvec* w = new intvec(N, 1, CommutativeVariable);
1433 
1434  if(AntiCommutativeVariable != CommutativeVariable)
1435  if( rIsSCA(r) )
1436  {
1437  const unsigned int m_iFirstAltVar = scaFirstAltVar(r);
1438  const unsigned int m_iLastAltVar = scaLastAltVar(r);
1439 
1440  for (unsigned int i = m_iFirstAltVar; i<= m_iLastAltVar; i++)
1441  {
1442  (*w)[i-1] = AntiCommutativeVariable;
1443  }
1444  }
1445  return w;
1446 }
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
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
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 1334 of file sca.cc.

1339 {
1340  if( p == NULL )
1341  {
1342  dx = 0;
1343  dy = 0;
1344  return true;
1345  }
1346 
1347  poly q = p;
1348 
1349 
1350  int ddx, ddy;
1351 
1352  m_GetBiDegree( q, wx, wy, wCx, wCy, ddx, ddy, r); // get bi degree of lm(p)
1353 
1354  pIter(q);
1355 
1356  for(; q != NULL; pIter(q) )
1357  {
1358  int x, y;
1359 
1360  m_GetBiDegree( q, wx, wy, wCx, wCy, x, y, r); // get bi degree of q
1361 
1362  if ( (x != ddx) || (y != ddy) ) return false;
1363  }
1364 
1365  dx = ddx;
1366  dy = ddy;
1367 
1368  return true;
1369 }
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:1289
static bool p_IsSCAHomogeneous ( const poly  p,
const intvec wCx,
const intvec wCy,
const ring  r 
)
inlinestatic

Definition at line 96 of file sca.h.

99 {
100  // inefficient! don't use it in time-critical code!
103 
104  int x,y;
105 
106  bool homog = p_IsBiHomogeneous( p, wx, wy, wCx, wCy, x, y, r );
107 
108  delete wx;
109  delete wy;
110 
111  return homog;
112 }
const CanonicalForm int const CFList const Variable & y
Definition: facAbsFact.cc:57
return P p
Definition: myNF.cc:203
intvec * ivGetSCAYVarWeights(const ring r)
Definition: sca.cc:1425
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:16
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:1334
intvec * ivGetSCAXVarWeights(const ring r)
Definition: sca.cc:1397
Variable x
Definition: cfModGcd.cc:4023
poly p_KillSquares ( const poly  p,
const short  iFirstAltVar,
const short  iLastAltVar,
const ring  r 
)

Definition at line 1479 of file sca.cc.

1482 {
1483 #ifdef PDEBUG
1484  p_Test(p, r);
1485 
1486  assume( (iFirstAltVar >= 1) && (iLastAltVar <= r->N) && (iFirstAltVar <= iLastAltVar) );
1487 
1488 #if 0
1489  Print("p_KillSquares, p = "); // !
1490  p_Write(p, r);
1491 #endif
1492 #endif
1493 
1494 
1495  if( p == NULL )
1496  return NULL;
1497 
1498  poly pResult = NULL;
1499  poly* ppPrev = &pResult;
1500 
1501  for( poly q = p; q!= NULL; pIter(q) )
1502  {
1503 #ifdef PDEBUG
1504  p_Test(q, r);
1505 #endif
1506 
1507  // terms will be in the same order because of quasi-ordering!
1508  poly v = m_KillSquares(q, iFirstAltVar, iLastAltVar, r);
1509 
1510  if( v != NULL )
1511  {
1512  *ppPrev = v;
1513  ppPrev = &pNext(v);
1514  }
1515 
1516  }
1517 
1518 #ifdef PDEBUG
1519  p_Test(pResult, r);
1520 #if 0
1521  Print("p_KillSquares => "); // !
1522  p_Write(pResult, r);
1523 #endif
1524 #endif
1525 
1526  return(pResult);
1527 }
#define Print
Definition: emacs.cc:83
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:1453
#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:405
#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
bool sca_Force ( ring  rGR,
int  b,
int  e 
)

Definition at line 1175 of file sca.cc.

1176 {
1177  assume(rGR != NULL);
1178  assume(rIsPluralRing(rGR));
1179  assume(!rIsSCA(rGR));
1180 
1181  const int N = rGR->N;
1182 
1183 // ring rSaveRing = currRing;
1184 // if(rSaveRing != rGR)
1185 // rChangeCurrRing(rGR);
1186 
1187  const ideal idQuotient = rGR->qideal;
1188 
1189  ideal tempQ = idQuotient;
1190 
1191  if( b <= N && e >= 1 )
1192  tempQ = id_KillSquares(idQuotient, b, e, rGR);
1193 
1194  idSkipZeroes( tempQ );
1195 
1196  ncRingType( rGR, nc_exterior );
1197 
1198  if( idIs0(tempQ) )
1199  rGR->GetNC()->SCAQuotient() = NULL;
1200  else
1201  rGR->GetNC()->SCAQuotient() = tempQ;
1202 
1203 
1204  scaFirstAltVar( rGR, b );
1205  scaLastAltVar( rGR, e );
1206 
1207 
1208  nc_p_ProcsSet(rGR, rGR->p_Procs);
1209 
1210 // if(rSaveRing != rGR)
1211 // rChangeCurrRing(rSaveRing);
1212 
1213  return true;
1214 }
void nc_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: old.gring.cc:3264
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:361
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
#define assume(x)
Definition: mod2.h:405
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:1534
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
void sca_p_ProcsSet ( ring  rGR,
p_Procs_s p_Procs 
)

Definition at line 1239 of file sca.cc.

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

Definition at line 1217 of file sca.cc.

1218 {
1219  assume(1 <= i);
1220  assume(i <= rVar(rRing));
1221 
1222  if(rIsSCA(rRing))
1223  return sca_xi_Mult_pp(i, pPoly, rRing);
1224 
1225 
1226 
1227  poly xi = p_One( rRing);
1228  p_SetExp(xi, i, 1, rRing);
1229  p_Setm(xi, rRing);
1230 
1231  poly pResult = pp_Mult_qq(xi, pPoly, rRing);
1232 
1233  p_Delete( &xi, rRing);
1234 
1235  return pResult;
1236 
1237 }
static poly sca_xi_Mult_pp(short i, const poly pPoly, const ring rRing)
Definition: sca.cc:534
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:540
poly p_One(const ring r)
Definition: p_polys.cc:1318
#define assume(x)
Definition: mod2.h:405
static poly pp_Mult_qq(poly p, poly q, const ring r)
Definition: p_polys.h:1075
int i
Definition: cfEzgcd.cc:123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
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 bool rIsSCA(const ring r)
Definition: nc.h:206
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
polyrec * poly
Definition: hilb.h:10
bool sca_SetupQuotient ( ring  rGR,
ring  rG,
bool  bCopy 
)

Definition at line 923 of file sca.cc.

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

Definition at line 18 of file sca.h.

19 {
20  assume(rIsSCA(r));
21 
22  return (r->GetNC()->FirstAltVar());
23 }
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static bool rIsSCA(const ring r)
Definition: nc.h:206
static void scaFirstAltVar ( ring  r,
short  n 
)
inlinestatic

Definition at line 34 of file sca.h.

35 {
36  assume(rIsSCA(r));
37 
38  r->GetNC()->FirstAltVar() = n;
39 }
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static bool rIsSCA(const ring r)
Definition: nc.h:206
static short scaLastAltVar ( ring  r)
inlinestatic

Definition at line 25 of file sca.h.

26 {
27  assume(rIsSCA(r));
28 
29  return (r->GetNC()->LastAltVar());
30 }
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static bool rIsSCA(const ring r)
Definition: nc.h:206
static void scaLastAltVar ( ring  r,
short  n 
)
inlinestatic

Definition at line 41 of file sca.h.

42 {
43  assume(rIsSCA(r));
44 
45  r->GetNC()->LastAltVar() = n;
46 }
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static bool rIsSCA(const ring r)
Definition: nc.h:206
ideal SCAQuotient ( const ring  r)
inline

Definition at line 10 of file sca.h.

11 {
12  assume(rIsSCA(r));
13  return r->GetNC()->SCAQuotient();
14 }
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static bool rIsSCA(const ring r)
Definition: nc.h:206