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

§ 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_IsSCAHomogeneous()

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:1424
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
intvec * ivGetSCAXVarWeights(const ring r)
Definition: sca.cc:1396
bool id_IsBiHomogeneous(const ideal id, const intvec *wx, const intvec *wy, const intvec *wCx, const intvec *wCy, const ring r)
Definition: sca.cc:1372

§ id_KillSquares()

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

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:583
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:394
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

§ 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_IsSCAHomogeneous()

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:1424
const ring r
Definition: syzextra.cc:208
Definition: intvec.h:14
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
intvec * ivGetSCAXVarWeights(const ring r)
Definition: sca.cc:1396
Variable x
Definition: cfModGcd.cc:4023

§ 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:394
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:394
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_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:750
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:384
static p_Procs_s * _p_procs
Definition: p_Procs_Set.h:113

§ 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:583
poly p_One(const ring r)
Definition: p_polys.cc:1312
#define assume(x)
Definition: mod2.h:394
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_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:123
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:121
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:394
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:120
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

§ scaFirstAltVar() [1/2]

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:394
static bool rIsSCA(const ring r)
Definition: nc.h:206

§ scaFirstAltVar() [2/2]

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:394
static bool rIsSCA(const ring r)
Definition: nc.h:206

§ scaLastAltVar() [1/2]

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:394
static bool rIsSCA(const ring r)
Definition: nc.h:206

§ scaLastAltVar() [2/2]

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:394
static bool rIsSCA(const ring r)
Definition: nc.h:206

§ SCAQuotient()

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:394
static bool rIsSCA(const ring r)
Definition: nc.h:206