Macros | Functions | Variables
ring.cc File Reference
#include <math.h>
#include <omalloc/omalloc.h>
#include <misc/auxiliary.h>
#include <misc/mylimits.h>
#include <misc/options.h>
#include <misc/int64vec.h>
#include <coeffs/numbers.h>
#include <coeffs/coeffs.h>
#include <polys/monomials/p_polys.h>
#include <polys/simpleideals.h>
#include <polys/monomials/ring.h>
#include <polys/monomials/maps.h>
#include <polys/prCopy.h>
#include <polys/templates/p_Procs.h>
#include <polys/matpol.h>
#include <polys/nc/nc.h>
#include <polys/nc/sca.h>
#include "ext_fields/algext.h"
#include "ext_fields/transext.h"
#include <ctype.h>

Go to the source code of this file.

Macros

#define BITS_PER_LONG   8*SIZEOF_LONG
 
#define MYTEST   0
 
#define pFDeg_CASE(A)   if(r->pFDeg == A) PrintS( "" #A "" )
 
#define rOppVar(R, I)   (rVar(R)+1-I)
 

Functions

const char * rSimpleOrdStr (int ord)
 
void rDelete (ring r)
 unconditionally deletes fields in r More...
 
static void rSetVarL (ring r)
 set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex More...
 
static unsigned long rGetDivMask (int bits)
 get r->divmask depending on bits per exponent More...
 
static void rRightAdjustVarOffset (ring r)
 right-adjust r->VarOffset More...
 
static void rOptimizeLDeg (ring r)
 
ring rDefault (const coeffs cf, int N, char **n, int ord_size, int *ord, int *block0, int *block1, int **wvhdl)
 
ring rDefault (int ch, int N, char **n, int ord_size, int *ord, int *block0, int *block1, int **wvhdl)
 
ring rDefault (const coeffs cf, int N, char **n)
 
ring rDefault (int ch, int N, char **n)
 
BOOLEAN rCheckIV (intvec *iv)
 
int rTypeOfMatrixOrder (intvec *order)
 
int r_IsRingVar (const char *n, char **names, int N)
 
void rWrite (ring r, BOOLEAN details)
 
int rOrderName (char *ordername)
 
char * rOrdStr (ring r)
 
char * rVarStr (ring r)
 
char * rCharStr (const ring r)
 TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar. More...
 
char * rParStr (ring r)
 
char * rString (ring r)
 
int rChar (ring r)
 
ring nc_rCreateNCcomm_rCopy (ring r)
 
int rSumInternal (ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp)
 
int rSum (ring r1, ring r2, ring &sum)
 
ring rCopy0 (const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
 
ring rCopy0AndAddA (const ring r, int64vec *wv64, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
 
ring rCopy (ring r)
 
BOOLEAN rEqual (ring r1, ring r2, BOOLEAN qr)
 returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise, if qr == 1, then qrideal equality is tested, as well More...
 
BOOLEAN rSamePolyRep (ring r1, ring r2)
 returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analogue to rEqual but not so strict More...
 
rOrderType_t rGetOrderType (ring r)
 
BOOLEAN rHas_c_Ordering (const ring r)
 
BOOLEAN rHasSimpleOrder (const ring r)
 
BOOLEAN rHasSimpleLexOrder (const ring r)
 returns TRUE, if simple lp or ls ordering More...
 
BOOLEAN rOrder_is_DegOrdering (const rRingOrder_t order)
 
BOOLEAN rOrder_is_WeightedOrdering (rRingOrder_t order)
 
BOOLEAN rHasSimpleOrderAA (ring r)
 
BOOLEAN rOrd_SetCompRequiresSetm (const ring r)
 return TRUE if p_SetComp requires p_Setm More...
 
BOOLEAN rOrd_is_Totaldegree_Ordering (const ring r)
 
BOOLEAN rOrd_is_WeightedDegree_Ordering (const ring r)
 
BOOLEAN rIsPolyVar (int v, const ring r)
 returns TRUE if var(i) belongs to p-block More...
 
BOOLEAN rDBTest (ring r, const char *fn, const int l)
 
static void rO_Align (int &place, int &bitplace)
 
static void rO_TDegree (int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
 
static void rO_TDegree_neg (int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
 
static void rO_WDegree (int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
 
static void rO_WMDegree (int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
 
static void rO_WDegree64 (int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int64 *weights)
 
static void rO_WDegree_neg (int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
 
static void rO_LexVars (int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
 
static void rO_LexVars_neg (int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
 
static void rO_Syzcomp (int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
 
static void rO_Syz (int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
 
static void rO_ISPrefix (int &place, int &bitplace, int &prev_ord, long *o, int, int *v, sro_ord &ord_struct)
 
static void rO_ISSuffix (int &place, int &bitplace, int &prev_ord, long *o, int N, int *v, sro_ord *tmp_typ, int &typ_i, int sgn)
 
static unsigned long rGetExpSize (unsigned long bitmask, int &bits)
 
static unsigned long rGetExpSize (unsigned long bitmask, int &bits, int N)
 
ring rModifyRing (ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
 
ring rModifyRing_Wp (ring r, int *weights)
 construct Wp, C ring More...
 
ring rModifyRing_Simple (ring r, BOOLEAN ommit_degree, BOOLEAN ommit_comp, unsigned long exp_limit, BOOLEAN &simple)
 
void rKillModifiedRing_Simple (ring r)
 
void rKillModifiedRing (ring r)
 
void rKillModified_Wp_Ring (ring r)
 
static void rSetOutParams (ring r)
 
static void rHighSet (ring r, int o_r, int o)
 
static void rSetFirstWv (ring r, int i, int *order, int *block1, int **wvhdl)
 
static void rSetDegStuff (ring r)
 
static void rSetNegWeight (ring r)
 
static void rSetOption (ring r)
 
static void rCheckOrdSgn (ring r, int i)
 
void p_SetGlobals (const ring r, BOOLEAN complete)
 set all properties of a new ring - also called by rComplete More...
 
static int sign (int x)
 
BOOLEAN rOrd_is_MixedDegree_Ordering (ring r)
 
BOOLEAN rComplete (ring r, int force)
 this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffset), unless they already exist with force == 1, new fields are always created (overwritten), even if they exist More...
 
void rUnComplete (ring r)
 
void rDebugPrint (ring r)
 
void p_DebugPrint (poly p, const ring r)
 
static void m_DebugPrint (const poly p, const ring R)
 debug-print monomial poly/vector p, assuming that it lives in the ring R More...
 
void p_DebugPrint (const poly p, const ring lmRing, const ring tailRing, const int nTerms)
 debug-print at most nTerms (2 by default) terms from poly/vector p, assuming that lt(p) lives in lmRing and tail(p) lives in tailRing. More...
 
void pISUpdateComponents (ideal F, const intvec *const V, const int MIN, const ring r)
 
static void rNChangeSComps (int *currComponents, long *currShiftedComponents, ring r)
 
static void rNGetSComps (int **currComponents, long **currShiftedComponents, ring r)
 
static void rDBChangeSComps (int *currComponents, long *currShiftedComponents, int length, ring r)
 
static void rDBGetSComps (int **currComponents, long **currShiftedComponents, int *length, ring r)
 
void rChangeSComps (int *currComponents, long *currShiftedComponents, int length, ring r)
 
void rGetSComps (int **currComponents, long **currShiftedComponents, int *length, ring r)
 
ring rAssure_SyzComp (const ring r, BOOLEAN complete)
 
ring rAssure_TDeg (ring r, int start_var, int end_var, int &pos)
 
ring rAssure_HasComp (const ring r)
 
ring rAssure_CompLastBlock (ring r, BOOLEAN complete)
 makes sure that c/C ordering is last ordering More...
 
ring rAssure_SyzComp_CompLastBlock (const ring r, BOOLEAN)
 makes sure that c/C ordering is last ordering and SyzIndex is first More...
 
static ring rAssure_Global (rRingOrder_t b1, rRingOrder_t b2, const ring r)
 
ring rAssure_InducedSchreyerOrdering (const ring r, BOOLEAN complete=TRUE, int sgn=1)
 
ring rAssure_dp_S (const ring r)
 
ring rAssure_dp_C (const ring r)
 
ring rAssure_C_dp (const ring r)
 
int rGetISPos (const int p, const ring r)
 Finds p^th IS ordering, and returns its position in r->typ[] returns -1 if something went wrong! p - starts with 0! More...
 
BOOLEAN rSetISReference (const ring r, const ideal F, const int i, const int p)
 Changes r by setting induced ordering parameters: limit and reference leading terms F belong to r, we will DO a copy! We will use it AS IS! returns true is everything was allright! More...
 
void rSetSyzComp (int k, const ring r)
 
int rGetMaxSyzComp (int i, const ring r)
 return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit More...
 
BOOLEAN rRing_is_Homog (ring r)
 
BOOLEAN rRing_has_CompLastBlock (ring r)
 
n_coeffType rFieldType (ring r)
 
int64rGetWeightVec (ring r)
 
void rSetWeightVec (ring r, int64 *wv)
 
static int rRealloc1 (ring r, int size, int pos)
 
static void rOppWeight (int *w, int l)
 
ring rOpposite (ring src)
 
ring rEnvelope (ring R)
 
BOOLEAN nc_rComplete (const ring src, ring dest, bool bSetupQuotient)
 
void rModify_a_to_A (ring r)
 
poly rGetVar (const int varIndex, const ring r)
 
int n_IsParam (const number m, const ring r)
 TODO: rewrite somehow... More...
 

Variables

omBin sip_sring_bin = omGetSpecBin(sizeof(ip_sring))
 
omBin char_ptr_bin = omGetSpecBin(sizeof(char*))
 
static const char *const ringorder_name []
 
int pDBsyzComp =0
 

Macro Definition Documentation

#define BITS_PER_LONG   8*SIZEOF_LONG

Definition at line 52 of file ring.cc.

#define MYTEST   0

Definition at line 2310 of file ring.cc.

#define pFDeg_CASE (   A)    if(r->pFDeg == A) PrintS( "" #A "" )
#define rOppVar (   R,
 
)    (rVar(R)+1-I)

Definition at line 5155 of file ring.cc.

Function Documentation

static void m_DebugPrint ( const poly  p,
const ring  R 
)
inlinestatic

debug-print monomial poly/vector p, assuming that it lives in the ring R

Definition at line 4199 of file ring.cc.

4200 {
4201  Print("\nexp[0..%d]\n", R->ExpL_Size - 1);
4202  for(int i = 0; i < R->ExpL_Size; i++)
4203  Print("%09lx ", p->exp[i]);
4204  PrintLn();
4205  Print("v0:%9ld ", p_GetComp(p, R));
4206  for(int i = 1; i <= R->N; i++) Print(" v%d:%5ld",i, p_GetExp(p, i, R));
4207  PrintLn();
4208 }
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent : the integer VarOffset encodes:
Definition: p_polys.h:465
int i
Definition: cfEzgcd.cc:123
#define R
Definition: sirandom.c:26
int n_IsParam ( const number  m,
const ring  r 
)

TODO: rewrite somehow...

if m == var(i)/1 => return i,

Definition at line 5610 of file ring.cc.

5611 {
5612  assume(r != NULL);
5613  const coeffs C = r->cf;
5614  assume(C != NULL);
5615 
5617 
5618  const n_coeffType _filed_type = getCoeffType(C);
5619 
5620  if( _filed_type == n_algExt )
5621  return naIsParam(m, C);
5622 
5623  if( _filed_type == n_transExt )
5624  return ntIsParam(m, C);
5625 
5626  Werror("n_IsParam: IsParam is not to be used for (coeff_type = %d)",getCoeffType(C));
5627 
5628  return 0;
5629 }
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:37
const ring r
Definition: syzextra.cc:208
int naIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
Definition: algext.cc:1112
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
int m
Definition: cfEzgcd.cc:119
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
n_coeffType
Definition: coeffs.h:26
#define NULL
Definition: omList.c:10
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic ...
Definition: coeffs.h:34
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:839
int ntIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
Definition: transext.cc:2074
void Werror(const char *fmt,...)
Definition: reporter.cc:199
BOOLEAN nc_rComplete ( const ring  src,
ring  dest,
bool  bSetupQuotient 
)

Definition at line 5499 of file ring.cc.

5504 {
5505 // NOTE: Originally used only by idElimination to transfer NC structure to dest
5506 // ring created by dirty hack (without nc_CallPlural)
5507  rTest(src);
5508 
5509  assume(!rIsPluralRing(dest)); // destination must be a newly constructed commutative ring
5510 
5511  if (!rIsPluralRing(src))
5512  {
5513  return FALSE;
5514  }
5515 
5516  const int N = dest->N;
5517 
5518  assume(src->N == N);
5519 
5520 // ring save = currRing;
5521 
5522 // if (dest != save)
5523 // rChangeCurrRing(dest);
5524 
5525  const ring srcBase = src;
5526 
5527  assume( n_SetMap(srcBase->cf,dest->cf) == n_SetMap(dest->cf,dest->cf) ); // currRing is important here!
5528 
5529  matrix C = mpNew(N,N); // ring independent
5530  matrix D = mpNew(N,N);
5531 
5532  matrix C0 = src->GetNC()->C;
5533  matrix D0 = src->GetNC()->D;
5534 
5535  // map C and D into dest
5536  for (int i = 1; i < N; i++)
5537  {
5538  for (int j = i + 1; j <= N; j++)
5539  {
5540  const number n = n_Copy(p_GetCoeff(MATELEM(C0,i,j), srcBase), srcBase->cf); // src, mapping for coeffs into currRing = dest!
5541  const poly p = p_NSet(n, dest);
5542  MATELEM(C,i,j) = p;
5543  if (MATELEM(D0,i,j) != NULL)
5544  MATELEM(D,i,j) = prCopyR(MATELEM(D0,i,j), srcBase, dest); // ?
5545  }
5546  }
5547  /* One must test C and D _only_ in r->GetNC()->basering!!! not in r!!! */
5548 
5549  id_Test((ideal)C, dest);
5550  id_Test((ideal)D, dest);
5551 
5552  if (nc_CallPlural(C, D, NULL, NULL, dest, bSetupQuotient, false, true, dest)) // also takes care about quotient ideal
5553  {
5554  //WarnS("Error transferring non-commutative structure");
5555  // error message should be in the interpreter interface
5556 
5557  mp_Delete(&C, dest);
5558  mp_Delete(&D, dest);
5559 
5560 // if (currRing != save)
5561 // rChangeCurrRing(save);
5562 
5563  return TRUE;
5564  }
5565 
5566 // mp_Delete(&C, dest); // used by nc_CallPlural!
5567 // mp_Delete(&D, dest);
5568 
5569 // if (dest != save)
5570 // rChangeCurrRing(save);
5571 
5572  assume(rIsPluralRing(dest));
5573  return FALSE;
5574 }
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:36
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1448
#define id_Test(A, lR)
Definition: simpleideals.h:67
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define TRUE
Definition: auxiliary.h:144
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
#define rTest(r)
Definition: ring.h:769
int i
Definition: cfEzgcd.cc:123
void mp_Delete(matrix *a, const ring r)
Definition: matpol.cc:784
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:718
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type...
Definition: old.gring.cc:2734
#define NULL
Definition: omList.c:10
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:451
#define p_GetCoeff(p, r)
Definition: monomials.h:57
#define MATELEM(mat, i, j)
Definition: matpol.h:29
ring nc_rCreateNCcomm_rCopy ( ring  r)

Definition at line 692 of file ring.cc.

693 {
694  r = rCopy(r);
695  if (rIsPluralRing(r))
696  return r;
697 
698  matrix C = mpNew(r->N,r->N); // ring-independent!?!
699  matrix D = mpNew(r->N,r->N);
700 
701  for(int i=1; i<r->N; i++)
702  for(int j=i+1; j<=r->N; j++)
703  MATELEM(C,i,j) = p_One( r);
704 
705  if (nc_CallPlural(C, D, NULL, NULL, r, false, true, false, r/*??currRing??*/, TRUE)) // TODO: what about quotient ideal?
706  WarnS("Error initializing multiplication!"); // No reaction!???
707 
708  return r;
709 }
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
int j
Definition: myNF.cc:70
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
int i
Definition: cfEzgcd.cc:123
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type...
Definition: old.gring.cc:2734
ring rCopy(ring r)
Definition: ring.cc:1579
#define NULL
Definition: omList.c:10
#define MATELEM(mat, i, j)
Definition: matpol.h:29
void p_DebugPrint ( poly  p,
const ring  r 
)

Definition at line 4176 of file ring.cc.

4177 {
4178  int i,j;
4179  p_Write(p,r);
4180  j=2;
4181  while(p!=NULL)
4182  {
4183  Print("\nexp[0..%d]\n",r->ExpL_Size-1);
4184  for(i=0;i<r->ExpL_Size;i++)
4185  Print("%ld ",p->exp[i]);
4186  PrintLn();
4187  Print("v0:%ld ",p_GetComp(p, r));
4188  for(i=1;i<=r->N;i++) Print(" v%d:%ld",i,p_GetExp(p,i, r));
4189  PrintLn();
4190  pIter(p);
4191  j--;
4192  if (j==0) { PrintS("...\n"); break; }
4193  }
4194 }
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
#define p_GetComp(p, r)
Definition: monomials.h:72
#define pIter(p)
Definition: monomials.h:44
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:465
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define NULL
Definition: omList.c:10
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:204
void p_DebugPrint ( const poly  p,
const ring  lmRing,
const ring  tailRing,
const int  nTerms 
)

debug-print at most nTerms (2 by default) terms from poly/vector p, assuming that lt(p) lives in lmRing and tail(p) lives in tailRing.

Definition at line 4214 of file ring.cc.

4215 {
4216  assume( nTerms >= 0 );
4217  if( p != NULL )
4218  {
4219  assume( p != NULL );
4220 
4221  p_Write(p, lmRing, tailRing);
4222 
4223  if( (p != NULL) && (nTerms > 0) )
4224  {
4225  assume( p != NULL );
4226  assume( nTerms > 0 );
4227 
4228  // debug pring leading term
4229  m_DebugPrint(p, lmRing);
4230 
4231  poly q = pNext(p); // q = tail(p)
4232 
4233  // debug pring tail (at most nTerms-1 terms from it)
4234  for(int j = nTerms - 1; (q !=NULL) && (j > 0); pIter(q), --j)
4235  m_DebugPrint(q, tailRing);
4236 
4237  if (q != NULL)
4238  PrintS("...\n");
4239  }
4240  }
4241  else
4242  PrintS("0\n");
4243 }
BEGIN_NAMESPACE_SINGULARXX const ring lmRing
Definition: DebugPrint.h:30
return P p
Definition: myNF.cc:203
BEGIN_NAMESPACE_SINGULARXX const ring const ring tailRing
Definition: DebugPrint.h:30
static void m_DebugPrint(const poly p, const ring R)
debug-print monomial poly/vector p, assuming that it lives in the ring R
Definition: ring.cc:4199
#define pIter(p)
Definition: monomials.h:44
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
BEGIN_NAMESPACE_SINGULARXX const ring const ring const int nTerms
Definition: DebugPrint.h:30
void PrintS(const char *s)
Definition: reporter.cc:294
#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:204
void p_SetGlobals ( const ring  r,
BOOLEAN  complete 
)

set all properties of a new ring - also called by rComplete

Definition at line 3337 of file ring.cc.

3338 {
3339 // // // if (r->ppNoether!=NULL) p_Delete(&r->ppNoether,r); // ???
3340 
3341  r->pLexOrder=r->LexOrder;
3342  if (complete)
3343  {
3345  si_opt_1 |= r->options;
3346  }
3347 }
unsigned si_opt_1
Definition: options.c:5
const ring r
Definition: syzextra.cc:208
#define TEST_RINGDEP_OPTS
Definition: options.h:95
void pISUpdateComponents ( ideal  F,
const intvec *const  V,
const int  MIN,
const ring  r 
)

Definition at line 4249 of file ring.cc.

4250 {
4251  assume( V != NULL );
4252  assume( MIN >= 0 );
4253 
4254  if( F == NULL )
4255  return;
4256 
4257  for( int j = (F->ncols*F->nrows) - 1; j >= 0; j-- )
4258  {
4259 #ifdef PDEBUG
4260  Print("F[%d]:", j);
4261  p_DebugPrint(F->m[j], r, r, 0);
4262 #endif
4263 
4264  for( poly p = F->m[j]; p != NULL; pIter(p) )
4265  {
4266  int c = p_GetComp(p, r);
4267 
4268  if( c > MIN )
4269  {
4270 #ifdef PDEBUG
4271  Print("gen[%d] -> gen(%d)\n", c, MIN + (*V)[ c - MIN - 1 ]);
4272 #endif
4273 
4274  p_SetComp( p, MIN + (*V)[ c - MIN - 1 ], r );
4275  }
4276  }
4277 #ifdef PDEBUG
4278  Print("new F[%d]:", j);
4279  p_Test(F->m[j], r);
4280  p_DebugPrint(F->m[j], r, r, 0);
4281 #endif
4282  }
4283 
4284 }
void p_DebugPrint(poly p, const ring r)
Definition: ring.cc:4176
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:236
#define p_GetComp(p, r)
Definition: monomials.h:72
#define MIN(a, b)
Definition: omDebug.c:102
#define pIter(p)
Definition: monomials.h:44
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
#define p_Test(p, r)
Definition: p_polys.h:160
#define NULL
Definition: omList.c:10
int r_IsRingVar ( const char *  n,
char **  names,
int  N 
)

Definition at line 222 of file ring.cc.

223 {
224  if (names!=NULL)
225  {
226  for (int i=0; i<N; i++)
227  {
228  if (names[i]==NULL) return -1;
229  if (strcmp(n,names[i]) == 0) return (int)i;
230  }
231  }
232  return -1;
233 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
ring rAssure_C_dp ( const ring  r)

Definition at line 4863 of file ring.cc.

4864 {
4866 }
const ring r
Definition: syzextra.cc:208
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
Definition: ring.cc:4697
ring rAssure_CompLastBlock ( ring  r,
BOOLEAN  complete 
)

makes sure that c/C ordering is last ordering

Definition at line 4587 of file ring.cc.

4588 {
4589  int last_block = rBlocks(r) - 2;
4590  if (r->order[last_block] != ringorder_c &&
4591  r->order[last_block] != ringorder_C)
4592  {
4593  int c_pos = 0;
4594  int i;
4595 
4596  for (i=0; i< last_block; i++)
4597  {
4598  if (r->order[i] == ringorder_c || r->order[i] == ringorder_C)
4599  {
4600  c_pos = i;
4601  break;
4602  }
4603  }
4604  if (c_pos != -1)
4605  {
4606  ring new_r = rCopy0(r, FALSE, TRUE);
4607  for (i=c_pos+1; i<=last_block; i++)
4608  {
4609  new_r->order[i-1] = new_r->order[i];
4610  new_r->block0[i-1] = new_r->block0[i];
4611  new_r->block1[i-1] = new_r->block1[i];
4612  new_r->wvhdl[i-1] = new_r->wvhdl[i];
4613  }
4614  new_r->order[last_block] = r->order[c_pos];
4615  new_r->block0[last_block] = r->block0[c_pos];
4616  new_r->block1[last_block] = r->block1[c_pos];
4617  new_r->wvhdl[last_block] = r->wvhdl[c_pos];
4618  if (complete)
4619  {
4620  rComplete(new_r, 1);
4621 
4622 #ifdef HAVE_PLURAL
4623  if (rIsPluralRing(r))
4624  {
4625  if ( nc_rComplete(r, new_r, false) ) // no qideal!
4626  {
4627 #ifndef SING_NDEBUG
4628  WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4629 #endif
4630  }
4631  }
4632  assume(rIsPluralRing(r) == rIsPluralRing(new_r));
4633 #endif
4634  }
4635  return new_r;
4636  }
4637  }
4638  return r;
4639 }
#define FALSE
Definition: auxiliary.h:140
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1281
int i
Definition: cfEzgcd.cc:123
ring rAssure_dp_C ( const ring  r)

Definition at line 4858 of file ring.cc.

4859 {
4861 }
const ring r
Definition: syzextra.cc:208
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
Definition: ring.cc:4697
ring rAssure_dp_S ( const ring  r)

Definition at line 4853 of file ring.cc.

4854 {
4856 }
const ring r
Definition: syzextra.cc:208
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
Definition: ring.cc:4697
S?
Definition: ring.h:668
static ring rAssure_Global ( rRingOrder_t  b1,
rRingOrder_t  b2,
const ring  r 
)
static

Definition at line 4697 of file ring.cc.

4698 {
4699  int r_blocks = rBlocks(r);
4700 
4701  assume(b1 == ringorder_c || b1 == ringorder_C ||
4702  b2 == ringorder_c || b2 == ringorder_C ||
4703  b2 == ringorder_S);
4704  if ((r_blocks == 3) &&
4705  (r->order[0] == b1) &&
4706  (r->order[1] == b2) &&
4707  (r->order[2] == 0))
4708  return r;
4709  ring res = rCopy0(r, TRUE, FALSE);
4710  res->order = (int*)omAlloc0(3*sizeof(int));
4711  res->block0 = (int*)omAlloc0(3*sizeof(int));
4712  res->block1 = (int*)omAlloc0(3*sizeof(int));
4713  res->wvhdl = (int**)omAlloc0(3*sizeof(int*));
4714  res->order[0] = b1;
4715  res->order[1] = b2;
4716  if (b1 == ringorder_c || b1 == ringorder_C)
4717  {
4718  res->block0[1] = 1;
4719  res->block1[1] = r->N;
4720  }
4721  else
4722  {
4723  res->block0[0] = 1;
4724  res->block1[0] = r->N;
4725  }
4726  rComplete(res, 1);
4727 #ifdef HAVE_PLURAL
4728  if (rIsPluralRing(r))
4729  {
4730  if ( nc_rComplete(r, res, false) ) // no qideal!
4731  {
4732 #ifndef SING_NDEBUG
4733  WarnS("error in nc_rComplete");
4734 #endif
4735  }
4736  }
4737 #endif
4738 // rChangeCurrRing(res);
4739  return res;
4740 }
#define FALSE
Definition: auxiliary.h:140
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1281
S?
Definition: ring.h:668
#define omAlloc0(size)
Definition: omAllocDecl.h:211
ring rAssure_HasComp ( const ring  r)

Definition at line 4532 of file ring.cc.

4533 {
4534  int last_block;
4535  int i=0;
4536  do
4537  {
4538  if (r->order[i] == ringorder_c ||
4539  r->order[i] == ringorder_C) return r;
4540  if (r->order[i] == 0)
4541  break;
4542  i++;
4543  } while (1);
4544  //WarnS("re-creating ring with comps");
4545  last_block=i-1;
4546 
4547  ring new_r = rCopy0(r, FALSE, FALSE);
4548  i+=2;
4549  new_r->wvhdl=(int **)omAlloc0(i * sizeof(int *));
4550  new_r->order = (int *) omAlloc0(i * sizeof(int));
4551  new_r->block0 = (int *) omAlloc0(i * sizeof(int));
4552  new_r->block1 = (int *) omAlloc0(i * sizeof(int));
4553  memcpy(new_r->order,r->order,(i-1) * sizeof(int));
4554  memcpy(new_r->block0,r->block0,(i-1) * sizeof(int));
4555  memcpy(new_r->block1,r->block1,(i-1) * sizeof(int));
4556  for (int j=0; j<=last_block; j++)
4557  {
4558  if (r->wvhdl[j]!=NULL)
4559  {
4560  new_r->wvhdl[j] = (int*) omMemDup(r->wvhdl[j]);
4561  }
4562  }
4563  last_block++;
4564  new_r->order[last_block]=ringorder_C;
4565  //new_r->block0[last_block]=0;
4566  //new_r->block1[last_block]=0;
4567  //new_r->wvhdl[last_block]=NULL;
4568 
4569  rComplete(new_r, 1);
4570 
4571 #ifdef HAVE_PLURAL
4572  if (rIsPluralRing(r))
4573  {
4574  if ( nc_rComplete(r, new_r, false) ) // no qideal!
4575  {
4576 #ifndef SING_NDEBUG
4577  WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4578 #endif
4579  }
4580  }
4581  assume(rIsPluralRing(r) == rIsPluralRing(new_r));
4582 #endif
4583 
4584  return new_r;
4585 }
#define omMemDup(s)
Definition: omAllocDecl.h:264
#define FALSE
Definition: auxiliary.h:140
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
#define WarnS
Definition: emacs.cc:81
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1281
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211
ring rAssure_InducedSchreyerOrdering ( const ring  r,
BOOLEAN  complete = TRUE,
int  sgn = 1 
)

Definition at line 4742 of file ring.cc.

4743 { // TODO: ???? Add leading Syz-comp ordering here...????
4744 
4745 #if MYTEST
4746  Print("rAssure_InducedSchreyerOrdering(r, complete = %d, sgn = %d): r: \n", complete, sgn);
4747  rWrite(r);
4748 #ifdef RDEBUG
4749  rDebugPrint(r);
4750 #endif
4751  PrintLn();
4752 #endif
4753  assume((sgn == 1) || (sgn == -1));
4754 
4755  ring res=rCopy0(r, FALSE, FALSE); // No qideal & ordering copy.
4756 
4757  int n = rBlocks(r); // Including trailing zero!
4758 
4759  // Create 2 more blocks for prefix/suffix:
4760  res->order=(int *)omAlloc0((n+2)*sizeof(int)); // 0 .. n+1
4761  res->block0=(int *)omAlloc0((n+2)*sizeof(int));
4762  res->block1=(int *)omAlloc0((n+2)*sizeof(int));
4763  int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
4764 
4765  // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
4766  // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
4767 
4768  // new 1st block
4769  int j = 0;
4770  res->order[j] = ringorder_IS; // Prefix
4771  res->block0[j] = res->block1[j] = 0;
4772  // wvhdl[j] = NULL;
4773  j++;
4774 
4775  for(int i = 0; (i <= n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
4776  {
4777  res->order [j] = r->order [i];
4778  res->block0[j] = r->block0[i];
4779  res->block1[j] = r->block1[i];
4780 
4781  if (r->wvhdl[i] != NULL)
4782  {
4783  wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
4784  } // else wvhdl[j] = NULL;
4785  }
4786 
4787  // new last block
4788  res->order [j] = ringorder_IS; // Suffix
4789  res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
4790  // wvhdl[j] = NULL;
4791  j++;
4792 
4793  // res->order [j] = 0; // The End!
4794  res->wvhdl = wvhdl;
4795 
4796  // j == the last zero block now!
4797  assume(j == (n+1));
4798  assume(res->order[0]==ringorder_IS);
4799  assume(res->order[j-1]==ringorder_IS);
4800  assume(res->order[j]==0);
4801 
4802 
4803  if (complete)
4804  {
4805  rComplete(res, 1);
4806 
4807 #ifdef HAVE_PLURAL
4808  if (rIsPluralRing(r))
4809  {
4810  if ( nc_rComplete(r, res, false) ) // no qideal!
4811  {
4812 #ifndef SING_NDEBUG
4813  WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4814 #endif
4815  }
4816  }
4817  assume(rIsPluralRing(r) == rIsPluralRing(res));
4818 #endif
4819 
4820 
4821 #ifdef HAVE_PLURAL
4822  ring old_ring = r;
4823 #endif
4824 
4825  if (r->qideal!=NULL)
4826  {
4827  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
4828 
4829  assume(id_RankFreeModule(res->qideal, res) == 0);
4830 
4831 #ifdef HAVE_PLURAL
4832  if( rIsPluralRing(res) )
4833  if( nc_SetupQuotient(res, r, true) )
4834  {
4835 // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
4836  }
4837 
4838 #endif
4839  assume(id_RankFreeModule(res->qideal, res) == 0);
4840  }
4841 
4842 #ifdef HAVE_PLURAL
4843  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
4844  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
4845  assume(rIsSCA(res) == rIsSCA(old_ring));
4846  assume(ncRingType(res) == ncRingType(old_ring));
4847 #endif
4848  }
4849 
4850  return res;
4851 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define omMemDup(s)
Definition: omAllocDecl.h:264
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
int sgn(const Rational &a)
Definition: GMPrat.cc:437
#define FALSE
Definition: auxiliary.h:140
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
Definition: old.gring.cc:3475
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define WarnS
Definition: emacs.cc:81
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
void rDebugPrint(ring r)
Definition: ring.cc:3971
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1281
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:686
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
#define NULL
Definition: omList.c:10
static bool rIsSCA(const ring r)
Definition: nc.h:206
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
#define omAlloc0(size)
Definition: omAllocDecl.h:211
ring rAssure_SyzComp ( const ring  r,
BOOLEAN  complete 
)

Definition at line 4357 of file ring.cc.

4358 {
4359  if ( r->order[0] == ringorder_s ) return r;
4360 
4361  if ( r->order[0] == ringorder_IS )
4362  {
4363 #ifndef SING_NDEBUG
4364  WarnS("rAssure_SyzComp: input ring has an IS-ordering!");
4365 #endif
4366 // return r;
4367  }
4368  ring res=rCopy0(r, FALSE, FALSE);
4369  int i=rBlocks(r);
4370  int j;
4371 
4372  res->order=(int *)omAlloc((i+1)*sizeof(int));
4373  res->block0=(int *)omAlloc0((i+1)*sizeof(int));
4374  res->block1=(int *)omAlloc0((i+1)*sizeof(int));
4375  int ** wvhdl =(int **)omAlloc0((i+1)*sizeof(int**));
4376  for(j=i;j>0;j--)
4377  {
4378  res->order[j]=r->order[j-1];
4379  res->block0[j]=r->block0[j-1];
4380  res->block1[j]=r->block1[j-1];
4381  if (r->wvhdl[j-1] != NULL)
4382  {
4383  wvhdl[j] = (int*) omMemDup(r->wvhdl[j-1]);
4384  }
4385  }
4386  res->order[0]=ringorder_s;
4387 
4388  res->wvhdl = wvhdl;
4389 
4390  if (complete)
4391  {
4392  rComplete(res, 1);
4393 
4394 #ifdef HAVE_PLURAL
4395  if (rIsPluralRing(r))
4396  {
4397  if ( nc_rComplete(r, res, false) ) // no qideal!
4398  {
4399 #ifndef SING_NDEBUG
4400  WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4401 #endif
4402  }
4403  }
4404  assume(rIsPluralRing(r) == rIsPluralRing(res));
4405 #endif
4406 
4407 
4408 #ifdef HAVE_PLURAL
4409  ring old_ring = r;
4410 #endif
4411 
4412  if (r->qideal!=NULL)
4413  {
4414  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
4415 
4416  assume(id_RankFreeModule(res->qideal, res) == 0);
4417 
4418 #ifdef HAVE_PLURAL
4419  if( rIsPluralRing(res) )
4420  if( nc_SetupQuotient(res, r, true) )
4421  {
4422 // WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
4423  }
4424 
4425 #endif
4426  assume(id_RankFreeModule(res->qideal, res) == 0);
4427  }
4428 
4429 #ifdef HAVE_PLURAL
4430  assume((res->qideal==NULL) == (old_ring->qideal==NULL));
4431  assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
4432  assume(rIsSCA(res) == rIsSCA(old_ring));
4433  assume(ncRingType(res) == ncRingType(old_ring));
4434 #endif
4435  }
4436 
4437  return res;
4438 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define omMemDup(s)
Definition: omAllocDecl.h:264
#define FALSE
Definition: auxiliary.h:140
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
Definition: old.gring.cc:3475
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1281
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:686
#define NULL
Definition: omList.c:10
static bool rIsSCA(const ring r)
Definition: nc.h:206
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
s?
Definition: ring.h:669
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
#define omAlloc0(size)
Definition: omAllocDecl.h:211
ring rAssure_SyzComp_CompLastBlock ( const ring  r,
BOOLEAN   
)

makes sure that c/C ordering is last ordering and SyzIndex is first

? rChangeCurrRing(new_r);

Definition at line 4642 of file ring.cc.

4643 {
4644  rTest(r);
4645 
4646  ring new_r_1 = rAssure_CompLastBlock(r, FALSE); // due to this FALSE - no completion!
4647  ring new_r = rAssure_SyzComp(new_r_1, FALSE); // new_r_1 is used only here!!!
4648 
4649  if (new_r == r)
4650  return r;
4651 
4652  ring old_r = r;
4653  if (new_r_1 != new_r && new_r_1 != old_r) rDelete(new_r_1);
4654 
4655  rComplete(new_r, 1);
4656 #ifdef HAVE_PLURAL
4657  if (rIsPluralRing(old_r))
4658  {
4659  if ( nc_rComplete(old_r, new_r, false) ) // no qideal!
4660  {
4661 # ifndef SING_NDEBUG
4662  WarnS("error in nc_rComplete"); // cleanup? rDelete(res); return r; // just go on...?
4663 # endif
4664  }
4665  }
4666 #endif
4667 
4668 ///? rChangeCurrRing(new_r);
4669  if (old_r->qideal != NULL)
4670  {
4671  new_r->qideal = idrCopyR(old_r->qideal, old_r, new_r);
4672  }
4673 
4674 #ifdef HAVE_PLURAL
4675  if( rIsPluralRing(old_r) )
4676  if( nc_SetupQuotient(new_r, old_r, true) )
4677  {
4678 #ifndef SING_NDEBUG
4679  WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
4680 #endif
4681  }
4682 #endif
4683 
4684 #ifdef HAVE_PLURAL
4685  assume((new_r->qideal==NULL) == (old_r->qideal==NULL));
4686  assume(rIsPluralRing(new_r) == rIsPluralRing(old_r));
4687  assume(rIsSCA(new_r) == rIsSCA(old_r));
4688  assume(ncRingType(new_r) == ncRingType(old_r));
4689 #endif
4690 
4691  rTest(new_r);
4692  rTest(old_r);
4693  return new_r;
4694 }
#define FALSE
Definition: auxiliary.h:140
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
Definition: old.gring.cc:3475
#define WarnS
Definition: emacs.cc:81
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
#define assume(x)
Definition: mod2.h:405
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4357
#define rTest(r)
Definition: ring.h:769
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
Definition: ring.cc:4587
#define NULL
Definition: omList.c:10
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
static bool rIsSCA(const ring r)
Definition: nc.h:206
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:192
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
ring rAssure_TDeg ( ring  r,
int  start_var,
int  end_var,
int pos 
)

Definition at line 4440 of file ring.cc.

4441 {
4442  int i;
4443  if (r->typ!=NULL)
4444  {
4445  for(i=r->OrdSize-1;i>=0;i--)
4446  {
4447  if ((r->typ[i].ord_typ==ro_dp)
4448  && (r->typ[i].data.dp.start==start_var)
4449  && (r->typ[i].data.dp.end==end_var))
4450  {
4451  pos=r->typ[i].data.dp.place;
4452  //printf("no change, pos=%d\n",pos);
4453  return r;
4454  }
4455  }
4456  }
4457 
4458 #ifdef HAVE_PLURAL
4459  nc_struct* save=r->GetNC();
4460  r->GetNC()=NULL;
4461 #endif
4462  ring res=rCopy(r);
4463 
4464  i=rBlocks(r);
4465  int j;
4466 
4467  res->ExpL_Size=r->ExpL_Size+1; // one word more in each monom
4468  res->PolyBin=omGetSpecBin(POLYSIZE + (res->ExpL_Size)*sizeof(long));
4469  omFree((ADDRESS)res->ordsgn);
4470  res->ordsgn=(long *)omAlloc0(res->ExpL_Size*sizeof(long));
4471  for(j=0;j<r->CmpL_Size;j++)
4472  {
4473  res->ordsgn[j] = r->ordsgn[j];
4474  }
4475  res->OrdSize=r->OrdSize+1; // one block more for pSetm
4476  if (r->typ!=NULL)
4477  omFree((ADDRESS)res->typ);
4478  res->typ=(sro_ord*)omAlloc0(res->OrdSize*sizeof(sro_ord));
4479  if (r->typ!=NULL)
4480  memcpy(res->typ,r->typ,r->OrdSize*sizeof(sro_ord));
4481  // the additional block for pSetm: total degree at the last word
4482  // but not included in the compare part
4483  res->typ[res->OrdSize-1].ord_typ=ro_dp;
4484  res->typ[res->OrdSize-1].data.dp.start=start_var;
4485  res->typ[res->OrdSize-1].data.dp.end=end_var;
4486  res->typ[res->OrdSize-1].data.dp.place=res->ExpL_Size-1;
4487  pos=res->ExpL_Size-1;
4488  //if ((start_var==1) && (end_var==res->N)) res->pOrdIndex=pos;
4489  extern void p_Setm_General(poly p, ring r);
4490  res->p_Setm=p_Setm_General;
4491  // ----------------------------
4492  omFree((ADDRESS)res->p_Procs);
4493  res->p_Procs = (p_Procs_s*)omAlloc(sizeof(p_Procs_s));
4494 
4495  p_ProcsSet(res, res->p_Procs);
4496  if (res->qideal!=NULL) id_Delete(&res->qideal,res);
4497 #ifdef HAVE_PLURAL
4498  r->GetNC()=save;
4499  if (rIsPluralRing(r))
4500  {
4501  if ( nc_rComplete(r, res, false) ) // no qideal!
4502  {
4503 #ifndef SING_NDEBUG
4504  WarnS("error in nc_rComplete");
4505 #endif
4506  // just go on..
4507  }
4508  }
4509 #endif
4510  if (r->qideal!=NULL)
4511  {
4512  res->qideal=idrCopyR_NoSort(r->qideal,r, res);
4513 #ifdef HAVE_PLURAL
4514  if (rIsPluralRing(res))
4515  {
4516 // nc_SetupQuotient(res, currRing);
4517  nc_SetupQuotient(res, r); // ?
4518  }
4519  assume((res->qideal==NULL) == (r->qideal==NULL));
4520 #endif
4521  }
4522 
4523 #ifdef HAVE_PLURAL
4524  assume(rIsPluralRing(res) == rIsPluralRing(r));
4525  assume(rIsSCA(res) == rIsSCA(r));
4526  assume(ncRingType(res) == ncRingType(r));
4527 #endif
4528 
4529  return res;
4530 }
void p_Setm_General(poly p, const ring r)
Definition: p_polys.cc:163
return P p
Definition: myNF.cc:203
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
struct p_Procs_s p_Procs_s
Definition: ring.h:29
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
Definition: old.gring.cc:3475
void id_Delete(ideal *h, ring r)
void * ADDRESS
Definition: auxiliary.h:161
#define POLYSIZE
Definition: monomials.h:241
#define WarnS
Definition: emacs.cc:81
Definition: nc.h:83
#define omAlloc(size)
Definition: omAllocDecl.h:210
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
Definition: ring.h:180
int i
Definition: cfEzgcd.cc:123
#define omGetSpecBin(size)
Definition: omBin.h:11
ring rCopy(ring r)
Definition: ring.cc:1579
#define NULL
Definition: omList.c:10
void p_ProcsSet(ring r, p_Procs_s *p_Procs)
Definition: p_Procs_Set.h:139
static bool rIsSCA(const ring r)
Definition: nc.h:206
Definition: ring.h:60
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void rChangeSComps ( int currComponents,
long *  currShiftedComponents,
int  length,
ring  r 
)

Definition at line 4332 of file ring.cc.

4333 {
4334 #ifdef PDEBUG
4335  rDBChangeSComps(currComponents, currShiftedComponents, length, r);
4336 #else
4337  rNChangeSComps(currComponents, currShiftedComponents, r);
4338 #endif
4339 }
long * currShiftedComponents
Definition: syz1.cc:40
static void rDBChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition: ring.cc:4310
const ring r
Definition: syzextra.cc:208
static void rNChangeSComps(int *currComponents, long *currShiftedComponents, ring r)
Definition: ring.cc:4294
int rChar ( ring  r)

Definition at line 684 of file ring.cc.

684 { return r->cf->ch; }
const ring r
Definition: syzextra.cc:208
char* rCharStr ( const ring  r)

TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.

Definition at line 618 of file ring.cc.

618 { assume( r != NULL ); return nCoeffString(r->cf); }
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
static FORCE_INLINE char * nCoeffString(const coeffs cf)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar...
Definition: coeffs.h:958
BOOLEAN rCheckIV ( intvec iv)

Definition at line 185 of file ring.cc.

186 {
187  if ((iv->length()!=2)&&(iv->length()!=3))
188  {
189  WerrorS("weights only for orderings wp,ws,Wp,Ws,a,M");
190  return TRUE;
191  }
192  return FALSE;
193 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int length() const
Definition: intvec.h:85
void WerrorS(const char *s)
Definition: feFopen.cc:23
static void rCheckOrdSgn ( ring  r,
int  i 
)
static

Definition at line 3778 of file ring.cc.

3779 { // set r->OrdSgn, return, if already checked
3780  if (r->OrdSgn==-1) return;
3781  // for each variable:
3782  for(int i=1;i<=r->N;i++)
3783  {
3784  int found=0;
3785  // for all blocks:
3786  for(int j=0;(j<=b) && (found==0);j++)
3787  {
3788  // search the first block containing var(i)
3789  if ((r->block0[j]<=i)&&(r->block1[j]>=i))
3790  {
3791  // what kind if block is it?
3792  if ((r->order[j]==ringorder_ls)
3793  || (r->order[j]==ringorder_ds)
3794  || (r->order[j]==ringorder_Ds)
3795  || (r->order[j]==ringorder_ws)
3796  || (r->order[j]==ringorder_Ws)
3797  || (r->order[j]==ringorder_rs))
3798  {
3799  r->OrdSgn=-1;
3800  return;
3801  }
3802  if((r->order[j]==ringorder_a)
3803  ||(r->order[j]==ringorder_aa))
3804  {
3805  // <0: local/mixed ordering return
3806  // >0: var(i) is okay, look at other vars
3807  // ==0: look at other blocks for var(i)
3808  if(r->wvhdl[j][i-r->block0[j]]<0) { r->OrdSgn=-1; return;}
3809  if(r->wvhdl[j][i-r->block0[j]]>0) { found=1; break;}
3810  }
3811  }
3812  }
3813  }
3814  // no local var found in 1..N:
3815  //r->OrdSgn=1;
3816 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:684
opposite of ls
Definition: ring.h:685
bool found
Definition: facFactorize.cc:56
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
const poly b
Definition: syzextra.cc:213
BOOLEAN rComplete ( ring  r,
int  force 
)

this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffset), unless they already exist with force == 1, new fields are always created (overwritten), even if they exist

Definition at line 3371 of file ring.cc.

3372 {
3373  if (r->VarOffset!=NULL && force == 0) return FALSE;
3374  rSetOutParams(r);
3375  int n=rBlocks(r)-1;
3376  int i;
3377  int bits;
3378  r->bitmask=rGetExpSize(r->bitmask,bits,r->N);
3379  r->BitsPerExp = bits;
3380  r->ExpPerLong = BIT_SIZEOF_LONG / bits;
3381  r->divmask=rGetDivMask(bits);
3382  if (r->OrdSgn!=-1) r->OrdSgn=1; //rCheckOrdSgn will changed that, if needed
3383 
3384  // will be used for ordsgn:
3385  long *tmp_ordsgn=(long *)omAlloc0(3*(n+r->N)*sizeof(long));
3386  // will be used for VarOffset:
3387  int *v=(int *)omAlloc((r->N+1)*sizeof(int));
3388  for(i=r->N; i>=0 ; i--)
3389  {
3390  v[i]=-1;
3391  }
3392  sro_ord *tmp_typ=(sro_ord *)omAlloc0(3*(n+r->N)*sizeof(sro_ord));
3393  int typ_i=0;
3394  int prev_ordsgn=0;
3395 
3396  // fill in v, tmp_typ, tmp_ordsgn, determine typ_i (== ordSize)
3397  int j=0;
3398  int j_bits=BITS_PER_LONG;
3399 
3400  BOOLEAN need_to_add_comp=FALSE; // Only for ringorder_s and ringorder_S!
3401 
3402  for(i=0;i<n;i++)
3403  {
3404  tmp_typ[typ_i].order_index=i;
3405  switch (r->order[i])
3406  {
3407  case ringorder_a:
3408  case ringorder_aa:
3409  rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3410  r->wvhdl[i]);
3411  typ_i++;
3412  break;
3413 
3414  case ringorder_am:
3415  rO_WMDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3416  r->wvhdl[i]);
3417  typ_i++;
3418  break;
3419 
3420  case ringorder_a64:
3421  rO_WDegree64(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3422  tmp_typ[typ_i], (int64 *)(r->wvhdl[i]));
3423  typ_i++;
3424  break;
3425 
3426  case ringorder_c:
3427  rO_Align(j, j_bits);
3428  rO_LexVars_neg(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3429  break;
3430 
3431  case ringorder_C:
3432  rO_Align(j, j_bits);
3433  rO_LexVars(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3434  break;
3435 
3436  case ringorder_M:
3437  {
3438  int k,l;
3439  k=r->block1[i]-r->block0[i]+1; // number of vars
3440  for(l=0;l<k;l++)
3441  {
3442  rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3443  tmp_typ[typ_i],
3444  r->wvhdl[i]+(r->block1[i]-r->block0[i]+1)*l);
3445  typ_i++;
3446  }
3447  break;
3448  }
3449 
3450  case ringorder_lp:
3451  rO_LexVars(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3452  tmp_ordsgn,v,bits, -1);
3453  break;
3454 
3455  case ringorder_ls:
3456  rO_LexVars_neg(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3457  tmp_ordsgn,v, bits, -1);
3458  rCheckOrdSgn(r,i);
3459  break;
3460 
3461  case ringorder_rs:
3462  rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3463  tmp_ordsgn,v, bits, -1);
3464  rCheckOrdSgn(r,i);
3465  break;
3466 
3467  case ringorder_rp:
3468  rO_LexVars(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3469  tmp_ordsgn,v, bits, -1);
3470  break;
3471 
3472  case ringorder_dp:
3473  if (r->block0[i]==r->block1[i])
3474  {
3475  rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3476  tmp_ordsgn,v, bits, -1);
3477  }
3478  else
3479  {
3480  rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3481  tmp_typ[typ_i]);
3482  typ_i++;
3483  rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i]+1,
3484  prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3485  }
3486  break;
3487 
3488  case ringorder_Dp:
3489  if (r->block0[i]==r->block1[i])
3490  {
3491  rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3492  tmp_ordsgn,v, bits, -1);
3493  }
3494  else
3495  {
3496  rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3497  tmp_typ[typ_i]);
3498  typ_i++;
3499  rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3500  tmp_ordsgn,v, bits, r->block1[i]);
3501  }
3502  break;
3503 
3504  case ringorder_ds:
3505  if (r->block0[i]==r->block1[i])
3506  {
3507  rO_LexVars_neg(j, j_bits,r->block0[i],r->block1[i],prev_ordsgn,
3508  tmp_ordsgn,v,bits, -1);
3509  }
3510  else
3511  {
3512  rO_TDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3513  tmp_typ[typ_i]);
3514  typ_i++;
3515  rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i]+1,
3516  prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3517  }
3518  rCheckOrdSgn(r,i);
3519  break;
3520 
3521  case ringorder_Ds:
3522  if (r->block0[i]==r->block1[i])
3523  {
3524  rO_LexVars_neg(j, j_bits, r->block0[i],r->block0[i],prev_ordsgn,
3525  tmp_ordsgn,v, bits, -1);
3526  }
3527  else
3528  {
3529  rO_TDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3530  tmp_typ[typ_i]);
3531  typ_i++;
3532  rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3533  tmp_ordsgn,v, bits, r->block1[i]);
3534  }
3535  rCheckOrdSgn(r,i);
3536  break;
3537 
3538  case ringorder_wp:
3539  rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3540  tmp_typ[typ_i], r->wvhdl[i]);
3541  typ_i++;
3542  { // check for weights <=0
3543  int jj;
3544  BOOLEAN have_bad_weights=FALSE;
3545  for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3546  {
3547  if (r->wvhdl[i][jj]<=0) have_bad_weights=TRUE;
3548  }
3549  if (have_bad_weights)
3550  {
3551  rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3552  tmp_typ[typ_i]);
3553  typ_i++;
3554  rCheckOrdSgn(r,i);
3555  }
3556  }
3557  if (r->block1[i]!=r->block0[i])
3558  {
3559  rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3560  tmp_ordsgn, v,bits, r->block0[i]);
3561  }
3562  break;
3563 
3564  case ringorder_Wp:
3565  rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3566  tmp_typ[typ_i], r->wvhdl[i]);
3567  typ_i++;
3568  { // check for weights <=0
3569  int jj;
3570  BOOLEAN have_bad_weights=FALSE;
3571  for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3572  {
3573  if (r->wvhdl[i][jj]<=0) have_bad_weights=TRUE;
3574  }
3575  if (have_bad_weights)
3576  {
3577  rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3578  tmp_typ[typ_i]);
3579  typ_i++;
3580  rCheckOrdSgn(r,i);
3581  }
3582  }
3583  if (r->block1[i]!=r->block0[i])
3584  {
3585  rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3586  tmp_ordsgn,v, bits, r->block1[i]);
3587  }
3588  break;
3589 
3590  case ringorder_ws:
3591  rO_WDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3592  tmp_typ[typ_i], r->wvhdl[i]);
3593  typ_i++;
3594  if (r->block1[i]!=r->block0[i])
3595  {
3596  rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3597  tmp_ordsgn, v,bits, r->block0[i]);
3598  }
3599  rCheckOrdSgn(r,i);
3600  break;
3601 
3602  case ringorder_Ws:
3603  rO_WDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3604  tmp_typ[typ_i], r->wvhdl[i]);
3605  typ_i++;
3606  if (r->block1[i]!=r->block0[i])
3607  {
3608  rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3609  tmp_ordsgn,v, bits, r->block1[i]);
3610  }
3611  rCheckOrdSgn(r,i);
3612  break;
3613 
3614  case ringorder_S:
3615  assume(typ_i == 1); // For LaScala3 only: on the 2nd place ([1])!
3616  // TODO: for K[x]: it is 0...?!
3617  rO_Syzcomp(j, j_bits,prev_ordsgn, tmp_ordsgn,tmp_typ[typ_i]);
3618  need_to_add_comp=TRUE;
3619  typ_i++;
3620  break;
3621 
3622  case ringorder_s:
3623  assume(typ_i == 0 && j == 0);
3624  rO_Syz(j, j_bits, prev_ordsgn, tmp_ordsgn, tmp_typ[typ_i]); // set syz-limit?
3625  need_to_add_comp=TRUE;
3626  typ_i++;
3627  break;
3628 
3629  case ringorder_IS:
3630  {
3631 
3632  assume( r->block0[i] == r->block1[i] );
3633  const int s = r->block0[i];
3634  assume( -2 < s && s < 2);
3635 
3636  if(s == 0) // Prefix IS
3637  rO_ISPrefix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ[typ_i++]); // What about prev_ordsgn?
3638  else // s = +1 or -1 // Note: typ_i might be incrimented here inside!
3639  {
3640  rO_ISSuffix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ, typ_i, s); // Suffix.
3641  need_to_add_comp=FALSE;
3642  }
3643 
3644  break;
3645  }
3646  case ringorder_unspec:
3647  case ringorder_no:
3648  default:
3649  dReportError("undef. ringorder used\n");
3650  break;
3651  }
3652  }
3653 
3654  int j0=j; // save j
3655  int j_bits0=j_bits; // save jbits
3656  rO_Align(j,j_bits);
3657  r->CmpL_Size = j;
3658 
3659  j_bits=j_bits0; j=j0;
3660 
3661  // fill in some empty slots with variables not already covered
3662  // v0 is special, is therefore normally already covered
3663  // now we do have rings without comp...
3664  if((need_to_add_comp) && (v[0]== -1))
3665  {
3666  if (prev_ordsgn==1)
3667  {
3668  rO_Align(j, j_bits);
3669  rO_LexVars(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3670  }
3671  else
3672  {
3673  rO_Align(j, j_bits);
3674  rO_LexVars_neg(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3675  }
3676  }
3677  // the variables
3678  for(i=1 ; i<=r->N ; i++)
3679  {
3680  if(v[i]==(-1))
3681  {
3682  if (prev_ordsgn==1)
3683  {
3684  rO_LexVars(j, j_bits, i,i, prev_ordsgn,tmp_ordsgn,v,bits, -1);
3685  }
3686  else
3687  {
3688  rO_LexVars_neg(j,j_bits,i,i, prev_ordsgn,tmp_ordsgn,v,bits, -1);
3689  }
3690  }
3691  }
3692 
3693  rO_Align(j,j_bits);
3694  // ----------------------------
3695  // finished with constructing the monomial, computing sizes:
3696 
3697  r->ExpL_Size=j;
3698  r->PolyBin = omGetSpecBin(POLYSIZE + (r->ExpL_Size)*sizeof(long));
3699  assume(r->PolyBin != NULL);
3700 
3701  // ----------------------------
3702  // indices and ordsgn vector for comparison
3703  //
3704  // r->pCompHighIndex already set
3705  r->ordsgn=(long *)omAlloc0(r->ExpL_Size*sizeof(long));
3706 
3707  for(j=0;j<r->CmpL_Size;j++)
3708  {
3709  r->ordsgn[j] = tmp_ordsgn[j];
3710  }
3711 
3712  omFreeSize((ADDRESS)tmp_ordsgn,(3*(n+r->N)*sizeof(long)));
3713 
3714  // ----------------------------
3715  // description of orderings for setm:
3716  //
3717  r->OrdSize=typ_i;
3718  if (typ_i==0) r->typ=NULL;
3719  else
3720  {
3721  r->typ=(sro_ord*)omAlloc(typ_i*sizeof(sro_ord));
3722  memcpy(r->typ,tmp_typ,typ_i*sizeof(sro_ord));
3723  }
3724  omFreeSize((ADDRESS)tmp_typ,(3*(n+r->N)*sizeof(sro_ord)));
3725 
3726  // ----------------------------
3727  // indices for (first copy of ) variable entries in exp.e vector (VarOffset):
3728  r->VarOffset=v;
3729 
3730  // ----------------------------
3731  // other indicies
3732  r->pCompIndex=(r->VarOffset[0] & 0xffff); //r->VarOffset[0];
3733  i=0; // position
3734  j=0; // index in r->typ
3735  if (i==r->pCompIndex) i++; // IS???
3736  while ((j < r->OrdSize)
3737  && ((r->typ[j].ord_typ==ro_syzcomp) ||
3738  (r->typ[j].ord_typ==ro_syz) || (r->typ[j].ord_typ==ro_isTemp) || (r->typ[j].ord_typ==ro_is) ||
3739  (r->order[r->typ[j].order_index] == ringorder_aa)))
3740  {
3741  i++; j++;
3742  }
3743  // No use of j anymore!!!????
3744 
3745  if (i==r->pCompIndex) i++;
3746  r->pOrdIndex=i; // How came it is "i" here???!!!! exp[r->pOrdIndex] is order of a poly... This may be wrong!!! IS
3747 
3748  // ----------------------------
3749  rSetDegStuff(r);
3750  rSetOption(r);
3751  // ----------------------------
3752  // r->p_Setm
3753  r->p_Setm = p_GetSetmProc(r);
3754 
3755  // ----------------------------
3756  // set VarL_*
3757  rSetVarL(r);
3758 
3759  // ----------------------------
3760  // right-adjust VarOffset
3762 
3763  // ----------------------------
3764  // set NegWeightL*
3765  rSetNegWeight(r);
3766 
3767  // ----------------------------
3768  // p_Procs: call AFTER NegWeightL
3769  r->p_Procs = (p_Procs_s*)omAlloc(sizeof(p_Procs_s));
3770  p_ProcsSet(r, r->p_Procs);
3771 
3772  // use totaldegree on crazy oderings:
3773  if ((r->pFDeg==p_WTotaldegree) && rOrd_is_MixedDegree_Ordering(r))
3774  r->pFDeg = p_Totaldegree;
3775  return FALSE;
3776 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:684
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
const CanonicalForm int s
Definition: facAbsFact.cc:55
for int64 weights
Definition: ring.h:664
Definition: ring.h:68
static void rO_LexVars(int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
Definition: ring.cc:2201
int order_index
Definition: ring.h:183
static void rSetNegWeight(ring r)
Definition: ring.cc:3267
#define FALSE
Definition: auxiliary.h:140
static void rO_ISSuffix(int &place, int &bitplace, int &prev_ord, long *o, int N, int *v, sro_ord *tmp_typ, int &typ_i, int sgn)
Definition: ring.cc:2333
opposite of ls
Definition: ring.h:685
struct p_Procs_s p_Procs_s
Definition: ring.h:29
BOOLEAN rOrd_is_MixedDegree_Ordering(ring r)
Definition: ring.cc:3350
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
long int64
Definition: auxiliary.h:112
#define TRUE
Definition: auxiliary.h:144
static void rO_Syz(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
Definition: ring.cc:2292
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
static void rO_ISPrefix(int &place, int &bitplace, int &prev_ord, long *o, int, int *v, sro_ord &ord_struct)
Definition: ring.cc:2315
void * ADDRESS
Definition: auxiliary.h:161
#define POLYSIZE
Definition: monomials.h:241
int k
Definition: cfEzgcd.cc:93
#define omAlloc(size)
Definition: omAllocDecl.h:210
static void rSetOption(ring r)
Definition: ring.cc:3304
static void rSetDegStuff(ring r)
Definition: ring.cc:3107
static void rO_LexVars_neg(int &place, int &bitplace, int start, int end, int &prev_ord, long *o, int *v, int bits, int opt_var)
Definition: ring.cc:2238
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
static void rO_WMDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition: ring.cc:2135
static void rO_WDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition: ring.cc:2175
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
static void rO_TDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
Definition: ring.cc:2081
Definition: ring.h:180
static void rO_WDegree64(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int64 *weights)
Definition: ring.cc:2157
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:686
static void rO_Syzcomp(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
Definition: ring.cc:2277
S?
Definition: ring.h:668
static void rSetVarL(ring r)
set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex
Definition: ring.cc:3875
static void rSetOutParams(ring r)
Definition: ring.cc:2944
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
Definition: ring.cc:2424
Definition: ring.h:69
Definition: ring.h:69
p_SetmProc p_GetSetmProc(ring r)
Definition: p_polys.cc:559
#define omGetSpecBin(size)
Definition: omBin.h:11
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
static unsigned long rGetDivMask(int bits)
get r->divmask depending on bits per exponent
Definition: ring.cc:3957
static void rO_TDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
Definition: ring.cc:2067
#define NULL
Definition: omList.c:10
void p_ProcsSet(ring r, p_Procs_s *p_Procs)
Definition: p_Procs_Set.h:139
static void rO_WDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition: ring.cc:2095
static void rRightAdjustVarOffset(ring r)
right-adjust r->VarOffset
Definition: ring.cc:3931
#define BITS_PER_LONG
Definition: ring.cc:52
int dReportError(const char *fmt,...)
Definition: dError.cc:45
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:124
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:612
static void rCheckOrdSgn(ring r, int i)
Definition: ring.cc:3778
s?
Definition: ring.h:669
int BOOLEAN
Definition: auxiliary.h:131
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
ring rCopy ( ring  r)

Definition at line 1579 of file ring.cc.

1580 {
1581  if (r == NULL) return NULL;
1582  ring res=rCopy0(r,FALSE,TRUE);
1583  rComplete(res, 1); // res is purely commutative so far
1584  if (r->qideal!=NULL) res->qideal=idrCopyR_NoSort(r->qideal, r, res);
1585 
1586 #ifdef HAVE_PLURAL
1587  if (rIsPluralRing(r))
1588  if( nc_rCopy(res, r, true) ) {}
1589 #endif
1590 
1591  return res;
1592 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1281
bool nc_rCopy(ring res, const ring r, bool bSetupQuotient)
Definition: old.gring.cc:3075
#define NULL
Definition: omList.c:10
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
ring rCopy0 ( const ring  r,
BOOLEAN  copy_qideal,
BOOLEAN  copy_ordering 
)

Definition at line 1281 of file ring.cc.

1282 {
1283  if (r == NULL) return NULL;
1284  int i,j;
1285  ring res=(ring)omAllocBin(sip_sring_bin);
1286  memset(res,0,sizeof(ip_sring));
1287  //memcpy(res,r,sizeof(ip_sring));
1288  //memset: res->idroot=NULL; /* local objects */
1289  //ideal minideal;
1290  res->options=r->options; /* ring dependent options */
1291 
1292  //memset: res->ordsgn=NULL;
1293  //memset: res->typ=NULL;
1294  //memset: res->VarOffset=NULL;
1295  //memset: res->firstwv=NULL;
1296 
1297  //struct omBin PolyBin; /* Bin from where monoms are allocated */
1298  //memset: res->PolyBin=NULL; // rComplete
1299  res->cf=nCopyCoeff(r->cf); /* coeffs */
1300 
1301  //memset: res->ref=0; /* reference counter to the ring */
1302 
1303  res->N=rVar(r); /* number of vars */
1304  res->OrdSgn=r->OrdSgn; /* 1 for polynomial rings, -1 otherwise */
1305 
1306  res->firstBlockEnds=r->firstBlockEnds;
1307 #ifdef HAVE_PLURAL
1308  res->real_var_start=r->real_var_start;
1309  res->real_var_end=r->real_var_end;
1310 #endif
1311 
1312 #ifdef HAVE_SHIFTBBA
1313  res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
1314 #endif
1315 
1316  res->VectorOut=r->VectorOut;
1317  res->ShortOut=r->ShortOut;
1318  res->CanShortOut=r->CanShortOut;
1319  res->LexOrder=r->LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks
1320  res->MixedOrder=r->MixedOrder; // ?? 1 for lex ordering (except ls), -1 otherwise
1321  res->ComponentOrder=r->ComponentOrder;
1322 
1323  //memset: res->ExpL_Size=0;
1324  //memset: res->CmpL_Size=0;
1325  //memset: res->VarL_Size=0;
1326  //memset: res->pCompIndex=0;
1327  //memset: res->pOrdIndex=0;
1328  //memset: res->OrdSize=0;
1329  //memset: res->VarL_LowIndex=0;
1330  //memset: res->MinExpPerLong=0;
1331  //memset: res->NegWeightL_Size=0;
1332  //memset: res->NegWeightL_Offset=NULL;
1333  //memset: res->VarL_Offset=NULL;
1334 
1335  // the following are set by rComplete unless predefined
1336  // therefore, we copy these values: maybe they are non-standard
1337  /* mask for getting single exponents */
1338  res->bitmask=r->bitmask;
1339  res->divmask=r->divmask;
1340  res->BitsPerExp = r->BitsPerExp;
1341  res->ExpPerLong = r->ExpPerLong;
1342 
1343  //memset: res->p_Procs=NULL;
1344  //memset: res->pFDeg=NULL;
1345  //memset: res->pLDeg=NULL;
1346  //memset: res->pFDegOrig=NULL;
1347  //memset: res->pLDegOrig=NULL;
1348  //memset: res->p_Setm=NULL;
1349  //memset: res->cf=NULL;
1350 
1351 /*
1352  if (r->extRing!=NULL)
1353  r->extRing->ref++;
1354 
1355  res->extRing=r->extRing;
1356  //memset: res->qideal=NULL;
1357 */
1358 
1359 
1360  if (copy_ordering == TRUE)
1361  {
1362  i=rBlocks(r);
1363  res->wvhdl = (int **)omAlloc(i * sizeof(int *));
1364  res->order = (int *) omAlloc(i * sizeof(int));
1365  res->block0 = (int *) omAlloc(i * sizeof(int));
1366  res->block1 = (int *) omAlloc(i * sizeof(int));
1367  for (j=0; j<i; j++)
1368  {
1369  if (r->wvhdl[j]!=NULL)
1370  {
1371  res->wvhdl[j] = (int*) omMemDup(r->wvhdl[j]);
1372  }
1373  else
1374  res->wvhdl[j]=NULL;
1375  }
1376  memcpy(res->order,r->order,i * sizeof(int));
1377  memcpy(res->block0,r->block0,i * sizeof(int));
1378  memcpy(res->block1,r->block1,i * sizeof(int));
1379  }
1380  //memset: else
1381  //memset: {
1382  //memset: res->wvhdl = NULL;
1383  //memset: res->order = NULL;
1384  //memset: res->block0 = NULL;
1385  //memset: res->block1 = NULL;
1386  //memset: }
1387 
1388  res->names = (char **)omAlloc0(rVar(r) * sizeof(char *));
1389  for (i=0; i<rVar(res); i++)
1390  {
1391  res->names[i] = omStrDup(r->names[i]);
1392  }
1393  if (r->qideal!=NULL)
1394  {
1395  if (copy_qideal)
1396  {
1397  #ifndef SING_NDEBUG
1398  if (!copy_ordering)
1399  WerrorS("internal error: rCopy0(Q,TRUE,FALSE)");
1400  else
1401  #endif
1402  {
1403  #ifndef SING_NDEBUG
1404  WarnS("internal bad stuff: rCopy0(Q,TRUE,TRUE)");
1405  #endif
1406  rComplete(res);
1407  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
1408  rUnComplete(res);
1409  }
1410  }
1411  //memset: else res->qideal = NULL;
1412  }
1413  //memset: else res->qideal = NULL;
1414  //memset: res->GetNC() = NULL; // copy is purely commutative!!!
1415  return res;
1416 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
#define omMemDup(s)
Definition: omAllocDecl.h:264
void rUnComplete(ring r)
Definition: ring.cc:3818
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
Definition: ring.h:203
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
int j
Definition: myNF.cc:70
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition: coeffs.h:429
#define NULL
Definition: omList.c:10
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263
ring rCopy0AndAddA ( const ring  r,
int64vec wv64,
BOOLEAN  copy_qideal,
BOOLEAN  copy_ordering 
)

Definition at line 1423 of file ring.cc.

1424 {
1425  if (r == NULL) return NULL;
1426  int i,j;
1427  ring res=(ring)omAllocBin(sip_sring_bin);
1428  memset(res,0,sizeof(ip_sring));
1429  //memcpy(res,r,sizeof(ip_sring));
1430  //memset: res->idroot=NULL; /* local objects */
1431  //ideal minideal;
1432  res->options=r->options; /* ring dependent options */
1433 
1434  //memset: res->ordsgn=NULL;
1435  //memset: res->typ=NULL;
1436  //memset: res->VarOffset=NULL;
1437  //memset: res->firstwv=NULL;
1438 
1439  //struct omBin PolyBin; /* Bin from where monoms are allocated */
1440  //memset: res->PolyBin=NULL; // rComplete
1441  res->cf=nCopyCoeff(r->cf); /* coeffs */
1442 
1443  //memset: res->ref=0; /* reference counter to the ring */
1444 
1445  res->N=rVar(r); /* number of vars */
1446  res->OrdSgn=r->OrdSgn; /* 1 for polynomial rings, -1 otherwise */
1447 
1448  res->firstBlockEnds=r->firstBlockEnds;
1449 #ifdef HAVE_PLURAL
1450  res->real_var_start=r->real_var_start;
1451  res->real_var_end=r->real_var_end;
1452 #endif
1453 
1454 #ifdef HAVE_SHIFTBBA
1455  res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
1456 #endif
1457 
1458  res->VectorOut=r->VectorOut;
1459  res->ShortOut=r->ShortOut;
1460  res->CanShortOut=r->CanShortOut;
1461  res->LexOrder=r->LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks
1462  res->MixedOrder=r->MixedOrder; // ?? 1 for lex ordering (except ls), -1 otherwise
1463  res->ComponentOrder=r->ComponentOrder;
1464 
1465  //memset: res->ExpL_Size=0;
1466  //memset: res->CmpL_Size=0;
1467  //memset: res->VarL_Size=0;
1468  //memset: res->pCompIndex=0;
1469  //memset: res->pOrdIndex=0;
1470  //memset: res->OrdSize=0;
1471  //memset: res->VarL_LowIndex=0;
1472  //memset: res->MinExpPerLong=0;
1473  //memset: res->NegWeightL_Size=0;
1474  //memset: res->NegWeightL_Offset=NULL;
1475  //memset: res->VarL_Offset=NULL;
1476 
1477  // the following are set by rComplete unless predefined
1478  // therefore, we copy these values: maybe they are non-standard
1479  /* mask for getting single exponents */
1480  res->bitmask=r->bitmask;
1481  res->divmask=r->divmask;
1482  res->BitsPerExp = r->BitsPerExp;
1483  res->ExpPerLong = r->ExpPerLong;
1484 
1485  //memset: res->p_Procs=NULL;
1486  //memset: res->pFDeg=NULL;
1487  //memset: res->pLDeg=NULL;
1488  //memset: res->pFDegOrig=NULL;
1489  //memset: res->pLDegOrig=NULL;
1490  //memset: res->p_Setm=NULL;
1491  //memset: res->cf=NULL;
1492 
1493 /*
1494  if (r->extRing!=NULL)
1495  r->extRing->ref++;
1496 
1497  res->extRing=r->extRing;
1498  //memset: res->qideal=NULL;
1499 */
1500 
1501 
1502  if (copy_ordering == TRUE)
1503  {
1504  i=rBlocks(r)+1; // DIFF to rCopy0
1505  res->wvhdl = (int **)omAlloc(i * sizeof(int *));
1506  res->order = (int *) omAlloc(i * sizeof(int));
1507  res->block0 = (int *) omAlloc(i * sizeof(int));
1508  res->block1 = (int *) omAlloc(i * sizeof(int));
1509  for (j=0; j<i-1; j++)
1510  {
1511  if (r->wvhdl[j]!=NULL)
1512  {
1513  res->wvhdl[j+1] = (int*) omMemDup(r->wvhdl[j]); //DIFF
1514  }
1515  else
1516  res->wvhdl[j+1]=NULL; //DIFF
1517  }
1518  memcpy(&(res->order[1]),r->order,(i-1) * sizeof(int)); //DIFF
1519  memcpy(&(res->block0[1]),r->block0,(i-1) * sizeof(int)); //DIFF
1520  memcpy(&(res->block1[1]),r->block1,(i-1) * sizeof(int)); //DIFF
1521  }
1522  //memset: else
1523  //memset: {
1524  //memset: res->wvhdl = NULL;
1525  //memset: res->order = NULL;
1526  //memset: res->block0 = NULL;
1527  //memset: res->block1 = NULL;
1528  //memset: }
1529 
1530  //the added A
1531  res->order[0]=ringorder_a64;
1532  int length=wv64->rows();
1533  int64 *A=(int64 *)omAlloc(length*sizeof(int64));
1534  for(j=length-1;j>=0;j--)
1535  {
1536  A[j]=(*wv64)[j];
1537  }
1538  res->wvhdl[0]=(int *)A;
1539  res->block0[0]=1;
1540  res->block1[0]=length;
1541  //
1542 
1543  res->names = (char **)omAlloc0(rVar(r) * sizeof(char *));
1544  for (i=0; i<rVar(res); i++)
1545  {
1546  res->names[i] = omStrDup(r->names[i]);
1547  }
1548  if (r->qideal!=NULL)
1549  {
1550  if (copy_qideal)
1551  {
1552  #ifndef SING_NDEBUG
1553  if (!copy_ordering)
1554  WerrorS("internal error: rCopy0(Q,TRUE,FALSE)");
1555  else
1556  #endif
1557  {
1558  #ifndef SING_NDEBUG
1559  WarnS("internal bad stuff: rCopy0(Q,TRUE,TRUE)");
1560  #endif
1561  rComplete(res);
1562  res->qideal= idrCopyR_NoSort(r->qideal, r, res);
1563  rUnComplete(res);
1564  }
1565  }
1566  //memset: else res->qideal = NULL;
1567  }
1568  //memset: else res->qideal = NULL;
1569  //memset: res->GetNC() = NULL; // copy is purely commutative!!!
1570  return res;
1571 }
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
for int64 weights
Definition: ring.h:664
#define omMemDup(s)
Definition: omAllocDecl.h:264
void rUnComplete(ring r)
Definition: ring.cc:3818
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
long int64
Definition: auxiliary.h:112
Definition: ring.h:203
#define TRUE
Definition: auxiliary.h:144
void WerrorS(const char *s)
Definition: feFopen.cc:23
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
int j
Definition: myNF.cc:70
int rows() const
Definition: int64vec.h:57
#define A
Definition: sirandom.c:23
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition: coeffs.h:429
#define NULL
Definition: omList.c:10
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:205
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263
static void rDBChangeSComps ( int currComponents,
long *  currShiftedComponents,
int  length,
ring  r 
)
inlinestatic

Definition at line 4310 of file ring.cc.

4314 {
4315  assume(r->typ[1].ord_typ == ro_syzcomp);
4316 
4317  r->typ[1].data.syzcomp.length = length;
4318  rNChangeSComps( currComponents, currShiftedComponents, r);
4319 }
long * currShiftedComponents
Definition: syz1.cc:40
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static void rNChangeSComps(int *currComponents, long *currShiftedComponents, ring r)
Definition: ring.cc:4294
static void rDBGetSComps ( int **  currComponents,
long **  currShiftedComponents,
int length,
ring  r 
)
inlinestatic

Definition at line 4320 of file ring.cc.

4324 {
4325  assume(r->typ[1].ord_typ == ro_syzcomp);
4326 
4327  *length = r->typ[1].data.syzcomp.length;
4328  rNGetSComps( currComponents, currShiftedComponents, r);
4329 }
static void rNGetSComps(int **currComponents, long **currShiftedComponents, ring r)
Definition: ring.cc:4302
long * currShiftedComponents
Definition: syz1.cc:40
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
BOOLEAN rDBTest ( ring  r,
const char *  fn,
const int  l 
)

Definition at line 1917 of file ring.cc.

1918 {
1919  int i,j;
1920 
1921  if (r == NULL)
1922  {
1923  dReportError("Null ring in %s:%d", fn, l);
1924  return FALSE;
1925  }
1926 
1927 
1928  if (r->N == 0) return TRUE;
1929 
1930 // omCheckAddrSize(r,sizeof(ip_sring));
1931 #if OM_CHECK > 0
1932  i=rBlocks(r);
1933  omCheckAddrSize(r->order,i*sizeof(int));
1934  omCheckAddrSize(r->block0,i*sizeof(int));
1935  omCheckAddrSize(r->block1,i*sizeof(int));
1936  if (r->wvhdl!=NULL)
1937  {
1938  omCheckAddrSize(r->wvhdl,i*sizeof(int *));
1939  for (j=0;j<i; j++)
1940  {
1941  if (r->wvhdl[j] != NULL) omCheckAddr(r->wvhdl[j]);
1942  }
1943  }
1944 #endif
1945  if (r->VarOffset == NULL)
1946  {
1947  dReportError("Null ring VarOffset -- no rComplete (?) in n %s:%d", fn, l);
1948  return FALSE;
1949  }
1950  omCheckAddrSize(r->VarOffset,(r->N+1)*sizeof(int));
1951 
1952  if ((r->OrdSize==0)!=(r->typ==NULL))
1953  {
1954  dReportError("mismatch OrdSize and typ-pointer in %s:%d");
1955  return FALSE;
1956  }
1957  omcheckAddrSize(r->typ,r->OrdSize*sizeof(*(r->typ)));
1958  omCheckAddrSize(r->VarOffset,(r->N+1)*sizeof(*(r->VarOffset)));
1959  // test assumptions:
1960  for(i=0;i<=r->N;i++) // for all variables (i = 0..N)
1961  {
1962  if(r->typ!=NULL)
1963  {
1964  for(j=0;j<r->OrdSize;j++) // for all ordering blocks (j =0..OrdSize-1)
1965  {
1966  if(r->typ[j].ord_typ == ro_isTemp)
1967  {
1968  const int p = r->typ[j].data.isTemp.suffixpos;
1969 
1970  if(p <= j)
1971  dReportError("ordrec prefix %d is unmatched",j);
1972 
1973  assume( p < r->OrdSize );
1974 
1975  if(r->typ[p].ord_typ != ro_is)
1976  dReportError("ordrec prefix %d is unmatched (suffix: %d is wrong!!!)",j, p);
1977 
1978  // Skip all intermediate blocks for undone variables:
1979  if(r->typ[j].data.isTemp.pVarOffset[i] != -1) // Check i^th variable
1980  {
1981  j = p - 1; // SKIP ALL INTERNAL BLOCKS...???
1982  continue; // To make for check OrdSize bound...
1983  }
1984  }
1985  else if (r->typ[j].ord_typ == ro_is)
1986  {
1987  // Skip all intermediate blocks for undone variables:
1988  if(r->typ[j].data.is.pVarOffset[i] != -1)
1989  {
1990  // TODO???
1991  }
1992 
1993  }
1994  else
1995  {
1996  if (r->typ[j].ord_typ==ro_cp)
1997  {
1998  if(((short)r->VarOffset[i]) == r->typ[j].data.cp.place)
1999  dReportError("ordrec %d conflicts with var %d",j,i);
2000  }
2001  else
2002  if ((r->typ[j].ord_typ!=ro_syzcomp)
2003  && (r->VarOffset[i] == r->typ[j].data.dp.place))
2004  dReportError("ordrec %d conflicts with var %d",j,i);
2005  }
2006  }
2007  }
2008  int tmp;
2009  tmp=r->VarOffset[i] & 0xffffff;
2010  #if SIZEOF_LONG == 8
2011  if ((r->VarOffset[i] >> 24) >63)
2012  #else
2013  if ((r->VarOffset[i] >> 24) >31)
2014  #endif
2015  dReportError("bit_start out of range:%d",r->VarOffset[i] >> 24);
2016  if (i > 0 && ((tmp<0) ||(tmp>r->ExpL_Size-1)))
2017  {
2018  dReportError("varoffset out of range for var %d: %d",i,tmp);
2019  }
2020  }
2021  if(r->typ!=NULL)
2022  {
2023  for(j=0;j<r->OrdSize;j++)
2024  {
2025  if ((r->typ[j].ord_typ==ro_dp)
2026  || (r->typ[j].ord_typ==ro_wp)
2027  || (r->typ[j].ord_typ==ro_wp_neg))
2028  {
2029  if (r->typ[j].data.dp.start > r->typ[j].data.dp.end)
2030  dReportError("in ordrec %d: start(%d) > end(%d)",j,
2031  r->typ[j].data.dp.start, r->typ[j].data.dp.end);
2032  if ((r->typ[j].data.dp.start < 1)
2033  || (r->typ[j].data.dp.end > r->N))
2034  dReportError("in ordrec %d: start(%d)<1 or end(%d)>vars(%d)",j,
2035  r->typ[j].data.dp.start, r->typ[j].data.dp.end,r->N);
2036  }
2037  }
2038  }
2039 
2040  assume(r != NULL);
2041  assume(r->cf != NULL);
2042 
2043  if (nCoeff_is_algExt(r->cf))
2044  {
2045  assume(r->cf->extRing != NULL);
2046  assume(r->cf->extRing->qideal != NULL);
2047  omCheckAddr(r->cf->extRing->qideal->m[0]);
2048  }
2049 
2050  //assume(r->cf!=NULL);
2051 
2052  return TRUE;
2053 }
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
#define omcheckAddrSize(addr, size)
Definition: omAllocDecl.h:329
Definition: ring.h:61
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
#define TRUE
Definition: auxiliary.h:144
Definition: ring.h:66
Definition: ring.h:64
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:906
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
Definition: ring.h:69
Definition: ring.h:69
#define NULL
Definition: omList.c:10
Definition: ring.h:60
int dReportError(const char *fmt,...)
Definition: dError.cc:45
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
int l
Definition: cfEzgcd.cc:94
void rDebugPrint ( ring  r)

Definition at line 3971 of file ring.cc.

3972 {
3973  if (r==NULL)
3974  {
3975  PrintS("NULL ?\n");
3976  return;
3977  }
3978  // corresponds to ro_typ from ring.h:
3979  const char *TYP[]={"ro_dp","ro_wp","ro_am","ro_wp64","ro_wp_neg","ro_cp",
3980  "ro_syzcomp", "ro_syz", "ro_isTemp", "ro_is", "ro_none"};
3981  int i,j;
3982 
3983  Print("ExpL_Size:%d ",r->ExpL_Size);
3984  Print("CmpL_Size:%d ",r->CmpL_Size);
3985  Print("VarL_Size:%d\n",r->VarL_Size);
3986  Print("bitmask=0x%lx (expbound=%ld) \n",r->bitmask, r->bitmask);
3987  Print("divmask=%lx\n", r->divmask);
3988  Print("BitsPerExp=%d ExpPerLong=%d MinExpPerLong=%d at L[%d]\n", r->BitsPerExp, r->ExpPerLong, r->MinExpPerLong, r->VarL_Offset[0]);
3989 
3990  Print("VarL_LowIndex: %d\n", r->VarL_LowIndex);
3991  PrintS("VarL_Offset:\n");
3992  if (r->VarL_Offset==NULL) PrintS(" NULL");
3993  else
3994  for(j = 0; j < r->VarL_Size; j++)
3995  Print(" VarL_Offset[%d]: %d ", j, r->VarL_Offset[j]);
3996  PrintLn();
3997 
3998 
3999  PrintS("VarOffset:\n");
4000  if (r->VarOffset==NULL) PrintS(" NULL\n");
4001  else
4002  for(j=0;j<=r->N;j++)
4003  Print(" v%d at e-pos %d, bit %d\n",
4004  j,r->VarOffset[j] & 0xffffff, r->VarOffset[j] >>24);
4005  PrintS("ordsgn:\n");
4006  for(j=0;j<r->CmpL_Size;j++)
4007  Print(" ordsgn %ld at pos %d\n",r->ordsgn[j],j);
4008  Print("OrdSgn:%d\n",r->OrdSgn);
4009  PrintS("ordrec:\n");
4010  for(j=0;j<r->OrdSize;j++)
4011  {
4012  Print(" typ %s", TYP[r->typ[j].ord_typ]);
4013  if (r->typ[j].ord_typ==ro_syz)
4014  {
4015  const short place = r->typ[j].data.syz.place;
4016  const int limit = r->typ[j].data.syz.limit;
4017  const int curr_index = r->typ[j].data.syz.curr_index;
4018  const int* syz_index = r->typ[j].data.syz.syz_index;
4019 
4020  Print(" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
4021 
4022  if( syz_index == NULL )
4023  PrintS("(NULL)");
4024  else
4025  {
4026  Print("{");
4027  for( i=0; i <= limit; i++ )
4028  Print("%d ", syz_index[i]);
4029  Print("}");
4030  }
4031 
4032  }
4033  else if (r->typ[j].ord_typ==ro_isTemp)
4034  {
4035  Print(" start (level) %d, suffixpos: %d, VO: ",r->typ[j].data.isTemp.start, r->typ[j].data.isTemp.suffixpos);
4036 
4037  }
4038  else if (r->typ[j].ord_typ==ro_is)
4039  {
4040  Print(" start %d, end: %d: ",r->typ[j].data.is.start, r->typ[j].data.is.end);
4041 
4042 // for( int k = 0; k <= r->N; k++) if (r->typ[j].data.is.pVarOffset[k] != -1) Print("[%2d]: %04x; ", k, r->typ[j].data.is.pVarOffset[k]);
4043 
4044  Print(" limit %d",r->typ[j].data.is.limit);
4045 #ifndef SING_NDEBUG
4046  //PrintS(" F: ");idShow(r->typ[j].data.is.F, r, r, 1);
4047 #endif
4048 
4049  PrintLn();
4050  }
4051  else if (r->typ[j].ord_typ==ro_am)
4052  {
4053  Print(" place %d",r->typ[j].data.am.place);
4054  Print(" start %d",r->typ[j].data.am.start);
4055  Print(" end %d",r->typ[j].data.am.end);
4056  Print(" len_gen %d",r->typ[j].data.am.len_gen);
4057  PrintS(" w:");
4058  int l=0;
4059  for(l=r->typ[j].data.am.start;l<=r->typ[j].data.am.end;l++)
4060  Print(" %d",r->typ[j].data.am.weights[l-r->typ[j].data.am.start]);
4061  l=r->typ[j].data.am.end+1;
4062  int ll=r->typ[j].data.am.weights[l-r->typ[j].data.am.start];
4063  PrintS(" m:");
4064  for(int lll=l+1;lll<l+ll+1;lll++)
4065  Print(" %d",r->typ[j].data.am.weights[lll-r->typ[j].data.am.start]);
4066  }
4067  else
4068  {
4069  Print(" place %d",r->typ[j].data.dp.place);
4070 
4071  if (r->typ[j].ord_typ!=ro_syzcomp && r->typ[j].ord_typ!=ro_syz)
4072  {
4073  Print(" start %d",r->typ[j].data.dp.start);
4074  Print(" end %d",r->typ[j].data.dp.end);
4075  if ((r->typ[j].ord_typ==ro_wp)
4076  || (r->typ[j].ord_typ==ro_wp_neg))
4077  {
4078  PrintS(" w:");
4079  for(int l=r->typ[j].data.wp.start;l<=r->typ[j].data.wp.end;l++)
4080  Print(" %d",r->typ[j].data.wp.weights[l-r->typ[j].data.wp.start]);
4081  }
4082  else if (r->typ[j].ord_typ==ro_wp64)
4083  {
4084  PrintS(" w64:");
4085  int l;
4086  for(l=r->typ[j].data.wp64.start;l<=r->typ[j].data.wp64.end;l++)
4087  Print(" %ld",(long)(((int64*)r->typ[j].data.wp64.weights64)+l-r->typ[j].data.wp64.start));
4088  }
4089  }
4090  }
4091  PrintLn();
4092  }
4093  Print("pOrdIndex:%d pCompIndex:%d\n", r->pOrdIndex, r->pCompIndex);
4094  Print("OrdSize:%d\n",r->OrdSize);
4095  PrintS("--------------------\n");
4096  for(j=0;j<r->ExpL_Size;j++)
4097  {
4098  Print("L[%d]: ",j);
4099  if (j< r->CmpL_Size)
4100  Print("ordsgn %ld ", r->ordsgn[j]);
4101  else
4102  PrintS("no comp ");
4103  i=1;
4104  for(;i<=r->N;i++)
4105  {
4106  if( (r->VarOffset[i] & 0xffffff) == j )
4107  { Print("v%d at e[%d], bit %d; ", i,r->VarOffset[i] & 0xffffff,
4108  r->VarOffset[i] >>24 ); }
4109  }
4110  if( r->pCompIndex==j ) PrintS("v0; ");
4111  for(i=0;i<r->OrdSize;i++)
4112  {
4113  if (r->typ[i].data.dp.place == j)
4114  {
4115  Print("ordrec:%s (start:%d, end:%d) ",TYP[r->typ[i].ord_typ],
4116  r->typ[i].data.dp.start, r->typ[i].data.dp.end);
4117  }
4118  }
4119 
4120  if (j==r->pOrdIndex)
4121  PrintS("pOrdIndex\n");
4122  else
4123  PrintLn();
4124  }
4125  Print("LexOrder:%d, MixedOrder:%d\n",r->LexOrder, r->MixedOrder);
4126 
4127  Print("NegWeightL_Size: %d, NegWeightL_Offset: ", r->NegWeightL_Size);
4128  if (r->NegWeightL_Offset==NULL) PrintS(" NULL");
4129  else
4130  for(j = 0; j < r->NegWeightL_Size; j++)
4131  Print(" [%d]: %d ", j, r->NegWeightL_Offset[j]);
4132  PrintLn();
4133 
4134  // p_Procs stuff
4135  p_Procs_s proc_names;
4136  const char* field;
4137  const char* length;
4138  const char* ord;
4139  p_Debug_GetProcNames(r, &proc_names); // changes p_Procs!!!
4140  p_Debug_GetSpecNames(r, field, length, ord);
4141 
4142  Print("p_Spec : %s, %s, %s\n", field, length, ord);
4143  PrintS("p_Procs :\n");
4144  for (i=0; i<(int) (sizeof(p_Procs_s)/sizeof(void*)); i++)
4145  {
4146  Print(" %s,\n", ((char**) &proc_names)[i]);
4147  }
4148 
4149  {
4150  PrintLn();
4151  Print("pFDeg : ");
4152 #define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
4153  pFDeg_CASE(p_Totaldegree); else
4155  pFDeg_CASE(p_WTotaldegree); else
4156  pFDeg_CASE(p_Deg); else
4157 #undef pFDeg_CASE
4158  Print("(%p)", r->pFDeg); // default case
4159 
4160  PrintLn();
4161  Print("pLDeg : (%p)", r->pLDeg);
4162  PrintLn();
4163  }
4164  Print("pSetm:");
4165  void p_Setm_Dummy(poly p, const ring r);
4166  void p_Setm_TotalDegree(poly p, const ring r);
4167  void p_Setm_WFirstTotalDegree(poly p, const ring r);
4168  void p_Setm_General(poly p, const ring r);
4169  if (r->p_Setm==p_Setm_General) PrintS("p_Setm_General\n");
4170  else if (r->p_Setm==p_Setm_Dummy) PrintS("p_Setm_Dummy\n");
4171  else if (r->p_Setm==p_Setm_TotalDegree) PrintS("p_Setm_Totaldegree\n");
4172  else if (r->p_Setm==p_Setm_WFirstTotalDegree) PrintS("p_Setm_WFirstTotalDegree\n");
4173  else Print("%p\n",r->p_Setm);
4174 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
void p_Setm_General(poly p, const ring r)
Definition: p_polys.cc:163
Definition: ring.h:68
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
Definition: ring.h:61
return P p
Definition: myNF.cc:203
void p_Setm_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:553
struct p_Procs_s p_Procs_s
Definition: ring.h:29
long int64
Definition: auxiliary.h:112
void p_Debug_GetSpecNames(const ring r, const char *&field, const char *&length, const char *&ord)
Definition: p_Procs_Set.h:194
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
void p_Setm_TotalDegree(poly p, const ring r)
Definition: p_polys.cc:546
Definition: ring.h:64
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
void p_Setm_Dummy(poly p, const ring r)
Definition: p_polys.cc:540
#define pFDeg_CASE(A)
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
void p_Debug_GetProcNames(const ring r, p_Procs_s *p_Procs)
Definition: p_Procs_Set.h:205
Definition: ring.h:69
Definition: ring.h:69
#define NULL
Definition: omList.c:10
Definition: ring.h:63
Definition: ring.h:62
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:612
int l
Definition: cfEzgcd.cc:94
ring rDefault ( const coeffs  cf,
int  N,
char **  n,
int  ord_size,
int ord,
int block0,
int block1,
int **  wvhdl 
)

Definition at line 113 of file ring.cc.

114 {
115  assume( cf != NULL);
116  ring r=(ring) omAlloc0Bin(sip_sring_bin);
117  r->N = N;
118  r->cf = cf;
119  /*rPar(r) = 0; Alloc0 */
120  /*names*/
121  r->names = (char **) omAlloc0(N * sizeof(char *));
122  int i;
123  for(i=0;i<N;i++)
124  {
125  r->names[i] = omStrDup(n[i]);
126  }
127  /*weights: entries for 2 blocks: NULL*/
128  if (wvhdl==NULL)
129  r->wvhdl = (int **)omAlloc0((ord_size+1) * sizeof(int *));
130  else
131  r->wvhdl=wvhdl;
132  r->order = ord;
133  r->block0 = block0;
134  r->block1 = block1;
135 
136  /* complete ring intializations */
137  rComplete(r);
138  return r;
139 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
#define assume(x)
Definition: mod2.h:405
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omStrDup(s)
Definition: omAllocDecl.h:263
ring rDefault ( int  ch,
int  N,
char **  n,
int  ord_size,
int ord,
int block0,
int block1,
int **  wvhdl 
)

Definition at line 140 of file ring.cc.

141 {
142  coeffs cf;
143  if (ch==0) cf=nInitChar(n_Q,NULL);
144  else cf=nInitChar(n_Zp,(void*)(long)ch);
145  assume( cf != NULL);
146  return rDefault(cf,N,n,ord_size,ord,block0,block1,wvhdl);
147 }
rational (GMP) numbers
Definition: coeffs.h:30
{p < 2^31}
Definition: coeffs.h:29
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
ring rDefault(const coeffs cf, int N, char **n, int ord_size, int *ord, int *block0, int *block1, int **wvhdl)
Definition: ring.cc:113
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:10
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:316
ring rDefault ( const coeffs  cf,
int  N,
char **  n 
)

Definition at line 148 of file ring.cc.

149 {
150  assume( cf != NULL);
151  /*order: lp,0*/
152  int *order = (int *) omAlloc(2* sizeof(int));
153  int *block0 = (int *)omAlloc0(2 * sizeof(int));
154  int *block1 = (int *)omAlloc0(2 * sizeof(int));
155  /* ringorder dp for the first block: var 1..N */
156  order[0] = ringorder_lp;
157  block0[0] = 1;
158  block1[0] = N;
159  /* the last block: everything is 0 */
160  order[1] = 0;
161 
162  return rDefault(cf,N,n,2,order,block0,block1);
163 }
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
#define omAlloc(size)
Definition: omAllocDecl.h:210
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
#define assume(x)
Definition: mod2.h:405
ring rDefault(const coeffs cf, int N, char **n, int ord_size, int *ord, int *block0, int *block1, int **wvhdl)
Definition: ring.cc:113
#define NULL
Definition: omList.c:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211
ring rDefault ( int  ch,
int  N,
char **  n 
)

Definition at line 165 of file ring.cc.

166 {
167  coeffs cf;
168  if (ch==0) cf=nInitChar(n_Q,NULL);
169  else cf=nInitChar(n_Zp,(void*)(long)ch);
170  assume( cf != NULL);
171  return rDefault(cf,N,n);
172 }
rational (GMP) numbers
Definition: coeffs.h:30
{p < 2^31}
Definition: coeffs.h:29
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
ring rDefault(const coeffs cf, int N, char **n, int ord_size, int *ord, int *block0, int *block1, int **wvhdl)
Definition: ring.cc:113
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define NULL
Definition: omList.c:10
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:316
void rDelete ( ring  r)

unconditionally deletes fields in r

Definition at line 448 of file ring.cc.

449 {
450  int i, j;
451 
452  if (r == NULL) return;
453 
454  assume( r->ref <= 0 );
455 
456  if( r->ref > 0 ) // ->ref means the number of Interpreter objects referring to the ring...
457  return; // this should never happen.
458 
459  if( r->qideal != NULL )
460  {
461  ideal q = r->qideal;
462  r->qideal = NULL;
463  id_Delete(&q, r);
464  }
465 
466 #ifdef HAVE_PLURAL
467  if (rIsPluralRing(r))
468  nc_rKill(r);
469 #endif
470 
471  nKillChar(r->cf); r->cf = NULL;
472  rUnComplete(r);
473  // delete order stuff
474  if (r->order != NULL)
475  {
476  i=rBlocks(r);
477  assume(r->block0 != NULL && r->block1 != NULL && r->wvhdl != NULL);
478  // delete order
479  omFreeSize((ADDRESS)r->order,i*sizeof(int));
480  omFreeSize((ADDRESS)r->block0,i*sizeof(int));
481  omFreeSize((ADDRESS)r->block1,i*sizeof(int));
482  // delete weights
483  for (j=0; j<i; j++)
484  {
485  if (r->wvhdl[j]!=NULL)
486  omFree(r->wvhdl[j]);
487  }
488  omFreeSize((ADDRESS)r->wvhdl,i*sizeof(int *));
489  }
490  else
491  {
492  assume(r->block0 == NULL && r->block1 == NULL && r->wvhdl == NULL);
493  }
494 
495  // delete varnames
496  if(r->names!=NULL)
497  {
498  for (i=0; i<r->N; i++)
499  {
500  if (r->names[i] != NULL) omFree((ADDRESS)r->names[i]);
501  }
502  omFreeSize((ADDRESS)r->names,r->N*sizeof(char *));
503  }
504 
506 }
void rUnComplete(ring r)
Definition: ring.cc:3818
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
void nc_rKill(ring r)
complete destructor
Definition: old.gring.cc:2527
void * ADDRESS
Definition: auxiliary.h:161
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:477
ring rEnvelope ( ring  R)

Definition at line 5485 of file ring.cc.

5488 {
5489  ring Ropp = rOpposite(R);
5490  ring Renv = NULL;
5491  int stat = rSum(R, Ropp, Renv); /* takes care of qideals */
5492  if ( stat <=0 )
5493  WarnS("Error in rEnvelope at rSum");
5494  rTest(Renv);
5495  return Renv;
5496 }
ring rOpposite(ring src)
Definition: ring.cc:5157
#define WarnS
Definition: emacs.cc:81
int rSum(ring r1, ring r2, ring &sum)
Definition: ring.cc:1265
#define rTest(r)
Definition: ring.h:769
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
BOOLEAN rEqual ( ring  r1,
ring  r2,
BOOLEAN  qr 
)

returns TRUE, if r1 equals r2 FALSE, otherwise Equality is determined componentwise, if qr == 1, then qrideal equality is tested, as well

Definition at line 1594 of file ring.cc.

1595 {
1596  if (r1 == r2) return TRUE;
1597  if (r1 == NULL || r2 == NULL) return FALSE;
1598  if (r1->cf!=r2->cf) return FALSE;
1599  if (rVar(r1)!=rVar(r2)) return FALSE;
1600 
1601  if( !rSamePolyRep(r1, r2) )
1602  return FALSE;
1603 
1604  int i/*, j*/;
1605 
1606  for (i=0; i<rVar(r1); i++)
1607  {
1608  if ((r1->names[i] != NULL) && (r2->names[i] != NULL))
1609  {
1610  if (strcmp(r1->names[i], r2->names[i])) return FALSE;
1611  }
1612  else if ((r1->names[i] != NULL) ^ (r2->names[i] != NULL))
1613  {
1614  return FALSE;
1615  }
1616  }
1617 
1618  if (qr)
1619  {
1620  if (r1->qideal != NULL)
1621  {
1622  ideal id1 = r1->qideal, id2 = r2->qideal;
1623  int i, n;
1624  poly *m1, *m2;
1625 
1626  if (id2 == NULL) return FALSE;
1627  if ((n = IDELEMS(id1)) != IDELEMS(id2)) return FALSE;
1628 
1629  {
1630  m1 = id1->m;
1631  m2 = id2->m;
1632  for (i=0; i<n; i++)
1633  if (! p_EqualPolys(m1[i],m2[i], r1, r2)) return FALSE;
1634  }
1635  }
1636  else if (r2->qideal != NULL) return FALSE;
1637  }
1638 
1639  return TRUE;
1640 }
#define FALSE
Definition: auxiliary.h:140
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#define TRUE
Definition: auxiliary.h:144
polyrec * poly
Definition: hilb.h:10
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...
Definition: ring.cc:1642
int i
Definition: cfEzgcd.cc:123
#define IDELEMS(i)
Definition: simpleideals.h:19
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4288
#define NULL
Definition: omList.c:10
n_coeffType rFieldType ( ring  r)

Definition at line 5080 of file ring.cc.

5081 {
5082  return (r->cf->type);
5083  if (rField_is_Zp(r)) return n_Zp;
5084  if (rField_is_Q(r)) return n_Q;
5085  if (rField_is_R(r)) return n_R;
5086  if (rField_is_GF(r)) return n_GF;
5087  if (rField_is_long_R(r)) return n_long_R;
5088  if (rField_is_Zp_a(r)) return getCoeffType(r->cf);
5089  if (rField_is_Q_a(r)) return getCoeffType(r->cf);
5090  if (rField_is_long_C(r)) return n_long_C;
5091  #ifdef HAVE_RINGS
5092  if (rField_is_Ring_Z(r)) return n_Z;
5093  if (rField_is_Ring_ModN(r)) return n_Zn;
5094  if (rField_is_Ring_PtoM(r)) return n_Znm;
5095  if (rField_is_Ring_2toM(r)) return n_Z2m;
5096  #endif
5097 
5098  return n_unknown;
5099 }
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:42
static BOOLEAN rField_is_Zp_a(const ring r)
Definition: ring.h:469
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:44
static BOOLEAN rField_is_Ring_PtoM(const ring r)
Definition: ring.h:422
static BOOLEAN rField_is_Ring_ModN(const ring r)
Definition: ring.h:419
static BOOLEAN rField_is_R(const ring r)
Definition: ring.h:458
rational (GMP) numbers
Definition: coeffs.h:30
{p < 2^31}
Definition: coeffs.h:29
static BOOLEAN rField_is_Q_a(const ring r)
Definition: ring.h:479
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:461
real floating point (GMP) numbers
Definition: coeffs.h:33
single prescision (6,6) real numbers
Definition: coeffs.h:31
const ring r
Definition: syzextra.cc:208
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:43
complex floating point (GMP) numbers
Definition: coeffs.h:40
only used if HAVE_RINGS is defined: ?
Definition: coeffs.h:41
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:452
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
static BOOLEAN rField_is_long_C(const ring r)
Definition: ring.h:485
static BOOLEAN rField_is_Zp(const ring r)
Definition: ring.h:446
static BOOLEAN rField_is_Ring_2toM(const ring r)
Definition: ring.h:416
{p^n < 2^16}
Definition: coeffs.h:32
static BOOLEAN rField_is_Ring_Z(const ring r)
Definition: ring.h:425
static BOOLEAN rField_is_long_R(const ring r)
Definition: ring.h:482
static unsigned long rGetDivMask ( int  bits)
static

get r->divmask depending on bits per exponent

Definition at line 3957 of file ring.cc.

3958 {
3959  unsigned long divmask = 1;
3960  int i = bits;
3961 
3962  while (i < BIT_SIZEOF_LONG)
3963  {
3964  divmask |= (((unsigned long) 1) << (unsigned long) i);
3965  i += bits;
3966  }
3967  return divmask;
3968 }
int i
Definition: cfEzgcd.cc:123
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:124
static unsigned long rGetExpSize ( unsigned long  bitmask,
int bits 
)
static

Definition at line 2424 of file ring.cc.

2425 {
2426  if (bitmask == 0)
2427  {
2428  bits=16; bitmask=0xffff;
2429  }
2430  else if (bitmask <= 1L)
2431  {
2432  bits=1; bitmask = 1L;
2433  }
2434  else if (bitmask <= 3L)
2435  {
2436  bits=2; bitmask = 3L;
2437  }
2438  else if (bitmask <= 7L)
2439  {
2440  bits=3; bitmask=7L;
2441  }
2442  else if (bitmask <= 0xfL)
2443  {
2444  bits=4; bitmask=0xfL;
2445  }
2446  else if (bitmask <= 0x1fL)
2447  {
2448  bits=5; bitmask=0x1fL;
2449  }
2450  else if (bitmask <= 0x3fL)
2451  {
2452  bits=6; bitmask=0x3fL;
2453  }
2454 #if SIZEOF_LONG == 8
2455  else if (bitmask <= 0x7fL)
2456  {
2457  bits=7; bitmask=0x7fL; /* 64 bit longs only */
2458  }
2459 #endif
2460  else if (bitmask <= 0xffL)
2461  {
2462  bits=8; bitmask=0xffL;
2463  }
2464 #if SIZEOF_LONG == 8
2465  else if (bitmask <= 0x1ffL)
2466  {
2467  bits=9; bitmask=0x1ffL; /* 64 bit longs only */
2468  }
2469 #endif
2470  else if (bitmask <= 0x3ffL)
2471  {
2472  bits=10; bitmask=0x3ffL;
2473  }
2474 #if SIZEOF_LONG == 8
2475  else if (bitmask <= 0xfffL)
2476  {
2477  bits=12; bitmask=0xfff; /* 64 bit longs only */
2478  }
2479 #endif
2480  else if (bitmask <= 0xffffL)
2481  {
2482  bits=16; bitmask=0xffffL;
2483  }
2484 #if SIZEOF_LONG == 8
2485  else if (bitmask <= 0xfffffL)
2486  {
2487  bits=20; bitmask=0xfffffL; /* 64 bit longs only */
2488  }
2489  else if (bitmask <= 0xffffffffL)
2490  {
2491  bits=32; bitmask=0xffffffffL;
2492  }
2493  else if (bitmask <= 0x7fffffffffffffffL)
2494  {
2495  bits=63; bitmask=0x7fffffffffffffffL; /* for overflow tests*/
2496  }
2497  else
2498  {
2499  bits=63; bitmask=0x7fffffffffffffffL; /* for overflow tests*/
2500  }
2501 #else
2502  else if (bitmask <= 0x7fffffff)
2503  {
2504  bits=31; bitmask=0x7fffffff; /* for overflow tests*/
2505  }
2506  else
2507  {
2508  bits=31; bitmask=0x7fffffffL; /* for overflow tests*/
2509  }
2510 #endif
2511  return bitmask;
2512 }
static unsigned long rGetExpSize ( unsigned long  bitmask,
int bits,
int  N 
)
static

Definition at line 2517 of file ring.cc.

2518 {
2519 #if SIZEOF_LONG == 8
2520  if (N<4) N=4;
2521 #else
2522  if (N<2) N=2;
2523 #endif
2524  bitmask =rGetExpSize(bitmask, bits);
2525  int vars_per_long=BIT_SIZEOF_LONG/bits;
2526  int bits1;
2527  loop
2528  {
2529  if (bits == BIT_SIZEOF_LONG-1)
2530  {
2531  bits = BIT_SIZEOF_LONG - 1;
2532  return LONG_MAX;
2533  }
2534  unsigned long bitmask1 =rGetExpSize(bitmask+1, bits1);
2535  int vars_per_long1=BIT_SIZEOF_LONG/bits1;
2536  if ((((N+vars_per_long-1)/vars_per_long) ==
2537  ((N+vars_per_long1-1)/vars_per_long1)))
2538  {
2539  vars_per_long=vars_per_long1;
2540  bits=bits1;
2541  bitmask=bitmask1;
2542  }
2543  else
2544  {
2545  return bitmask; /* and bits */
2546  }
2547  }
2548 }
loop
Definition: myNF.cc:98
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
Definition: ring.cc:2424
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:124
int rGetISPos ( const int  p,
const ring  r 
)

Finds p^th IS ordering, and returns its position in r->typ[] returns -1 if something went wrong! p - starts with 0!

return the position of the p^th IS block order block in r->typ[]...

Definition at line 4873 of file ring.cc.

4874 {
4875  // Put the reference set F into the ring -ordering -recor
4876 #if MYTEST
4877  Print("rIsIS(p: %d)\nF:", p);
4878  PrintLn();
4879 #endif
4880 
4881  if (r->typ==NULL)
4882  {
4883 // dReportError("'rIsIS:' Error: wrong ring! (typ == NULL)");
4884  return -1;
4885  }
4886 
4887  int j = p; // Which IS record to use...
4888  for( int pos = 0; pos < r->OrdSize; pos++ )
4889  if( r->typ[pos].ord_typ == ro_is)
4890  if( j-- == 0 )
4891  return pos;
4892 
4893  return -1;
4894 }
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
Definition: ring.h:69
#define NULL
Definition: omList.c:10
int rGetMaxSyzComp ( int  i,
const ring  r 
)

return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit

Definition at line 5027 of file ring.cc.

5028 {
5029  if ((r->typ!=NULL) && (r->typ[0].ord_typ==ro_syz) &&
5030  r->typ[0].data.syz.limit > 0 && i > 0)
5031  {
5032  assume(i <= r->typ[0].data.syz.limit);
5033  int j;
5034  for (j=0; j<r->typ[0].data.syz.limit; j++)
5035  {
5036  if (r->typ[0].data.syz.syz_index[j] == i &&
5037  r->typ[0].data.syz.syz_index[j+1] != i)
5038  {
5039  assume(r->typ[0].data.syz.syz_index[j+1] == i+1);
5040  return j;
5041  }
5042  }
5043  return r->typ[0].data.syz.limit;
5044  }
5045  else
5046  {
5047  return 0;
5048  }
5049 }
Definition: ring.h:68
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
#define NULL
Definition: omList.c:10
rOrderType_t rGetOrderType ( ring  r)

Definition at line 1683 of file ring.cc.

1684 {
1685  // check for simple ordering
1686  if (rHasSimpleOrder(r))
1687  {
1688  if ((r->order[1] == ringorder_c)
1689  || (r->order[1] == ringorder_C))
1690  {
1691  switch(r->order[0])
1692  {
1693  case ringorder_dp:
1694  case ringorder_wp:
1695  case ringorder_ds:
1696  case ringorder_ws:
1697  case ringorder_ls:
1698  case ringorder_unspec:
1699  if (r->order[1] == ringorder_C
1700  || r->order[0] == ringorder_unspec)
1701  return rOrderType_ExpComp;
1702  return rOrderType_Exp;
1703 
1704  default:
1705  assume(r->order[0] == ringorder_lp ||
1706  r->order[0] == ringorder_rs ||
1707  r->order[0] == ringorder_Dp ||
1708  r->order[0] == ringorder_Wp ||
1709  r->order[0] == ringorder_Ds ||
1710  r->order[0] == ringorder_Ws);
1711 
1712  if (r->order[1] == ringorder_c) return rOrderType_ExpComp;
1713  return rOrderType_Exp;
1714  }
1715  }
1716  else
1717  {
1718  assume((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C));
1719  return rOrderType_CompExp;
1720  }
1721  }
1722  else
1723  return rOrderType_General;
1724 }
non-simple ordering as specified by currRing
Definition: ring.h:692
simple ordering, exponent vector has priority < component is compatible with exp-vector order ...
Definition: ring.h:696
opposite of ls
Definition: ring.h:685
simple ordering, component has priority
Definition: ring.h:693
BOOLEAN rHasSimpleOrder(const ring r)
Definition: ring.cc:1730
simple ordering, exponent vector has priority < component not compatible with exp-vector order ...
Definition: ring.h:694
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
void rGetSComps ( int **  currComponents,
long **  currShiftedComponents,
int length,
ring  r 
)

Definition at line 4341 of file ring.cc.

4342 {
4343 #ifdef PDEBUG
4344  rDBGetSComps(currComponents, currShiftedComponents, length, r);
4345 #else
4346  rNGetSComps(currComponents, currShiftedComponents, r);
4347 #endif
4348 }
static void rNGetSComps(int **currComponents, long **currShiftedComponents, ring r)
Definition: ring.cc:4302
long * currShiftedComponents
Definition: syz1.cc:40
static void rDBGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
Definition: ring.cc:4320
const ring r
Definition: syzextra.cc:208
poly rGetVar ( const int  varIndex,
const ring  r 
)

Definition at line 5600 of file ring.cc.

5601 {
5602  poly p = p_ISet(1, r);
5603  p_SetExp(p, varIndex, 1, r);
5604  p_Setm(p, r);
5605  return p;
5606 }
return P p
Definition: myNF.cc:203
const ring r
Definition: syzextra.cc:208
polyrec * poly
Definition: hilb.h:10
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent : VarOffset encodes the position in p->exp
Definition: p_polys.h:484
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1302
int64* rGetWeightVec ( ring  r)

Definition at line 5101 of file ring.cc.

5102 {
5103  assume(r!=NULL);
5104  assume(r->OrdSize>0);
5105  int i=0;
5106  while((r->typ[i].ord_typ!=ro_wp64) && (r->typ[i].ord_typ>0)) i++;
5107  assume(r->typ[i].ord_typ==ro_wp64);
5108  return (int64*)(r->typ[i].data.wp64.weights64);
5109 }
long int64
Definition: auxiliary.h:112
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
Definition: ring.h:63
BOOLEAN rHas_c_Ordering ( const ring  r)

Definition at line 1726 of file ring.cc.

1727 {
1728  return (r->order[0] == ringorder_c);
1729 }
const ring r
Definition: syzextra.cc:208
BOOLEAN rHasSimpleLexOrder ( const ring  r)

returns TRUE, if simple lp or ls ordering

Definition at line 1762 of file ring.cc.

1763 {
1764  return rHasSimpleOrder(r) &&
1765  (r->order[0] == ringorder_ls ||
1766  r->order[0] == ringorder_lp ||
1767  r->order[1] == ringorder_ls ||
1768  r->order[1] == ringorder_lp);
1769 }
BOOLEAN rHasSimpleOrder(const ring r)
Definition: ring.cc:1730
const ring r
Definition: syzextra.cc:208
BOOLEAN rHasSimpleOrder ( const ring  r)

Definition at line 1730 of file ring.cc.

1731 {
1732  if (r->order[0] == ringorder_unspec) return TRUE;
1733  int blocks = rBlocks(r) - 1;
1734  assume(blocks >= 1);
1735  if (blocks == 1) return TRUE;
1736 
1737  int s = 0;
1738  while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) )
1739  {
1740  s++;
1741  blocks--;
1742  }
1743 
1744  if ((blocks - s) > 2) return FALSE;
1745 
1746  assume( blocks == s + 2 );
1747 
1748  if (
1749  (r->order[s] != ringorder_c)
1750  && (r->order[s] != ringorder_C)
1751  && (r->order[s+1] != ringorder_c)
1752  && (r->order[s+1] != ringorder_C)
1753  )
1754  return FALSE;
1755  if ((r->order[s+1] == ringorder_M)
1756  || (r->order[s] == ringorder_M))
1757  return FALSE;
1758  return TRUE;
1759 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
Induced (Schreyer) ordering.
Definition: ring.h:686
BOOLEAN rHasSimpleOrderAA ( ring  r)

Definition at line 1805 of file ring.cc.

1806 {
1807  if (r->order[0] == ringorder_unspec) return TRUE;
1808  int blocks = rBlocks(r) - 1;
1809  assume(blocks >= 1);
1810  if (blocks == 1) return TRUE;
1811 
1812  int s = 0;
1813  while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) )
1814  {
1815  s++;
1816  blocks--;
1817  }
1818 
1819  if ((blocks - s) > 3) return FALSE;
1820 
1821 // if ((blocks > 3) || (blocks < 2)) return FALSE;
1822  if ((blocks - s) == 3)
1823  {
1824  return (((r->order[s] == ringorder_aa) && (r->order[s+1] != ringorder_M) &&
1825  ((r->order[s+2] == ringorder_c) || (r->order[s+2] == ringorder_C))) ||
1826  (((r->order[s] == ringorder_c) || (r->order[s] == ringorder_C)) &&
1827  (r->order[s+1] == ringorder_aa) && (r->order[s+2] != ringorder_M)));
1828  }
1829  else
1830  {
1831  return ((r->order[s] == ringorder_aa) && (r->order[s+1] != ringorder_M));
1832  }
1833 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:684
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
Induced (Schreyer) ordering.
Definition: ring.h:686
static void rHighSet ( ring  r,
int  o_r,
int  o 
)
static

Definition at line 2989 of file ring.cc.

2990 {
2991  switch(o_r)
2992  {
2993  case ringorder_lp:
2994  case ringorder_dp:
2995  case ringorder_Dp:
2996  case ringorder_wp:
2997  case ringorder_Wp:
2998  case ringorder_rp:
2999  case ringorder_a:
3000  case ringorder_aa:
3001  case ringorder_am:
3002  case ringorder_a64:
3003  if (r->OrdSgn==-1) r->MixedOrder=TRUE;
3004  break;
3005  case ringorder_ls:
3006  case ringorder_rs:
3007  case ringorder_ds:
3008  case ringorder_Ds:
3009  case ringorder_s:
3010  break;
3011  case ringorder_ws:
3012  case ringorder_Ws:
3013  if (r->wvhdl[o]!=NULL)
3014  {
3015  int i;
3016  for(i=r->block1[o]-r->block0[o];i>=0;i--)
3017  if (r->wvhdl[o][i]<0) { r->MixedOrder=TRUE; break; }
3018  }
3019  break;
3020  case ringorder_c:
3021  r->ComponentOrder=1;
3022  break;
3023  case ringorder_C:
3024  case ringorder_S:
3025  r->ComponentOrder=-1;
3026  break;
3027  case ringorder_M:
3028  r->LexOrder=TRUE;
3029  break;
3030  case ringorder_IS:
3031  { // TODO: What is r->ComponentOrder???
3032 // r->MixedOrder=TRUE;
3033  if( r->block0[o] != 0 ) // Suffix has the component
3034  r->ComponentOrder = r->block0[o];
3035 /* else // Prefix has level...
3036  r->ComponentOrder=-1;
3037 */
3038  // TODO: think about this a bit...!?
3039  break;
3040  }
3041 
3042  default:
3043  dReportError("wrong internal ordering:%d at %s, l:%d\n",o_r,__FILE__,__LINE__);
3044  }
3045 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:684
for int64 weights
Definition: ring.h:664
opposite of ls
Definition: ring.h:685
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:686
S?
Definition: ring.h:668
#define NULL
Definition: omList.c:10
int dReportError(const char *fmt,...)
Definition: dError.cc:45
s?
Definition: ring.h:669
BOOLEAN rIsPolyVar ( int  v,
const ring  r 
)

returns TRUE if var(i) belongs to p-block

Definition at line 1878 of file ring.cc.

1879 {
1880  int i=0;
1881  while(r->order[i]!=0)
1882  {
1883  if((r->block0[i]<=v)
1884  && (r->block1[i]>=v))
1885  {
1886  switch(r->order[i])
1887  {
1888  case ringorder_a:
1889  return (r->wvhdl[i][v-r->block0[i]]>0);
1890  case ringorder_M:
1891  return 2; /*don't know*/
1892  case ringorder_a64: /* assume: all weight are non-negative!*/
1893  case ringorder_lp:
1894  case ringorder_rs:
1895  case ringorder_dp:
1896  case ringorder_Dp:
1897  case ringorder_wp:
1898  case ringorder_Wp:
1899  return TRUE;
1900  case ringorder_ls:
1901  case ringorder_ds:
1902  case ringorder_Ds:
1903  case ringorder_ws:
1904  case ringorder_Ws:
1905  return FALSE;
1906  default:
1907  break;
1908  }
1909  }
1910  i++;
1911  }
1912  return 3; /* could not find var v*/
1913 }
for int64 weights
Definition: ring.h:664
#define FALSE
Definition: auxiliary.h:140
opposite of ls
Definition: ring.h:685
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
void rKillModified_Wp_Ring ( ring  r)

Definition at line 2933 of file ring.cc.

2934 {
2935  rUnComplete(r);
2936  omFree(r->order);
2937  omFree(r->block0);
2938  omFree(r->block1);
2939  omFree(r->wvhdl[0]);
2940  omFree(r->wvhdl);
2942 }
void rUnComplete(ring r)
Definition: ring.cc:3818
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
omBin sip_sring_bin
Definition: ring.cc:54
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
void rKillModifiedRing ( ring  r)

Definition at line 2923 of file ring.cc.

2924 {
2925  rUnComplete(r);
2926  omFree(r->order);
2927  omFree(r->block0);
2928  omFree(r->block1);
2929  omFree(r->wvhdl);
2931 }
void rUnComplete(ring r)
Definition: ring.cc:3818
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
omBin sip_sring_bin
Definition: ring.cc:54
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
void rKillModifiedRing_Simple ( ring  r)

Definition at line 2917 of file ring.cc.

2918 {
2920 }
const ring r
Definition: syzextra.cc:208
void rKillModifiedRing(ring r)
Definition: ring.cc:2923
void rModify_a_to_A ( ring  r)

Definition at line 5577 of file ring.cc.

5580 {
5581  int i=0;
5582  int j;
5583  while(r->order[i]!=0)
5584  {
5585  if (r->order[i]==ringorder_a)
5586  {
5587  r->order[i]=ringorder_a64;
5588  int *w=r->wvhdl[i];
5589  int64 *w64=(int64 *)omAlloc((r->block1[i]-r->block0[i]+1)*sizeof(int64));
5590  for(j=r->block1[i]-r->block0[i];j>=0;j--)
5591  w64[j]=(int64)w[j];
5592  r->wvhdl[i]=(int*)w64;
5593  omFreeSize(w,(r->block1[i]-r->block0[i]+1)*sizeof(int));
5594  }
5595  i++;
5596  }
5597 }
for int64 weights
Definition: ring.h:664
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
long int64
Definition: auxiliary.h:112
#define omAlloc(size)
Definition: omAllocDecl.h:210
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
const CanonicalForm & w
Definition: facAbsFact.cc:55
ring rModifyRing ( ring  r,
BOOLEAN  omit_degree,
BOOLEAN  try_omit_comp,
unsigned long  exp_limit 
)

< How many induced ordering block do we have?

Definition at line 2557 of file ring.cc.

2560 {
2561  assume (r != NULL );
2562  assume (exp_limit > 1);
2563  BOOLEAN need_other_ring;
2564  BOOLEAN omitted_degree = FALSE;
2565 
2566  int iNeedInducedOrderingSetup = 0; ///< How many induced ordering block do we have?
2567  int bits;
2568 
2569  exp_limit=rGetExpSize(exp_limit, bits, r->N);
2570  need_other_ring = (exp_limit != r->bitmask);
2571 
2572  int nblocks=rBlocks(r);
2573  int *order=(int*)omAlloc0((nblocks+1)*sizeof(int));
2574  int *block0=(int*)omAlloc0((nblocks+1)*sizeof(int));
2575  int *block1=(int*)omAlloc0((nblocks+1)*sizeof(int));
2576  int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int *));
2577 
2578  int i=0;
2579  int j=0; /* i index in r, j index in res */
2580 
2581  for( int r_ord=r->order[i]; (r_ord != 0) && (i < nblocks); j++, r_ord=r->order[++i])
2582  {
2583  BOOLEAN copy_block_index=TRUE;
2584 
2585  if (r->block0[i]==r->block1[i])
2586  {
2587  switch(r_ord)
2588  {
2589  case ringorder_wp:
2590  case ringorder_dp:
2591  case ringorder_Wp:
2592  case ringorder_Dp:
2593  r_ord=ringorder_lp;
2594  break;
2595  case ringorder_Ws:
2596  case ringorder_Ds:
2597  case ringorder_ws:
2598  case ringorder_ds:
2599  r_ord=ringorder_ls;
2600  break;
2601  default:
2602  break;
2603  }
2604  }
2605  switch(r_ord)
2606  {
2607  case ringorder_S:
2608  {
2609 #ifndef SING_NDEBUG
2610  Warn("Error: unhandled ordering in rModifyRing: ringorder_S = [%d]", r_ord);
2611 #endif
2612  order[j]=r_ord; /*r->order[i];*/
2613  break;
2614  }
2615  case ringorder_C:
2616  case ringorder_c:
2617  if (!try_omit_comp)
2618  {
2619  order[j]=r_ord; /*r->order[i]*/;
2620  }
2621  else
2622  {
2623  j--;
2624  need_other_ring=TRUE;
2625  try_omit_comp=FALSE;
2626  copy_block_index=FALSE;
2627  }
2628  break;
2629  case ringorder_wp:
2630  case ringorder_dp:
2631  case ringorder_ws:
2632  case ringorder_ds:
2633  if(!omit_degree)
2634  {
2635  order[j]=r_ord; /*r->order[i]*/;
2636  }
2637  else
2638  {
2639  order[j]=ringorder_rs;
2640  need_other_ring=TRUE;
2641  omit_degree=FALSE;
2642  omitted_degree = TRUE;
2643  }
2644  break;
2645  case ringorder_Wp:
2646  case ringorder_Dp:
2647  case ringorder_Ws:
2648  case ringorder_Ds:
2649  if(!omit_degree)
2650  {
2651  order[j]=r_ord; /*r->order[i];*/
2652  }
2653  else
2654  {
2655  order[j]=ringorder_lp;
2656  need_other_ring=TRUE;
2657  omit_degree=FALSE;
2658  omitted_degree = TRUE;
2659  }
2660  break;
2661  case ringorder_IS:
2662  {
2663  if (try_omit_comp)
2664  {
2665  // tried, but cannot omit component due to the ordering block [%d]: %d (ringorder_IS)", i, r_ord
2666  try_omit_comp = FALSE;
2667  }
2668  order[j]=r_ord; /*r->order[i];*/
2669  iNeedInducedOrderingSetup++;
2670  break;
2671  }
2672  case ringorder_s:
2673  {
2674  assume((i == 0) && (j == 0));
2675  if (try_omit_comp)
2676  {
2677  // tried, but cannot omit component due to the ordering block [%d]: %d (ringorder_s)", i, r_ord
2678  try_omit_comp = FALSE;
2679  }
2680  order[j]=r_ord; /*r->order[i];*/
2681  break;
2682  }
2683  default:
2684  order[j]=r_ord; /*r->order[i];*/
2685  break;
2686  }
2687  if (copy_block_index)
2688  {
2689  block0[j]=r->block0[i];
2690  block1[j]=r->block1[i];
2691  wvhdl[j]=r->wvhdl[i];
2692  }
2693 
2694  // order[j]=ringorder_no; // done by omAlloc0
2695  }
2696  if(!need_other_ring)
2697  {
2698  omFreeSize(order,(nblocks+1)*sizeof(int));
2699  omFreeSize(block0,(nblocks+1)*sizeof(int));
2700  omFreeSize(block1,(nblocks+1)*sizeof(int));
2701  omFreeSize(wvhdl,(nblocks+1)*sizeof(int *));
2702  return r;
2703  }
2704  ring res=(ring)omAlloc0Bin(sip_sring_bin);
2705  *res = *r;
2706 
2707 #ifdef HAVE_PLURAL
2708  res->GetNC() = NULL;
2709 #endif
2710 
2711  // res->qideal, res->idroot ???
2712  res->wvhdl=wvhdl;
2713  res->order=order;
2714  res->block0=block0;
2715  res->block1=block1;
2716  res->bitmask=exp_limit;
2717  //int tmpref=r->cf->ref0;
2718  rComplete(res, 1);
2719  //r->cf->ref=tmpref;
2720 
2721  // adjust res->pFDeg: if it was changed globally, then
2722  // it must also be changed for new ring
2723  if (r->pFDegOrig != res->pFDegOrig &&
2725  {
2726  // still might need adjustment for weighted orderings
2727  // and omit_degree
2728  res->firstwv = r->firstwv;
2729  res->firstBlockEnds = r->firstBlockEnds;
2730  res->pFDeg = res->pFDegOrig = p_WFirstTotalDegree;
2731  }
2732  if (omitted_degree)
2733  res->pLDeg = r->pLDegOrig;
2734 
2735  rOptimizeLDeg(res); // also sets res->pLDegOrig
2736 
2737  // set syzcomp
2738  if (res->typ != NULL)
2739  {
2740  if( res->typ[0].ord_typ == ro_syz) // "s" Always on [0] place!
2741  {
2742  res->typ[0] = r->typ[0]; // Copy struct!? + setup the same limit!
2743 
2744  if (r->typ[0].data.syz.limit > 0)
2745  {
2746  res->typ[0].data.syz.syz_index
2747  = (int*) omAlloc((r->typ[0].data.syz.limit +1)*sizeof(int));
2748  memcpy(res->typ[0].data.syz.syz_index, r->typ[0].data.syz.syz_index,
2749  (r->typ[0].data.syz.limit +1)*sizeof(int));
2750  }
2751  }
2752 
2753  if( iNeedInducedOrderingSetup > 0 )
2754  {
2755  for(j = 0, i = 0; (i < nblocks) && (iNeedInducedOrderingSetup > 0); i++)
2756  if( res->typ[i].ord_typ == ro_is ) // Search for suffixes!
2757  {
2758  ideal F = idrHeadR(r->typ[i].data.is.F, r, res); // Copy F from r into res!
2759  assume(
2760  rSetISReference( res,
2761  F, // WILL BE COPIED!
2762  r->typ[i].data.is.limit,
2763  j++
2764  )
2765  );
2766  id_Delete(&F, res);
2767  iNeedInducedOrderingSetup--;
2768  }
2769  } // Process all induced Ordering blocks! ...
2770  }
2771  // the special case: homog (omit_degree) and 1 block rs: that is global:
2772  // it comes from dp
2773  res->OrdSgn=r->OrdSgn;
2774 
2775 
2776 #ifdef HAVE_PLURAL
2777  if (rIsPluralRing(r))
2778  {
2779  if ( nc_rComplete(r, res, false) ) // no qideal!
2780  {
2781 #ifndef SING_NDEBUG
2782  WarnS("error in nc_rComplete");
2783 #endif
2784  // cleanup?
2785 
2786 // rDelete(res);
2787 // return r;
2788 
2789  // just go on..
2790  }
2791 
2792  if( rIsSCA(r) )
2793  {
2794  if( !sca_Force(res, scaFirstAltVar(r), scaLastAltVar(r)) )
2795  WarnS("error in sca_Force!");
2796  }
2797  }
2798 #endif
2799 
2800  return res;
2801 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
static void rOptimizeLDeg(ring r)
Definition: ring.cc:3080
Definition: ring.h:68
#define FALSE
Definition: auxiliary.h:140
opposite of ls
Definition: ring.h:685
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
BOOLEAN rOrd_is_WeightedDegree_Ordering(const ring r)
Definition: ring.cc:1869
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
ideal idrHeadR(ideal id, ring r, ring dest_r)
Copy leading terms of id[i] via prHeeadR into dest_r.
Definition: prCopy.cc:156
poly res
Definition: myNF.cc:322
bool sca_Force(ring rGR, int b, int e)
Definition: sca.cc:1175
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
omBin sip_sring_bin
Definition: ring.cc:54
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:686
S?
Definition: ring.h:668
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
Definition: ring.cc:2424
static short scaFirstAltVar(ring r)
Definition: sca.h:18
Definition: ring.h:69
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
static short scaLastAltVar(ring r)
Definition: sca.h:25
BOOLEAN rSetISReference(const ring r, const ideal F, const int i, const int p)
Changes r by setting induced ordering parameters: limit and reference leading terms F belong to r...
Definition: ring.cc:4905
static bool rIsSCA(const ring r)
Definition: nc.h:206
s?
Definition: ring.h:669
int BOOLEAN
Definition: auxiliary.h:131
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define Warn
Definition: emacs.cc:80
ring rModifyRing_Simple ( ring  r,
BOOLEAN  ommit_degree,
BOOLEAN  ommit_comp,
unsigned long  exp_limit,
BOOLEAN simple 
)

Definition at line 2852 of file ring.cc.

2853 {
2854  simple=TRUE;
2855  if (!rHasSimpleOrder(r))
2856  {
2857  simple=FALSE; // sorting needed
2858  assume (r != NULL );
2859  assume (exp_limit > 1);
2860  int bits;
2861 
2862  exp_limit=rGetExpSize(exp_limit, bits, r->N);
2863 
2864  int nblocks=1+(ommit_comp!=0);
2865  int *order=(int*)omAlloc0((nblocks+1)*sizeof(int));
2866  int *block0=(int*)omAlloc0((nblocks+1)*sizeof(int));
2867  int *block1=(int*)omAlloc0((nblocks+1)*sizeof(int));
2868  int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int *));
2869 
2870  order[0]=ringorder_lp;
2871  block0[0]=1;
2872  block1[0]=r->N;
2873  if (!ommit_comp)
2874  {
2875  order[1]=ringorder_C;
2876  }
2877  ring res=(ring)omAlloc0Bin(sip_sring_bin);
2878  *res = *r;
2879 #ifdef HAVE_PLURAL
2880  res->GetNC() = NULL;
2881 #endif
2882  // res->qideal, res->idroot ???
2883  res->wvhdl=wvhdl;
2884  res->order=order;
2885  res->block0=block0;
2886  res->block1=block1;
2887  res->bitmask=exp_limit;
2888  //int tmpref=r->cf->ref;
2889  rComplete(res, 1);
2890  //r->cf->ref=tmpref;
2891 
2892 #ifdef HAVE_PLURAL
2893  if (rIsPluralRing(r))
2894  {
2895  if ( nc_rComplete(r, res, false) ) // no qideal!
2896  {
2897 #ifndef SING_NDEBUG
2898  WarnS("error in nc_rComplete");
2899 #endif
2900  // cleanup?
2901 
2902 // rDelete(res);
2903 // return r;
2904 
2905  // just go on..
2906  }
2907  }
2908 #endif
2909 
2910  rOptimizeLDeg(res);
2911 
2912  return res;
2913  }
2914  return rModifyRing(r, ommit_degree, ommit_comp, exp_limit);
2915 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
static void rOptimizeLDeg(ring r)
Definition: ring.cc:3080
#define FALSE
Definition: auxiliary.h:140
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2557
#define TRUE
Definition: auxiliary.h:144
#define WarnS
Definition: emacs.cc:81
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
BOOLEAN rHasSimpleOrder(const ring r)
Definition: ring.cc:1730
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
#define assume(x)
Definition: mod2.h:405
omBin sip_sring_bin
Definition: ring.cc:54
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
Definition: ring.cc:2424
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211
ring rModifyRing_Wp ( ring  r,
int weights 
)

construct Wp, C ring

Definition at line 2804 of file ring.cc.

2805 {
2806  ring res=(ring)omAlloc0Bin(sip_sring_bin);
2807  *res = *r;
2808 #ifdef HAVE_PLURAL
2809  res->GetNC() = NULL;
2810 #endif
2811 
2812  /*weights: entries for 3 blocks: NULL*/
2813  res->wvhdl = (int **)omAlloc0(3 * sizeof(int *));
2814  /*order: Wp,C,0*/
2815  res->order = (int *) omAlloc(3 * sizeof(int *));
2816  res->block0 = (int *)omAlloc0(3 * sizeof(int *));
2817  res->block1 = (int *)omAlloc0(3 * sizeof(int *));
2818  /* ringorder Wp for the first block: var 1..r->N */
2819  res->order[0] = ringorder_Wp;
2820  res->block0[0] = 1;
2821  res->block1[0] = r->N;
2822  res->wvhdl[0] = weights;
2823  /* ringorder C for the second block: no vars */
2824  res->order[1] = ringorder_C;
2825  /* the last block: everything is 0 */
2826  res->order[2] = 0;
2827 
2828  //int tmpref=r->cf->ref;
2829  rComplete(res, 1);
2830  //r->cf->ref=tmpref;
2831 #ifdef HAVE_PLURAL
2832  if (rIsPluralRing(r))
2833  {
2834  if ( nc_rComplete(r, res, false) ) // no qideal!
2835  {
2836 #ifndef SING_NDEBUG
2837  WarnS("error in nc_rComplete");
2838 #endif
2839  // cleanup?
2840 
2841 // rDelete(res);
2842 // return r;
2843 
2844  // just go on..
2845  }
2846  }
2847 #endif
2848  return res;
2849 }
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5499
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
omBin sip_sring_bin
Definition: ring.cc:54
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:10
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static void rNChangeSComps ( int currComponents,
long *  currShiftedComponents,
ring  r 
)
inlinestatic

Definition at line 4294 of file ring.cc.

4295 {
4296  assume(r->typ[1].ord_typ == ro_syzcomp);
4297 
4298  r->typ[1].data.syzcomp.ShiftedComponents = currShiftedComponents;
4299  r->typ[1].data.syzcomp.Components = currComponents;
4300 }
long * currShiftedComponents
Definition: syz1.cc:40
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static void rNGetSComps ( int **  currComponents,
long **  currShiftedComponents,
ring  r 
)
inlinestatic

Definition at line 4302 of file ring.cc.

4303 {
4304  assume(r->typ[1].ord_typ == ro_syzcomp);
4305 
4306  *currShiftedComponents = r->typ[1].data.syzcomp.ShiftedComponents;
4307  *currComponents = r->typ[1].data.syzcomp.Components;
4308 }
long * currShiftedComponents
Definition: syz1.cc:40
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
static void rO_Align ( int place,
int bitplace 
)
static

Definition at line 2056 of file ring.cc.

2057 {
2058  // increment place to the next aligned one
2059  // (count as Exponent_t,align as longs)
2060  if (bitplace!=BITS_PER_LONG)
2061  {
2062  place++;
2063  bitplace=BITS_PER_LONG;
2064  }
2065 }
#define BITS_PER_LONG
Definition: ring.cc:52
static void rO_ISPrefix ( int place,
int bitplace,
int prev_ord,
long *  o,
int  ,
int v,
sro_ord ord_struct 
)
static

Definition at line 2315 of file ring.cc.

2317 {
2318  if ((prev_ord== 1) || (bitplace!=BITS_PER_LONG))
2319  rO_Align(place,bitplace);
2320  // since we add something afterwards - it's better to start with anew!?
2321 
2322  ord_struct.ord_typ = ro_isTemp;
2323  ord_struct.data.isTemp.start = place;
2324  ord_struct.data.isTemp.pVarOffset = (int *)omMemDup(v);
2325  ord_struct.data.isTemp.suffixpos = -1;
2326 
2327  // We will act as rO_Syz on our own!!!
2328  // Here we allocate an exponent as a level placeholder
2329  o[place]= -1;
2330  prev_ord=-1;
2331  place++;
2332 }
#define omMemDup(s)
Definition: omAllocDecl.h:264
union sro_ord::@0 data
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
ro_typ ord_typ
Definition: ring.h:182
Definition: ring.h:69
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define BITS_PER_LONG
Definition: ring.cc:52
static void rO_ISSuffix ( int place,
int bitplace,
int prev_ord,
long *  o,
int  N,
int v,
sro_ord tmp_typ,
int typ_i,
int  sgn 
)
static

Definition at line 2333 of file ring.cc.

2335 {
2336 
2337  // Let's find previous prefix:
2338  int typ_j = typ_i - 1;
2339  while(typ_j >= 0)
2340  {
2341  if( tmp_typ[typ_j].ord_typ == ro_isTemp)
2342  break;
2343  typ_j --;
2344  }
2345 
2346  assume( typ_j >= 0 );
2347 
2348  if( typ_j < 0 ) // Found NO prefix!!! :(
2349  return;
2350 
2351  assume( tmp_typ[typ_j].ord_typ == ro_isTemp );
2352 
2353  // Get saved state:
2354  const int start = tmp_typ[typ_j].data.isTemp.start;
2355  int *pVarOffset = tmp_typ[typ_j].data.isTemp.pVarOffset;
2356 
2357 /*
2358  // shift up all blocks
2359  while(typ_j < (typ_i-1))
2360  {
2361  tmp_typ[typ_j] = tmp_typ[typ_j+1];
2362  typ_j++;
2363  }
2364  typ_j = typ_i - 1; // No increment for typ_i
2365 */
2366  tmp_typ[typ_j].data.isTemp.suffixpos = typ_i;
2367 
2368  // Let's keep that dummy for now...
2369  typ_j = typ_i; // the typ to change!
2370  typ_i++; // Just for now...
2371 
2372 
2373  for( int i = 0; i <= N; i++ ) // Note [0] == component !!! No Skip?
2374  {
2375  // Was i-th variable allocated inbetween?
2376  if( v[i] != pVarOffset[i] )
2377  {
2378  pVarOffset[i] = v[i]; // Save for later...
2379  v[i] = -1; // Undo!
2380  assume( pVarOffset[i] != -1 );
2381  }
2382  else
2383  pVarOffset[i] = -1; // No change here...
2384  }
2385 
2386  if( pVarOffset[0] != -1 )
2387  pVarOffset[0] &= 0x0fff;
2388 
2389  sro_ord &ord_struct = tmp_typ[typ_j];
2390 
2391 
2392  ord_struct.ord_typ = ro_is;
2393  ord_struct.data.is.start = start;
2394  ord_struct.data.is.end = place;
2395  ord_struct.data.is.pVarOffset = pVarOffset;
2396 
2397 
2398  // What about component???
2399 // if( v[0] != -1 ) // There is a component already...???
2400 // if( o[ v[0] & 0x0fff ] == sgn )
2401 // {
2402 // pVarOffset[0] = -1; // NEVER USED Afterwards...
2403 // return;
2404 // }
2405 
2406 
2407  // Moreover: we need to allocate the module component (v[0]) here!
2408  if( v[0] == -1) // It's possible that there was module component v0 at the begining (before prefix)!
2409  {
2410  // Start with a whole long exponent
2411  if( bitplace != BITS_PER_LONG )
2412  rO_Align(place, bitplace);
2413 
2414  assume( bitplace == BITS_PER_LONG );
2415  bitplace -= BITS_PER_LONG;
2416  assume(bitplace == 0);
2417  v[0] = place | (bitplace << 24); // Never mind whether pVarOffset[0] > 0!!!
2418  o[place] = sgn; // Singnum for component ordering
2419  prev_ord = sgn;
2420  }
2421 }
int sgn(const Rational &a)
Definition: GMPrat.cc:437
union sro_ord::@0 data
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
ro_typ ord_typ
Definition: ring.h:182
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
#define assume(x)
Definition: mod2.h:405
Definition: ring.h:180
int i
Definition: cfEzgcd.cc:123
Definition: ring.h:69
Definition: ring.h:69
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define BITS_PER_LONG
Definition: ring.cc:52
static void rO_LexVars ( int place,
int bitplace,
int  start,
int  end,
int prev_ord,
long *  o,
int v,
int  bits,
int  opt_var 
)
static

Definition at line 2201 of file ring.cc.

2203 {
2204  // a block of variables v_start..v_end with lex order, ordsgn 1
2205  int k;
2206  int incr=1;
2207  if(prev_ord==-1) rO_Align(place,bitplace);
2208 
2209  if (start>end)
2210  {
2211  incr=-1;
2212  }
2213  for(k=start;;k+=incr)
2214  {
2215  bitplace-=bits;
2216  if (bitplace < 0) { bitplace=BITS_PER_LONG-bits; place++; }
2217  o[place]=1;
2218  v[k]= place | (bitplace << 24);
2219  if (k==end) break;
2220  }
2221  prev_ord=1;
2222  if (opt_var!= -1)
2223  {
2224  assume((opt_var == end+1) ||(opt_var == end-1));
2225  if((opt_var != end+1) &&(opt_var != end-1)) WarnS("hier-2");
2226  int save_bitplace=bitplace;
2227  bitplace-=bits;
2228  if (bitplace < 0)
2229  {
2230  bitplace=save_bitplace;
2231  return;
2232  }
2233  // there is enough space for the optional var
2234  v[opt_var]=place | (bitplace << 24);
2235  }
2236 }
int k
Definition: cfEzgcd.cc:93
#define WarnS
Definition: emacs.cc:81
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
#define assume(x)
Definition: mod2.h:405
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define BITS_PER_LONG
Definition: ring.cc:52
static void rO_LexVars_neg ( int place,
int bitplace,
int  start,
int  end,
int prev_ord,
long *  o,
int v,
int  bits,
int  opt_var 
)
static

Definition at line 2238 of file ring.cc.

2240 {
2241  // a block of variables v_start..v_end with lex order, ordsgn -1
2242  int k;
2243  int incr=1;
2244  if(prev_ord==1) rO_Align(place,bitplace);
2245 
2246  if (start>end)
2247  {
2248  incr=-1;
2249  }
2250  for(k=start;;k+=incr)
2251  {
2252  bitplace-=bits;
2253  if (bitplace < 0) { bitplace=BITS_PER_LONG-bits; place++; }
2254  o[place]=-1;
2255  v[k]=place | (bitplace << 24);
2256  if (k==end) break;
2257  }
2258  prev_ord=-1;
2259 // #if 0
2260  if (opt_var!= -1)
2261  {
2262  assume((opt_var == end+1) ||(opt_var == end-1));
2263  if((opt_var != end+1) &&(opt_var != end-1)) WarnS("hier-1");
2264  int save_bitplace=bitplace;
2265  bitplace-=bits;
2266  if (bitplace < 0)
2267  {
2268  bitplace=save_bitplace;
2269  return;
2270  }
2271  // there is enough space for the optional var
2272  v[opt_var]=place | (bitplace << 24);
2273  }
2274 // #endif
2275 }
int k
Definition: cfEzgcd.cc:93
#define WarnS
Definition: emacs.cc:81
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
#define assume(x)
Definition: mod2.h:405
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
#define BITS_PER_LONG
Definition: ring.cc:52
static void rO_Syz ( int place,
int bitplace,
int prev_ord,
long *  o,
sro_ord ord_struct 
)
static

Definition at line 2292 of file ring.cc.

2294 {
2295  // ordering is derived from component number
2296  // let's reserve one Exponent_t for it
2297  if ((prev_ord== 1) || (bitplace!=BITS_PER_LONG))
2298  rO_Align(place,bitplace);
2299  ord_struct.ord_typ=ro_syz;
2300  ord_struct.data.syz.place=place;
2301  ord_struct.data.syz.limit=0;
2302  ord_struct.data.syz.syz_index = NULL;
2303  ord_struct.data.syz.curr_index = 1;
2304  o[place]= -1;
2305  prev_ord=-1;
2306  place++;
2307 }
Definition: ring.h:68
union sro_ord::@0 data
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
ro_typ ord_typ
Definition: ring.h:182
#define NULL
Definition: omList.c:10
#define BITS_PER_LONG
Definition: ring.cc:52
static void rO_Syzcomp ( int place,
int bitplace,
int prev_ord,
long *  o,
sro_ord ord_struct 
)
static

Definition at line 2277 of file ring.cc.

2279 {
2280  // ordering is derived from component number
2281  rO_Align(place,bitplace);
2282  ord_struct.ord_typ=ro_syzcomp;
2283  ord_struct.data.syzcomp.place=place;
2284  ord_struct.data.syzcomp.Components=NULL;
2285  ord_struct.data.syzcomp.ShiftedComponents=NULL;
2286  o[place]=1;
2287  prev_ord=1;
2288  place++;
2289  rO_Align(place,bitplace);
2290 }
union sro_ord::@0 data
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
ro_typ ord_typ
Definition: ring.h:182
#define NULL
Definition: omList.c:10
static void rO_TDegree ( int place,
int bitplace,
int  start,
int  end,
long *  o,
sro_ord ord_struct 
)
static

Definition at line 2067 of file ring.cc.

2069 {
2070  // degree (aligned) of variables v_start..v_end, ordsgn 1
2071  rO_Align(place,bitplace);
2072  ord_struct.ord_typ=ro_dp;
2073  ord_struct.data.dp.start=start;
2074  ord_struct.data.dp.end=end;
2075  ord_struct.data.dp.place=place;
2076  o[place]=1;
2077  place++;
2078  rO_Align(place,bitplace);
2079 }
union sro_ord::@0 data
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
ro_typ ord_typ
Definition: ring.h:182
Definition: ring.h:60
static void rO_TDegree_neg ( int place,
int bitplace,
int  start,
int  end,
long *  o,
sro_ord ord_struct 
)
static

Definition at line 2081 of file ring.cc.

2083 {
2084  // degree (aligned) of variables v_start..v_end, ordsgn -1
2085  rO_Align(place,bitplace);
2086  ord_struct.ord_typ=ro_dp;
2087  ord_struct.data.dp.start=start;
2088  ord_struct.data.dp.end=end;
2089  ord_struct.data.dp.place=place;
2090  o[place]=-1;
2091  place++;
2092  rO_Align(place,bitplace);
2093 }
union sro_ord::@0 data
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
ro_typ ord_typ
Definition: ring.h:182
Definition: ring.h:60
static void rO_WDegree ( int place,
int bitplace,
int  start,
int  end,
long *  o,
sro_ord ord_struct,
int weights 
)
static

Definition at line 2095 of file ring.cc.

2097 {
2098  // weighted degree (aligned) of variables v_start..v_end, ordsgn 1
2099  while((start<end) && (weights[0]==0)) { start++; weights++; }
2100  while((start<end) && (weights[end-start]==0)) { end--; }
2101  int i;
2102  int pure_tdeg=1;
2103  for(i=start;i<=end;i++)
2104  {
2105  if(weights[i-start]!=1)
2106  {
2107  pure_tdeg=0;
2108  break;
2109  }
2110  }
2111  if (pure_tdeg)
2112  {
2113  rO_TDegree(place,bitplace,start,end,o,ord_struct);
2114  return;
2115  }
2116  rO_Align(place,bitplace);
2117  ord_struct.ord_typ=ro_wp;
2118  ord_struct.data.wp.start=start;
2119  ord_struct.data.wp.end=end;
2120  ord_struct.data.wp.place=place;
2121  ord_struct.data.wp.weights=weights;
2122  o[place]=1;
2123  place++;
2124  rO_Align(place,bitplace);
2125  for(i=start;i<=end;i++)
2126  {
2127  if(weights[i-start]<0)
2128  {
2129  ord_struct.ord_typ=ro_wp_neg;
2130  break;
2131  }
2132  }
2133 }
Definition: ring.h:61
Definition: ring.h:64
union sro_ord::@0 data
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
ro_typ ord_typ
Definition: ring.h:182
int i
Definition: cfEzgcd.cc:123
static void rO_TDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
Definition: ring.cc:2067
static void rO_WDegree64 ( int place,
int bitplace,
int  start,
int  end,
long *  o,
sro_ord ord_struct,
int64 weights 
)
static

Definition at line 2157 of file ring.cc.

2159 {
2160  // weighted degree (aligned) of variables v_start..v_end, ordsgn 1,
2161  // reserved 2 places
2162  rO_Align(place,bitplace);
2163  ord_struct.ord_typ=ro_wp64;
2164  ord_struct.data.wp64.start=start;
2165  ord_struct.data.wp64.end=end;
2166  ord_struct.data.wp64.place=place;
2167  ord_struct.data.wp64.weights64=weights;
2168  o[place]=1;
2169  place++;
2170  o[place]=1;
2171  place++;
2172  rO_Align(place,bitplace);
2173 }
union sro_ord::@0 data
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
ro_typ ord_typ
Definition: ring.h:182
Definition: ring.h:63
static void rO_WDegree_neg ( int place,
int bitplace,
int  start,
int  end,
long *  o,
sro_ord ord_struct,
int weights 
)
static

Definition at line 2175 of file ring.cc.

2177 {
2178  // weighted degree (aligned) of variables v_start..v_end, ordsgn -1
2179  while((start<end) && (weights[0]==0)) { start++; weights++; }
2180  while((start<end) && (weights[end-start]==0)) { end--; }
2181  rO_Align(place,bitplace);
2182  ord_struct.ord_typ=ro_wp;
2183  ord_struct.data.wp.start=start;
2184  ord_struct.data.wp.end=end;
2185  ord_struct.data.wp.place=place;
2186  ord_struct.data.wp.weights=weights;
2187  o[place]=-1;
2188  place++;
2189  rO_Align(place,bitplace);
2190  int i;
2191  for(i=start;i<=end;i++)
2192  {
2193  if(weights[i-start]<0)
2194  {
2195  ord_struct.ord_typ=ro_wp_neg;
2196  break;
2197  }
2198  }
2199 }
Definition: ring.h:61
Definition: ring.h:64
union sro_ord::@0 data
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
ro_typ ord_typ
Definition: ring.h:182
int i
Definition: cfEzgcd.cc:123
static void rO_WMDegree ( int place,
int bitplace,
int  start,
int  end,
long *  o,
sro_ord ord_struct,
int weights 
)
static

Definition at line 2135 of file ring.cc.

2137 {
2138  assume(weights != NULL);
2139 
2140  // weighted degree (aligned) of variables v_start..v_end, ordsgn 1
2141 // while((start<end) && (weights[0]==0)) { start++; weights++; }
2142 // while((start<end) && (weights[end-start]==0)) { end--; }
2143  rO_Align(place,bitplace);
2144  ord_struct.ord_typ=ro_am;
2145  ord_struct.data.am.start=start;
2146  ord_struct.data.am.end=end;
2147  ord_struct.data.am.place=place;
2148  ord_struct.data.am.weights=weights;
2149  ord_struct.data.am.weights_m = weights + (end-start+1);
2150  ord_struct.data.am.len_gen=weights[end-start+1];
2151  assume( ord_struct.data.am.weights_m[0] == ord_struct.data.am.len_gen );
2152  o[place]=1;
2153  place++;
2154  rO_Align(place,bitplace);
2155 }
union sro_ord::@0 data
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2056
ro_typ ord_typ
Definition: ring.h:182
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
Definition: ring.h:62
ring rOpposite ( ring  src)

Definition at line 5157 of file ring.cc.

5161 {
5162  if (src == NULL) return(NULL);
5163 
5164 #ifdef RDEBUG
5165  rTest(src);
5166 #endif
5167 
5168  //rChangeCurrRing(src);
5169 
5170 #ifdef RDEBUG
5171  rTest(src);
5172 // rWrite(src);
5173 // rDebugPrint(src);
5174 #endif
5175 
5176 
5177  ring r = rCopy0(src,FALSE); /* qideal will be deleted later on!!! */
5178 
5179  // change vars v1..vN -> vN..v1
5180  int i;
5181  int i2 = (rVar(r)-1)/2;
5182  for(i=i2; i>=0; i--)
5183  {
5184  // index: 0..N-1
5185  //Print("ex var names: %d <-> %d\n",i,rOppVar(r,i));
5186  // exchange names
5187  char *p;
5188  p = r->names[rVar(r)-1-i];
5189  r->names[rVar(r)-1-i] = r->names[i];
5190  r->names[i] = p;
5191  }
5192 // i2=(rVar(r)+1)/2;
5193 // for(int i=i2; i>0; i--)
5194 // {
5195 // // index: 1..N
5196 // //Print("ex var places: %d <-> %d\n",i,rVar(r)+1-i);
5197 // // exchange VarOffset
5198 // int t;
5199 // t=r->VarOffset[i];
5200 // r->VarOffset[i]=r->VarOffset[rOppVar(r,i)];
5201 // r->VarOffset[rOppVar(r,i)]=t;
5202 // }
5203  // change names:
5204  for (i=rVar(r)-1; i>=0; i--)
5205  {
5206  char *p=r->names[i];
5207  if(isupper(*p)) *p = tolower(*p);
5208  else *p = toupper(*p);
5209  }
5210  // change ordering: listing
5211  // change ordering: compare
5212 // for(i=0; i<r->OrdSize; i++)
5213 // {
5214 // int t,tt;
5215 // switch(r->typ[i].ord_typ)
5216 // {
5217 // case ro_dp:
5218 // //
5219 // t=r->typ[i].data.dp.start;
5220 // r->typ[i].data.dp.start=rOppVar(r,r->typ[i].data.dp.end);
5221 // r->typ[i].data.dp.end=rOppVar(r,t);
5222 // break;
5223 // case ro_wp:
5224 // case ro_wp_neg:
5225 // {
5226 // t=r->typ[i].data.wp.start;
5227 // r->typ[i].data.wp.start=rOppVar(r,r->typ[i].data.wp.end);
5228 // r->typ[i].data.wp.end=rOppVar(r,t);
5229 // // invert r->typ[i].data.wp.weights
5230 // rOppWeight(r->typ[i].data.wp.weights,
5231 // r->typ[i].data.wp.end-r->typ[i].data.wp.start);
5232 // break;
5233 // }
5234 // //case ro_wp64:
5235 // case ro_syzcomp:
5236 // case ro_syz:
5237 // WerrorS("not implemented in rOpposite");
5238 // // should not happen
5239 // break;
5240 //
5241 // case ro_cp:
5242 // t=r->typ[i].data.cp.start;
5243 // r->typ[i].data.cp.start=rOppVar(r,r->typ[i].data.cp.end);
5244 // r->typ[i].data.cp.end=rOppVar(r,t);
5245 // break;
5246 // case ro_none:
5247 // default:
5248 // Werror("unknown type in rOpposite(%d)",r->typ[i].ord_typ);
5249 // break;
5250 // }
5251 // }
5252  // Change order/block structures (needed for rPrint, rAdd etc.)
5253  int j=0;
5254  int l=rBlocks(src);
5255  for(i=0; src->order[i]!=0; i++)
5256  {
5257  switch (src->order[i])
5258  {
5259  case ringorder_c: /* c-> c */
5260  case ringorder_C: /* C-> C */
5261  case ringorder_no /*=0*/: /* end-of-block */
5262  r->order[j]=src->order[i];
5263  j++; break;
5264  case ringorder_lp: /* lp -> rp */
5265  r->order[j]=ringorder_rp;
5266  r->block0[j]=rOppVar(r, src->block1[i]);
5267  r->block1[j]=rOppVar(r, src->block0[i]);
5268  break;
5269  case ringorder_rp: /* rp -> lp */
5270  r->order[j]=ringorder_lp;
5271  r->block0[j]=rOppVar(r, src->block1[i]);
5272  r->block1[j]=rOppVar(r, src->block0[i]);
5273  break;
5274  case ringorder_dp: /* dp -> a(1..1),ls */
5275  {
5276  l=rRealloc1(r,l,j);
5277  r->order[j]=ringorder_a;
5278  r->block0[j]=rOppVar(r, src->block1[i]);
5279  r->block1[j]=rOppVar(r, src->block0[i]);
5280  r->wvhdl[j]=(int*)omAlloc((r->block1[j]-r->block0[j]+1)*sizeof(int));
5281  for(int k=r->block0[j]; k<=r->block1[j]; k++)
5282  r->wvhdl[j][k-r->block0[j]]=1;
5283  j++;
5284  r->order[j]=ringorder_ls;
5285  r->block0[j]=rOppVar(r, src->block1[i]);
5286  r->block1[j]=rOppVar(r, src->block0[i]);
5287  j++;
5288  break;
5289  }
5290  case ringorder_Dp: /* Dp -> a(1..1),rp */
5291  {
5292  l=rRealloc1(r,l,j);
5293  r->order[j]=ringorder_a;
5294  r->block0[j]=rOppVar(r, src->block1[i]);
5295  r->block1[j]=rOppVar(r, src->block0[i]);
5296  r->wvhdl[j]=(int*)omAlloc((r->block1[j]-r->block0[j]+1)*sizeof(int));
5297  for(int k=r->block0[j]; k<=r->block1[j]; k++)
5298  r->wvhdl[j][k-r->block0[j]]=1;
5299  j++;
5300  r->order[j]=ringorder_rp;
5301  r->block0[j]=rOppVar(r, src->block1[i]);
5302  r->block1[j]=rOppVar(r, src->block0[i]);
5303  j++;
5304  break;
5305  }
5306  case ringorder_wp: /* wp -> a(...),ls */
5307  {
5308  l=rRealloc1(r,l,j);
5309  r->order[j]=ringorder_a;
5310  r->block0[j]=rOppVar(r, src->block1[i]);
5311  r->block1[j]=rOppVar(r, src->block0[i]);
5312  r->wvhdl[j]=r->wvhdl[j+1]; r->wvhdl[j+1]=NULL;
5313  rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5314  j++;
5315  r->order[j]=ringorder_ls;
5316  r->block0[j]=rOppVar(r, src->block1[i]);
5317  r->block1[j]=rOppVar(r, src->block0[i]);
5318  j++;
5319  break;
5320  }
5321  case ringorder_Wp: /* Wp -> a(...),rp */
5322  {
5323  l=rRealloc1(r,l,j);
5324  r->order[j]=ringorder_a;
5325  r->block0[j]=rOppVar(r, src->block1[i]);
5326  r->block1[j]=rOppVar(r, src->block0[i]);
5327  r->wvhdl[j]=r->wvhdl[j+1]; r->wvhdl[j+1]=NULL;
5328  rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5329  j++;
5330  r->order[j]=ringorder_rp;
5331  r->block0[j]=rOppVar(r, src->block1[i]);
5332  r->block1[j]=rOppVar(r, src->block0[i]);
5333  j++;
5334  break;
5335  }
5336  case ringorder_M: /* M -> M */
5337  {
5338  r->order[j]=ringorder_M;
5339  r->block0[j]=rOppVar(r, src->block1[i]);
5340  r->block1[j]=rOppVar(r, src->block0[i]);
5341  int n=r->block1[j]-r->block0[j];
5342  /* M is a (n+1)x(n+1) matrix */
5343  for (int nn=0; nn<=n; nn++)
5344  {
5345  rOppWeight(&(r->wvhdl[j][nn*(n+1)]), n /*r->block1[j]-r->block0[j]*/);
5346  }
5347  j++;
5348  break;
5349  }
5350  case ringorder_a: /* a(...),ls -> wp/dp */
5351  {
5352  r->block0[j]=rOppVar(r, src->block1[i]);
5353  r->block1[j]=rOppVar(r, src->block0[i]);
5354  rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5355  if (src->order[i+1]==ringorder_ls)
5356  {
5357  r->order[j]=ringorder_wp;
5358  i++;
5359  //l=rReallocM1(r,l,j);
5360  }
5361  else
5362  {
5363  r->order[j]=ringorder_a;
5364  }
5365  j++;
5366  break;
5367  }
5368  // not yet done:
5369  case ringorder_ls:
5370  case ringorder_rs:
5371  case ringorder_ds:
5372  case ringorder_Ds:
5373  case ringorder_ws:
5374  case ringorder_Ws:
5375  // should not occur:
5376  case ringorder_S:
5377  case ringorder_IS:
5378  case ringorder_s:
5379  case ringorder_aa:
5380  case ringorder_L:
5381  case ringorder_unspec:
5382  Werror("order %s not (yet) supported", rSimpleOrdStr(src->order[i]));
5383  break;
5384  }
5385  }
5386  rComplete(r);
5387 
5388 
5389 #ifdef RDEBUG
5390  rTest(r);
5391 #endif
5392 
5393  //rChangeCurrRing(r);
5394 
5395 #ifdef RDEBUG
5396  rTest(r);
5397 // rWrite(r);
5398 // rDebugPrint(r);
5399 #endif
5400 
5401 
5402 #ifdef HAVE_PLURAL
5403  // now, we initialize a non-comm structure on r
5404  if (rIsPluralRing(src))
5405  {
5406 // assume( currRing == r);
5407 
5408  int *perm = (int *)omAlloc0((rVar(r)+1)*sizeof(int));
5409  int *par_perm = NULL;
5410  nMapFunc nMap = n_SetMap(src->cf,r->cf);
5411  int ni,nj;
5412  for(i=1; i<=r->N; i++)
5413  {
5414  perm[i] = rOppVar(r,i);
5415  }
5416 
5417  matrix C = mpNew(rVar(r),rVar(r));
5418  matrix D = mpNew(rVar(r),rVar(r));
5419 
5420  for (i=1; i< rVar(r); i++)
5421  {
5422  for (j=i+1; j<=rVar(r); j++)
5423  {
5424  ni = r->N +1 - i;
5425  nj = r->N +1 - j; /* i<j ==> nj < ni */
5426 
5427  assume(MATELEM(src->GetNC()->C,i,j) != NULL);
5428  MATELEM(C,nj,ni) = p_PermPoly(MATELEM(src->GetNC()->C,i,j),perm,src,r, nMap,par_perm,rPar(src));
5429 
5430  if(MATELEM(src->GetNC()->D,i,j) != NULL)
5431  MATELEM(D,nj,ni) = p_PermPoly(MATELEM(src->GetNC()->D,i,j),perm,src,r, nMap,par_perm,rPar(src));
5432  }
5433  }
5434 
5435  id_Test((ideal)C, r);
5436  id_Test((ideal)D, r);
5437 
5438  if (nc_CallPlural(C, D, NULL, NULL, r, false, false, true, r)) // no qring setup!
5439  WarnS("Error initializing non-commutative multiplication!");
5440 
5441 #ifdef RDEBUG
5442  rTest(r);
5443 // rWrite(r);
5444 // rDebugPrint(r);
5445 #endif
5446 
5447  assume( r->GetNC()->IsSkewConstant == src->GetNC()->IsSkewConstant);
5448 
5449  omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
5450  }
5451 #endif /* HAVE_PLURAL */
5452 
5453  /* now oppose the qideal for qrings */
5454  if (src->qideal != NULL)
5455  {
5456  id_Delete(&(r->qideal), r);
5457 
5458 #ifdef HAVE_PLURAL
5459  r->qideal = idOppose(src, src->qideal, r); // into the currRing: r
5460 #else
5461  r->qideal = id_Copy(src->qideal, r); // ?
5462 #endif
5463 
5464 #ifdef HAVE_PLURAL
5465  if( rIsPluralRing(r) )
5466  {
5467  nc_SetupQuotient(r);
5468 #ifdef RDEBUG
5469  rTest(r);
5470 // rWrite(r);
5471 // rDebugPrint(r);
5472 #endif
5473  }
5474 #endif
5475  }
5476 #ifdef HAVE_PLURAL
5477  if( rIsPluralRing(r) )
5478  assume( ncRingType(r) == ncRingType(src) );
5479 #endif
5480  rTest(r);
5481 
5482  return r;
5483 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:684
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
opposite of ls
Definition: ring.h:685
ideal id_Copy(ideal h1, const ring r)
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:538
#define id_Test(A, lR)
Definition: simpleideals.h:67
static int rRealloc1(ring r, int size, int pos)
Definition: ring.cc:5121
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
Definition: old.gring.cc:3475
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
const ideal
Definition: gb_hack.h:42
const CanonicalForm CFMap CFMap int &both_non_zero int n
Definition: cfEzgcd.cc:52
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
void id_Delete(ideal *h, ring r)
static void rOppWeight(int *w, int l)
Definition: ring.cc:5144
void * ADDRESS
Definition: auxiliary.h:161
int k
Definition: cfEzgcd.cc:93
#define rOppVar(R, I)
Definition: ring.cc:5155
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
Definition: old.gring.cc:3453
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1281
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:71
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:88
#define rTest(r)
Definition: ring.h:769
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:686
S?
Definition: ring.h:668
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:718
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
Definition: p_polys.cc:3892
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type...
Definition: old.gring.cc:2734
#define NULL
Definition: omList.c:10
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
s?
Definition: ring.h:669
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
#define MATELEM(mat, i, j)
Definition: matpol.h:29
static void rOppWeight ( int w,
int  l 
)
static

Definition at line 5144 of file ring.cc.

5145 {
5146  int i2=(l+1)/2;
5147  for(int j=0; j<=i2; j++)
5148  {
5149  int t=w[j];
5150  w[j]=w[l-j];
5151  w[l-j]=t;
5152  }
5153 }
int j
Definition: myNF.cc:70
const CanonicalForm & w
Definition: facAbsFact.cc:55
int l
Definition: cfEzgcd.cc:94
static void rOptimizeLDeg ( ring  r)
static

Definition at line 3080 of file ring.cc.

3081 {
3082  if (r->pFDeg == p_Deg)
3083  {
3084  if (r->pLDeg == pLDeg1)
3085  r->pLDeg = pLDeg1_Deg;
3086  if (r->pLDeg == pLDeg1c)
3087  r->pLDeg = pLDeg1c_Deg;
3088  }
3089  else if (r->pFDeg == p_Totaldegree)
3090  {
3091  if (r->pLDeg == pLDeg1)
3092  r->pLDeg = pLDeg1_Totaldegree;
3093  if (r->pLDeg == pLDeg1c)
3094  r->pLDeg = pLDeg1c_Totaldegree;
3095  }
3096  else if (r->pFDeg == p_WFirstTotalDegree)
3097  {
3098  if (r->pLDeg == pLDeg1)
3099  r->pLDeg = pLDeg1_WFirstTotalDegree;
3100  if (r->pLDeg == pLDeg1c)
3101  r->pLDeg = pLDeg1c_WFirstTotalDegree;
3102  }
3103  r->pLDegOrig = r->pLDeg;
3104 }
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:840
long pLDeg1c_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1004
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:876
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
long pLDeg1_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:909
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
const ring r
Definition: syzextra.cc:208
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
long pLDeg1_Totaldegree(poly p, int *l, const ring r)
Definition: p_polys.cc:974
long pLDeg1_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1037
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1067
BOOLEAN rOrd_is_MixedDegree_Ordering ( ring  r)

Definition at line 3350 of file ring.cc.

3351 {
3352  int i;
3353  poly p=p_One(r);
3354  p_SetExp(p,1,1,r);p_Setm(p,r);
3355  int vz=sign(p_FDeg(p,r));
3356  for(i=2;i<=rVar(r);i++)
3357  {
3358  p_SetExp(p,i-1,0,r);
3359  p_SetExp(p,i,1,r);
3360  p_Setm(p,r);
3361  if (sign(p_FDeg(p,r))!=vz)
3362  {
3363  p_Delete(&p,r);
3364  return TRUE;
3365  }
3366  }
3367  p_Delete(&p,r);
3368  return FALSE;
3369 }
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
poly p_One(const ring r)
Definition: p_polys.cc:1318
polyrec * poly
Definition: hilb.h:10
static long p_FDeg(const poly p, const ring r)
Definition: p_polys.h:369
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 void p_Setm(poly p, const ring r)
Definition: p_polys.h:436
static int sign(int x)
Definition: ring.cc:3349
BOOLEAN rOrd_is_Totaldegree_Ordering ( const ring  r)

Definition at line 1856 of file ring.cc.

1857 {
1858  // Hmm.... what about Syz orderings?
1859  return (rVar(r) > 1 &&
1860  ((rHasSimpleOrder(r) &&
1861  (rOrder_is_DegOrdering((rRingOrder_t)r->order[0]) ||
1862  rOrder_is_DegOrdering(( rRingOrder_t)r->order[1]))) ||
1863  (rHasSimpleOrderAA(r) &&
1864  (rOrder_is_DegOrdering((rRingOrder_t)r->order[1]) ||
1865  rOrder_is_DegOrdering((rRingOrder_t)r->order[2])))));
1866 }
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
BOOLEAN rOrder_is_DegOrdering(const rRingOrder_t order)
Definition: ring.cc:1771
BOOLEAN rHasSimpleOrder(const ring r)
Definition: ring.cc:1730
BOOLEAN rHasSimpleOrderAA(ring r)
Definition: ring.cc:1805
const ring r
Definition: syzextra.cc:208
rRingOrder_t
order stuff
Definition: ring.h:660
BOOLEAN rOrd_is_WeightedDegree_Ordering ( const ring  r)

Definition at line 1869 of file ring.cc.

1870 {
1871  // Hmm.... what about Syz orderings?
1872  return ((rVar(r) > 1) &&
1873  rHasSimpleOrder(r) &&
1874  (rOrder_is_WeightedOrdering((rRingOrder_t)r->order[0]) ||
1875  rOrder_is_WeightedOrdering(( rRingOrder_t)r->order[1])));
1876 }
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
BOOLEAN rOrder_is_WeightedOrdering(rRingOrder_t order)
Definition: ring.cc:1790
BOOLEAN rHasSimpleOrder(const ring r)
Definition: ring.cc:1730
const ring r
Definition: syzextra.cc:208
rRingOrder_t
order stuff
Definition: ring.h:660
BOOLEAN rOrd_SetCompRequiresSetm ( const ring  r)

return TRUE if p_SetComp requires p_Setm

Definition at line 1836 of file ring.cc.

1837 {
1838  if (r->typ != NULL)
1839  {
1840  int pos;
1841  for (pos=0;pos<r->OrdSize;pos++)
1842  {
1843  sro_ord* o=&(r->typ[pos]);
1844  if ( (o->ord_typ == ro_syzcomp)
1845  || (o->ord_typ == ro_syz)
1846  || (o->ord_typ == ro_is)
1847  || (o->ord_typ == ro_am)
1848  || (o->ord_typ == ro_isTemp))
1849  return TRUE;
1850  }
1851  }
1852  return FALSE;
1853 }
Definition: ring.h:68
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
ro_typ ord_typ
Definition: ring.h:182
const ring r
Definition: syzextra.cc:208
Definition: ring.h:180
Definition: ring.h:69
Definition: ring.h:69
#define NULL
Definition: omList.c:10
Definition: ring.h:62
BOOLEAN rOrder_is_DegOrdering ( const rRingOrder_t  order)

Definition at line 1771 of file ring.cc.

1772 {
1773  switch(order)
1774  {
1775  case ringorder_dp:
1776  case ringorder_Dp:
1777  case ringorder_ds:
1778  case ringorder_Ds:
1779  case ringorder_Ws:
1780  case ringorder_Wp:
1781  case ringorder_ws:
1782  case ringorder_wp:
1783  return TRUE;
1784 
1785  default:
1786  return FALSE;
1787  }
1788 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
BOOLEAN rOrder_is_WeightedOrdering ( rRingOrder_t  order)

Definition at line 1790 of file ring.cc.

1791 {
1792  switch(order)
1793  {
1794  case ringorder_Ws:
1795  case ringorder_Wp:
1796  case ringorder_ws:
1797  case ringorder_wp:
1798  return TRUE;
1799 
1800  default:
1801  return FALSE;
1802  }
1803 }
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int rOrderName ( char *  ordername)

Definition at line 508 of file ring.cc.

509 {
510  int order=ringorder_unspec;
511  while (order!= 0)
512  {
513  if (strcmp(ordername,rSimpleOrdStr(order))==0)
514  break;
515  order--;
516  }
517  if (order==0) Werror("wrong ring order `%s`",ordername);
518  omFree((ADDRESS)ordername);
519  return order;
520 }
void * ADDRESS
Definition: auxiliary.h:161
#define omFree(addr)
Definition: omAllocDecl.h:261
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:88
void Werror(const char *fmt,...)
Definition: reporter.cc:199
char* rOrdStr ( ring  r)

Definition at line 522 of file ring.cc.

523 {
524  if ((r==NULL)||(r->order==NULL)) return omStrDup("");
525  int nblocks,l,i;
526 
527  for (nblocks=0; r->order[nblocks]; nblocks++);
528  nblocks--;
529 
530  StringSetS("");
531  for (l=0; ; l++)
532  {
533  StringAppendS((char *)rSimpleOrdStr(r->order[l]));
534  if (
535  (r->order[l] != ringorder_c)
536  && (r->order[l] != ringorder_C)
537  && (r->order[l] != ringorder_s)
538  && (r->order[l] != ringorder_S)
539  && (r->order[l] != ringorder_IS)
540  )
541  {
542  if (r->wvhdl[l]!=NULL)
543  {
544  StringAppendS("(");
545  for (int j= 0;
546  j<(r->block1[l]-r->block0[l]+1)*(r->block1[l]-r->block0[l]+1);
547  j+=i+1)
548  {
549  char c=',';
550  if(r->order[l]==ringorder_a64)
551  {
552  int64 * w=(int64 *)r->wvhdl[l];
553  for (i = 0; i<r->block1[l]-r->block0[l]; i++)
554  {
555  StringAppend("%lld," ,w[i]);
556  }
557  StringAppend("%lld)" ,w[i]);
558  break;
559  }
560  else
561  {
562  for (i = 0; i<r->block1[l]-r->block0[l]; i++)
563  {
564  StringAppend("%d," ,r->wvhdl[l][i+j]);
565  }
566  }
567  if (r->order[l]!=ringorder_M)
568  {
569  StringAppend("%d)" ,r->wvhdl[l][i+j]);
570  break;
571  }
572  if (j+i+1==(r->block1[l]-r->block0[l]+1)*(r->block1[l]-r->block0[l]+1))
573  c=')';
574  StringAppend("%d%c" ,r->wvhdl[l][i+j],c);
575  }
576  }
577  else
578  StringAppend("(%d)",r->block1[l]-r->block0[l]+1);
579  }
580  else if (r->order[l] == ringorder_IS)
581  {
582  assume( r->block0[l] == r->block1[l] );
583  const int s = r->block0[l];
584  assume( (-2 < s) && (s < 2) );
585 
586  StringAppend("(%d)", s);
587  }
588 
589  if (l==nblocks) return StringEndS();
590  StringAppendS(",");
591  }
592 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
for int64 weights
Definition: ring.h:664
long int64
Definition: auxiliary.h:112
char * StringEndS()
Definition: reporter.cc:151
const ring r
Definition: syzextra.cc:208
for(int i=0;i< R->ExpL_Size;i++) Print("%09lx "
Definition: cfEzgcd.cc:66
int j
Definition: myNF.cc:70
#define assume(x)
Definition: mod2.h:405
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:88
#define StringAppend
Definition: emacs.cc:82
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:686
S?
Definition: ring.h:668
#define NULL
Definition: omList.c:10
const CanonicalForm & w
Definition: facAbsFact.cc:55
s?
Definition: ring.h:669
int l
Definition: cfEzgcd.cc:94
#define omStrDup(s)
Definition: omAllocDecl.h:263
char* rParStr ( ring  r)

Definition at line 620 of file ring.cc.

621 {
622  if ((r==NULL)||(rParameter(r)==NULL)) return omStrDup("");
623 
624  char const * const * const params = rParameter(r);
625 
626  int i;
627  int l=2;
628 
629  for (i=0; i<rPar(r); i++)
630  {
631  l+=strlen(params[i])+1;
632  }
633  char *s=(char *)omAlloc((long)l);
634  s[0]='\0';
635  for (i=0; i<rPar(r)-1; i++)
636  {
637  strcat(s, params[i]);
638  strcat(s,",");
639  }
640  strcat(s, params[i]);
641  return s;
642 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:538
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:564
#define omAlloc(size)
Definition: omAllocDecl.h:210
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94
#define omStrDup(s)
Definition: omAllocDecl.h:263
static int rRealloc1 ( ring  r,
int  size,
int  pos 
)
static

Definition at line 5121 of file ring.cc.

5122 {
5123  r->order=(int*)omReallocSize(r->order, size*sizeof(int), (size+1)*sizeof(int));
5124  r->block0=(int*)omReallocSize(r->block0, size*sizeof(int), (size+1)*sizeof(int));
5125  r->block1=(int*)omReallocSize(r->block1, size*sizeof(int), (size+1)*sizeof(int));
5126  r->wvhdl=(int **)omReallocSize(r->wvhdl,size*sizeof(int *), (size+1)*sizeof(int *));
5127  for(int k=size; k>pos; k--) r->wvhdl[k]=r->wvhdl[k-1];
5128  r->order[size]=0;
5129  size++;
5130  return size;
5131 }
int k
Definition: cfEzgcd.cc:93
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
const ring r
Definition: syzextra.cc:208
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
static void rRightAdjustVarOffset ( ring  r)
static

right-adjust r->VarOffset

Definition at line 3931 of file ring.cc.

3932 {
3933  int* shifts = (int*) omAlloc(r->ExpL_Size*sizeof(int));
3934  int i;
3935  // initialize shifts
3936  for (i=0;i<r->ExpL_Size;i++)
3937  shifts[i] = BIT_SIZEOF_LONG;
3938 
3939  // find minimal bit shift in each long exp entry
3940  for (i=1;i<=r->N;i++)
3941  {
3942  if (shifts[r->VarOffset[i] & 0xffffff] > r->VarOffset[i] >> 24)
3943  shifts[r->VarOffset[i] & 0xffffff] = r->VarOffset[i] >> 24;
3944  }
3945  // reset r->VarOffset: set the minimal shift to 0
3946  for (i=1;i<=r->N;i++)
3947  {
3948  if (shifts[r->VarOffset[i] & 0xffffff] != 0)
3949  r->VarOffset[i]
3950  = (r->VarOffset[i] & 0xffffff) |
3951  (((r->VarOffset[i] >> 24) - shifts[r->VarOffset[i] & 0xffffff]) << 24);
3952  }
3953  omFree(shifts);
3954 }
#define omAlloc(size)
Definition: omAllocDecl.h:210
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
int i
Definition: cfEzgcd.cc:123
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:124
BOOLEAN rRing_has_CompLastBlock ( ring  r)

Definition at line 5073 of file ring.cc.

5074 {
5075  assume(r != NULL);
5076  int lb = rBlocks(r) - 2;
5077  return (r->order[lb] == ringorder_c || r->order[lb] == ringorder_C);
5078 }
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
BOOLEAN rRing_is_Homog ( ring  r)

Definition at line 5051 of file ring.cc.

5052 {
5053  if (r == NULL) return FALSE;
5054  int i, j, nb = rBlocks(r);
5055  for (i=0; i<nb; i++)
5056  {
5057  if (r->wvhdl[i] != NULL)
5058  {
5059  int length = r->block1[i] - r->block0[i];
5060  int* wvhdl = r->wvhdl[i];
5061  if (r->order[i] == ringorder_M) length *= length;
5062  assume(omSizeOfAddr(wvhdl) >= length*sizeof(int));
5063 
5064  for (j=0; j< length; j++)
5065  {
5066  if (wvhdl[j] != 0 && wvhdl[j] != 1) return FALSE;
5067  }
5068  }
5069  }
5070  return TRUE;
5071 }
#define FALSE
Definition: auxiliary.h:140
size_t omSizeOfAddr(const void *addr)
Definition: omAllocSystem.c:97
#define TRUE
Definition: auxiliary.h:144
static int rBlocks(ring r)
Definition: ring.h:507
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
#define NULL
Definition: omList.c:10
BOOLEAN rSamePolyRep ( ring  r1,
ring  r2 
)

returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analogue to rEqual but not so strict

Definition at line 1642 of file ring.cc.

1643 {
1644  int i, j;
1645 
1646  if (r1 == r2) return TRUE;
1647 
1648  if (r1 == NULL || r2 == NULL) return FALSE;
1649 
1650  if ((r1->cf != r2->cf)
1651  || (rVar(r1) != rVar(r2))
1652  || (r1->OrdSgn != r2->OrdSgn))
1653  return FALSE;
1654 
1655  i=0;
1656  while (r1->order[i] != 0)
1657  {
1658  if (r2->order[i] == 0) return FALSE;
1659  if ((r1->order[i] != r2->order[i])
1660  || (r1->block0[i] != r2->block0[i])
1661  || (r1->block1[i] != r2->block1[i]))
1662  return FALSE;
1663  if (r1->wvhdl[i] != NULL)
1664  {
1665  if (r2->wvhdl[i] == NULL)
1666  return FALSE;
1667  for (j=0; j<r1->block1[i]-r1->block0[i]+1; j++)
1668  if (r2->wvhdl[i][j] != r1->wvhdl[i][j])
1669  return FALSE;
1670  }
1671  else if (r2->wvhdl[i] != NULL) return FALSE;
1672  i++;
1673  }
1674  if (r2->order[i] != 0) return FALSE;
1675 
1676  // we do not check variable names
1677  // we do not check minpoly/minideal
1678  // we do not check qideal
1679 
1680  return TRUE;
1681 }
#define FALSE
Definition: auxiliary.h:140
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
#define TRUE
Definition: auxiliary.h:144
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
static void rSetDegStuff ( ring  r)
static

Definition at line 3107 of file ring.cc.

3108 {
3109  int* order = r->order;
3110  int* block0 = r->block0;
3111  int* block1 = r->block1;
3112  int** wvhdl = r->wvhdl;
3113 
3114  if (order[0]==ringorder_S ||order[0]==ringorder_s || order[0]==ringorder_IS)
3115  {
3116  order++;
3117  block0++;
3118  block1++;
3119  wvhdl++;
3120  }
3121  r->LexOrder = FALSE;
3122  r->MixedOrder = FALSE;
3123  r->ComponentOrder = 1;
3124  r->pFDeg = p_Totaldegree;
3125  r->pLDeg = (r->OrdSgn == 1 ? pLDegb : pLDeg0);
3126 
3127  /*======== ordering type is (am,_) ==================*/
3128  if (order[0]==ringorder_am)
3129  {
3130  r->MixedOrder = FALSE;
3131  for(int ii=block0[0];ii<=block1[0];ii++)
3132  if (wvhdl[0][ii-1]<0) { r->MixedOrder=TRUE;break;}
3133  r->LexOrder=FALSE;
3134  for(int ii=block0[0];ii<=block1[0];ii++)
3135  if (wvhdl[0][ii-1]==0) { r->LexOrder=TRUE;break;}
3136  if ((block0[0]==1)&&(block1[0]==r->N))
3137  {
3138  r->pFDeg = p_Deg;
3139  r->pLDeg = pLDeg1c_Deg;
3140  }
3141  else
3142  {
3143  r->pFDeg = p_WTotaldegree;
3144  r->LexOrder=TRUE;
3145  r->pLDeg = pLDeg1c_WFirstTotalDegree;
3146  }
3147  r->firstwv = wvhdl[0];
3148  }
3149  /*======== ordering type is (_,c) =========================*/
3150  else if ((order[0]==ringorder_unspec) || (order[1] == 0)
3151  ||(
3152  ((order[1]==ringorder_c)||(order[1]==ringorder_C)
3153  ||(order[1]==ringorder_S)
3154  ||(order[1]==ringorder_s))
3155  && (order[0]!=ringorder_M)
3156  && (order[2]==0))
3157  )
3158  {
3159  if ((order[0]!=ringorder_unspec)
3160  && ((order[1]==ringorder_C)||(order[1]==ringorder_S)||
3161  (order[1]==ringorder_s)))
3162  r->ComponentOrder=-1;
3163  if (r->OrdSgn == -1) r->pLDeg = pLDeg0c;
3164  if ((order[0] == ringorder_lp)
3165  || (order[0] == ringorder_ls)
3166  || (order[0] == ringorder_rp)
3167  || (order[0] == ringorder_rs))
3168  {
3169  r->LexOrder=TRUE;
3170  r->pLDeg = pLDeg1c;
3171  r->pFDeg = p_Totaldegree;
3172  }
3173  if ((order[0] == ringorder_a)
3174  || (order[0] == ringorder_wp)
3175  || (order[0] == ringorder_Wp)
3176  || (order[0] == ringorder_ws)
3177  || (order[0] == ringorder_Ws))
3178  r->pFDeg = p_WFirstTotalDegree;
3179  r->firstBlockEnds=block1[0];
3180  r->firstwv = wvhdl[0];
3181  }
3182  /*======== ordering type is (c,_) =========================*/
3183  else if (((order[0]==ringorder_c)
3184  ||(order[0]==ringorder_C)
3185  ||(order[0]==ringorder_S)
3186  ||(order[0]==ringorder_s))
3187  && (order[1]!=ringorder_M)
3188  && (order[2]==0))
3189  {
3190  if ((order[0]==ringorder_C)||(order[0]==ringorder_S)||
3191  order[0]==ringorder_s)
3192  r->ComponentOrder=-1;
3193  if ((order[1] == ringorder_lp)
3194  || (order[1] == ringorder_ls)
3195  || (order[1] == ringorder_rp)
3196  || order[1] == ringorder_rs)
3197  {
3198  r->LexOrder=TRUE;
3199  r->pLDeg = pLDeg1c;
3200  r->pFDeg = p_Totaldegree;
3201  }
3202  r->firstBlockEnds=block1[1];
3203  if (wvhdl!=NULL) r->firstwv = wvhdl[1];
3204  if ((order[1] == ringorder_a)
3205  || (order[1] == ringorder_wp)
3206  || (order[1] == ringorder_Wp)
3207  || (order[1] == ringorder_ws)
3208  || (order[1] == ringorder_Ws))
3209  r->pFDeg = p_WFirstTotalDegree;
3210  }
3211  /*------- more than one block ----------------------*/
3212  else
3213  {
3214  if ((r->VectorOut)||(order[0]==ringorder_C)||(order[0]==ringorder_S)||(order[0]==ringorder_s))
3215  {
3216  rSetFirstWv(r, 1, order, block1, wvhdl);
3217  }
3218  else
3219  rSetFirstWv(r, 0, order, block1, wvhdl);
3220 
3221  /*the number of orderings:*/
3222  int i = 0; while (order[++i] != 0);
3223 
3224  do
3225  {
3226  i--;
3227  rHighSet(r, order[i],i);
3228  }
3229  while (i != 0);
3230 
3231  if ((order[0]!=ringorder_c)
3232  && (order[0]!=ringorder_C)
3233  && (order[0]!=ringorder_S)
3234  && (order[0]!=ringorder_s))
3235  {
3236  r->pLDeg = pLDeg1c;
3237  }
3238  else
3239  {
3240  r->pLDeg = pLDeg1;
3241  }
3242  r->pFDeg = p_WTotaldegree; // may be improved: p_Totaldegree for lp/dp/ls/.. blocks
3243  }
3244 
3246  r->pFDeg = p_Deg;
3247 
3248  if( rGetISPos(0, r) != -1 ) // Are there Schreyer induced blocks?
3249  {
3250 #ifndef SING_NDEBUG
3251  assume( r->pFDeg == p_Deg || r->pFDeg == p_WTotaldegree || r->pFDeg == p_Totaldegree);
3252 #endif
3253 
3254  r->pLDeg = pLDeg1; // ?
3255  }
3256 
3257  r->pFDegOrig = r->pFDeg;
3258  // NOTE: this leads to wrong ecart during std
3259  // in Old/sre.tst
3260  rOptimizeLDeg(r); // also sets r->pLDegOrig
3261 
3262 }
static void rHighSet(ring r, int o_r, int o)
Definition: ring.cc:2989
static void rOptimizeLDeg(ring r)
Definition: ring.cc:3080
long pLDeg1(poly p, int *l, const ring r)
Definition: p_polys.cc:840
static void rSetFirstWv(ring r, int i, int *order, int *block1, int **wvhdl)
Definition: ring.cc:3047
long pLDeg1c(poly p, int *l, const ring r)
Definition: p_polys.cc:876
#define FALSE
Definition: auxiliary.h:140
opposite of ls
Definition: ring.h:685
BOOLEAN rOrd_is_WeightedDegree_Ordering(const ring r)
Definition: ring.cc:1869
long pLDeg0c(poly p, int *l, const ring r)
Definition: p_polys.cc:769
#define TRUE
Definition: auxiliary.h:144
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1435
int rGetISPos(const int p, const ring r)
Finds p^th IS ordering, and returns its position in r->typ[] returns -1 if something went wrong! p - ...
Definition: ring.cc:4873
int int kStrategy strat if(h==NULL) return NULL
long pLDeg1c_Deg(poly p, int *l, const ring r)
Definition: p_polys.cc:940
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:586
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:595
long pLDeg0(poly p, int *l, const ring r)
Definition: p_polys.cc:738
BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r)
Definition: ring.cc:1856
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:686
S?
Definition: ring.h:668
long pLDegb(poly p, int *l, const ring r)
Definition: p_polys.cc:810
#define NULL
Definition: omList.c:10
long pLDeg1c_WFirstTotalDegree(poly p, int *l, const ring r)
Definition: p_polys.cc:1067
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:612
s?
Definition: ring.h:669
static void rSetFirstWv ( ring  r,
int  i,
int order,
int block1,
int **  wvhdl 
)
static

Definition at line 3047 of file ring.cc.

3048 {
3049  // cheat for ringorder_aa
3050  if (order[i] == ringorder_aa)
3051  i++;
3052  if(block1[i]!=r->N) r->LexOrder=TRUE;
3053  r->firstBlockEnds=block1[i];
3054  r->firstwv = wvhdl[i];
3055  if ((order[i]== ringorder_ws)
3056  || (order[i]==ringorder_Ws)
3057  || (order[i]== ringorder_wp)
3058  || (order[i]==ringorder_Wp)
3059  || (order[i]== ringorder_a)
3060  /*|| (order[i]==ringorder_A)*/)
3061  {
3062  int j;
3063  for(j=block1[i]-r->block0[i];j>=0;j--)
3064  {
3065  if (r->firstwv[j]<0) r->MixedOrder=TRUE;
3066  if (r->firstwv[j]==0) r->LexOrder=TRUE;
3067  }
3068  }
3069  else if (order[i]==ringorder_a64)
3070  {
3071  int j;
3072  int64 *w=rGetWeightVec(r);
3073  for(j=block1[i]-r->block0[i];j>=0;j--)
3074  {
3075  if (w[j]==0) r->LexOrder=TRUE;
3076  }
3077  }
3078 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:684
for int64 weights
Definition: ring.h:664
long int64
Definition: auxiliary.h:112
#define TRUE
Definition: auxiliary.h:144
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
int i
Definition: cfEzgcd.cc:123
int64 * rGetWeightVec(ring r)
Definition: ring.cc:5101
const CanonicalForm & w
Definition: facAbsFact.cc:55
BOOLEAN rSetISReference ( const ring  r,
const ideal  F,
const int  i,
const int  p 
)

Changes r by setting induced ordering parameters: limit and reference leading terms F belong to r, we will DO a copy! We will use it AS IS! returns true is everything was allright!

Definition at line 4905 of file ring.cc.

4906 {
4907  // Put the reference set F into the ring -ordering -recor
4908 
4909  if (r->typ==NULL)
4910  {
4911  dReportError("Error: WRONG USE of rSetISReference: wrong ring! (typ == NULL)");
4912  return FALSE;
4913  }
4914 
4915 
4916  int pos = rGetISPos(p, r);
4917 
4918  if( pos == -1 )
4919  {
4920  dReportError("Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
4921  return FALSE;
4922  }
4923 
4924 #if MYTEST
4925  if( i != r->typ[pos].data.is.limit )
4926  Print("Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit, i);
4927 #endif
4928 
4929  const ideal FF = idrHeadR(F, r, r); // id_Copy(F, r); // ???
4930 
4931 
4932  if( r->typ[pos].data.is.F != NULL)
4933  {
4934 #if MYTEST
4935  PrintS("Deleting old reference set F... \n"); // idShow(r->typ[pos].data.is.F, r); PrintLn();
4936 #endif
4937  id_Delete(&r->typ[pos].data.is.F, r);
4938  r->typ[pos].data.is.F = NULL;
4939  }
4940 
4941  assume(r->typ[pos].data.is.F == NULL);
4942 
4943  r->typ[pos].data.is.F = FF; // F is owened by ring now! TODO: delete at the end!
4944 
4945  r->typ[pos].data.is.limit = i; // First induced component
4946 
4947 #if MYTEST
4948  PrintS("New reference set FF : \n"); idShow(FF, r, r, 1); PrintLn();
4949 #endif
4950 
4951  return TRUE;
4952 }
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
return P p
Definition: myNF.cc:203
const ideal
Definition: gb_hack.h:42
void id_Delete(ideal *h, ring r)
#define TRUE
Definition: auxiliary.h:144
int rGetISPos(const int p, const ring r)
Finds p^th IS ordering, and returns its position in r->typ[] returns -1 if something went wrong! p - ...
Definition: ring.cc:4873
ideal idrHeadR(ideal id, ring r, ring dest_r)
Copy leading terms of id[i] via prHeeadR into dest_r.
Definition: prCopy.cc:156
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)
Definition: simpleideals.cc:58
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define NULL
Definition: omList.c:10
int dReportError(const char *fmt,...)
Definition: dError.cc:45
static void rSetNegWeight ( ring  r)
static

Definition at line 3267 of file ring.cc.

3268 {
3269  int i,l;
3270  if (r->typ!=NULL)
3271  {
3272  l=0;
3273  for(i=0;i<r->OrdSize;i++)
3274  {
3275  if((r->typ[i].ord_typ==ro_wp_neg)
3276  ||(r->typ[i].ord_typ==ro_am))
3277  l++;
3278  }
3279  if (l>0)
3280  {
3281  r->NegWeightL_Size=l;
3282  r->NegWeightL_Offset=(int *) omAlloc(l*sizeof(int));
3283  l=0;
3284  for(i=0;i<r->OrdSize;i++)
3285  {
3286  if(r->typ[i].ord_typ==ro_wp_neg)
3287  {
3288  r->NegWeightL_Offset[l]=r->typ[i].data.wp.place;
3289  l++;
3290  }
3291  else if(r->typ[i].ord_typ==ro_am)
3292  {
3293  r->NegWeightL_Offset[l]=r->typ[i].data.am.place;
3294  l++;
3295  }
3296  }
3297  return;
3298  }
3299  }
3300  r->NegWeightL_Size = 0;
3301  r->NegWeightL_Offset = NULL;
3302 }
#define omAlloc(size)
Definition: omAllocDecl.h:210
Definition: ring.h:64
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
Definition: ring.h:62
int l
Definition: cfEzgcd.cc:94
static void rSetOption ( ring  r)
static

Definition at line 3304 of file ring.cc.

3305 {
3306  // set redthrough
3307  if (!TEST_OPT_OLDSTD && r->OrdSgn == 1 && ! r->LexOrder)
3308  r->options |= Sy_bit(OPT_REDTHROUGH);
3309  else
3310  r->options &= ~Sy_bit(OPT_REDTHROUGH);
3311 
3312  // set intStrategy
3313  if ( (r->cf->extRing!=NULL)
3314  || rField_is_Q(r)
3315 #ifdef HAVE_RINGS
3316  || rField_is_Ring(r)
3317 #endif
3318  )
3319  r->options |= Sy_bit(OPT_INTSTRATEGY);
3320  else
3321  r->options &= ~Sy_bit(OPT_INTSTRATEGY);
3322 
3323  // set redTail
3324  if (r->LexOrder || r->OrdSgn == -1 || (r->cf->extRing!=NULL))
3325  r->options &= ~Sy_bit(OPT_REDTAIL);
3326  else
3327  r->options |= Sy_bit(OPT_REDTAIL);
3328 }
#define Sy_bit(x)
Definition: options.h:30
const ring r
Definition: syzextra.cc:208
#define OPT_REDTAIL
Definition: options.h:86
#define TEST_OPT_OLDSTD
Definition: options.h:117
static BOOLEAN rField_is_Q(const ring r)
Definition: ring.h:452
#define OPT_INTSTRATEGY
Definition: options.h:87
static BOOLEAN rField_is_Ring(const ring r)
Definition: ring.h:428
#define NULL
Definition: omList.c:10
#define OPT_REDTHROUGH
Definition: options.h:77
static void rSetOutParams ( ring  r)
static

Definition at line 2944 of file ring.cc.

2945 {
2946  r->VectorOut = (r->order[0] == ringorder_c);
2947  r->CanShortOut = TRUE;
2948  {
2949  int i;
2950  if (rParameter(r)!=NULL)
2951  {
2952  for (i=0;i<rPar(r);i++)
2953  {
2954  if(strlen(rParameter(r)[i])>1)
2955  {
2956  r->CanShortOut=FALSE;
2957  break;
2958  }
2959  }
2960  }
2961  if (r->CanShortOut)
2962  {
2963  // Hmm... sometimes (e.g., from maGetPreimage) new variables
2964  // are introduced, but their names are never set
2965  // hence, we do the following awkward trick
2966  int N = omSizeOfAddr(r->names)/sizeof(char*);
2967  if (r->N < N) N = r->N;
2968 
2969  for (i=(N-1);i>=0;i--)
2970  {
2971  if(r->names[i] != NULL && strlen(r->names[i])>1)
2972  {
2973  r->CanShortOut=FALSE;
2974  break;
2975  }
2976  }
2977  }
2978  }
2979  r->ShortOut = r->CanShortOut;
2980 
2981  assume( !( !r->CanShortOut && r->ShortOut ) );
2982 }
#define FALSE
Definition: auxiliary.h:140
size_t omSizeOfAddr(const void *addr)
Definition: omAllocSystem.c:97
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:538
#define TRUE
Definition: auxiliary.h:144
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:564
const ring r
Definition: syzextra.cc:208
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:49
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
void rSetSyzComp ( int  k,
const ring  r 
)

Definition at line 4959 of file ring.cc.

4960 {
4961  if(k < 0)
4962  {
4963  dReportError("rSetSyzComp with negative limit!");
4964  return;
4965  }
4966 
4967  assume( k >= 0 );
4968  if (TEST_OPT_PROT) Print("{%d}", k);
4969  if ((r->typ!=NULL) && (r->typ[0].ord_typ==ro_syz))
4970  {
4971  if( k == r->typ[0].data.syz.limit )
4972  return; // nothing to do
4973 
4974  int i;
4975  if (r->typ[0].data.syz.limit == 0)
4976  {
4977  r->typ[0].data.syz.syz_index = (int*) omAlloc0((k+1)*sizeof(int));
4978  r->typ[0].data.syz.syz_index[0] = 0;
4979  r->typ[0].data.syz.curr_index = 1;
4980  }
4981  else
4982  {
4983  r->typ[0].data.syz.syz_index = (int*)
4984  omReallocSize(r->typ[0].data.syz.syz_index,
4985  (r->typ[0].data.syz.limit+1)*sizeof(int),
4986  (k+1)*sizeof(int));
4987  }
4988  for (i=r->typ[0].data.syz.limit + 1; i<= k; i++)
4989  {
4990  r->typ[0].data.syz.syz_index[i] =
4991  r->typ[0].data.syz.curr_index;
4992  }
4993  if(k < r->typ[0].data.syz.limit) // ?
4994  {
4995 #ifndef SING_NDEBUG
4996  Warn("rSetSyzComp called with smaller limit (%d) as before (%d)", k, r->typ[0].data.syz.limit);
4997 #endif
4998  r->typ[0].data.syz.curr_index = 1 + r->typ[0].data.syz.syz_index[k];
4999  }
5000 
5001 
5002  r->typ[0].data.syz.limit = k;
5003  r->typ[0].data.syz.curr_index++;
5004  }
5005  else if(
5006  (r->typ!=NULL) &&
5007  (r->typ[0].ord_typ==ro_isTemp)
5008  )
5009  {
5010 // (r->typ[currRing->typ[0].data.isTemp.suffixpos].data.is.limit == k)
5011 #ifndef SING_NDEBUG
5012  Warn("rSetSyzComp(%d) in an IS ring! Be careful!", k);
5013 #endif
5014  }
5015  else
5016  if ((r->order[0]!=ringorder_c) && (k!=0)) // ???
5017  {
5018  dReportError("syzcomp in incompatible ring");
5019  }
5020 #ifdef PDEBUG
5021  extern int pDBsyzComp;
5022  pDBsyzComp=k;
5023 #endif
5024 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
int pDBsyzComp
Definition: ring.cc:4955
Definition: ring.h:68
#define Print
Definition: emacs.cc:83
#define TEST_OPT_PROT
Definition: options.h:98
int k
Definition: cfEzgcd.cc:93
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
int i
Definition: cfEzgcd.cc:123
Definition: ring.h:69
#define NULL
Definition: omList.c:10
int dReportError(const char *fmt,...)
Definition: dError.cc:45
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define Warn
Definition: emacs.cc:80
static void rSetVarL ( ring  r)
static

set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex

Definition at line 3875 of file ring.cc.

3876 {
3877  int min = MAX_INT_VAL, min_j = -1;
3878  int* VarL_Number = (int*) omAlloc0(r->ExpL_Size*sizeof(int));
3879 
3880  int i,j;
3881 
3882  // count how often a var long is occupied by an exponent
3883  for (i=1; i<=r->N; i++)
3884  {
3885  VarL_Number[r->VarOffset[i] & 0xffffff]++;
3886  }
3887 
3888  // determine how many and min
3889  for (i=0, j=0; i<r->ExpL_Size; i++)
3890  {
3891  if (VarL_Number[i] != 0)
3892  {
3893  if (min > VarL_Number[i])
3894  {
3895  min = VarL_Number[i];
3896  min_j = j;
3897  }
3898  j++;
3899  }
3900  }
3901 
3902  r->VarL_Size = j; // number of long with exp. entries in
3903  // in p->exp
3904  r->VarL_Offset = (int*) omAlloc(r->VarL_Size*sizeof(int));
3905  r->VarL_LowIndex = 0;
3906 
3907  // set VarL_Offset
3908  for (i=0, j=0; i<r->ExpL_Size; i++)
3909  {
3910  if (VarL_Number[i] != 0)
3911  {
3912  r->VarL_Offset[j] = i;
3913  if (j > 0 && r->VarL_Offset[j-1] != r->VarL_Offset[j] - 1)
3914  r->VarL_LowIndex = -1;
3915  j++;
3916  }
3917  }
3918  if (r->VarL_LowIndex >= 0)
3919  r->VarL_LowIndex = r->VarL_Offset[0];
3920 
3921  r->MinExpPerLong = min;
3922  if (min_j != 0)
3923  {
3924  j = r->VarL_Offset[min_j];
3925  r->VarL_Offset[min_j] = r->VarL_Offset[0];
3926  r->VarL_Offset[0] = j;
3927  }
3928  omFree(VarL_Number);
3929 }
static int min(int a, int b)
Definition: fast_mult.cc:268
#define omAlloc(size)
Definition: omAllocDecl.h:210
const ring r
Definition: syzextra.cc:208
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
const int MAX_INT_VAL
Definition: mylimits.h:12
int i
Definition: cfEzgcd.cc:123
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void rSetWeightVec ( ring  r,
int64 wv 
)

Definition at line 5111 of file ring.cc.

5112 {
5113  assume(r!=NULL);
5114  assume(r->OrdSize>0);
5115  assume(r->typ[0].ord_typ==ro_wp64);
5116  memcpy(r->typ[0].data.wp64.weights64,wv,r->N*sizeof(int64));
5117 }
long int64
Definition: auxiliary.h:112
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
#define NULL
Definition: omList.c:10
Definition: ring.h:63
const char* rSimpleOrdStr ( int  ord)

Definition at line 88 of file ring.cc.

89 {
90  return ringorder_name[ord];
91 }
static const char *const ringorder_name[]
Definition: ring.cc:58
char* rString ( ring  r)

Definition at line 644 of file ring.cc.

645 {
646  if (r!=NULL)
647  {
648  char *ch=rCharStr(r);
649  char *var=rVarStr(r);
650  char *ord=rOrdStr(r);
651  char *res=(char *)omAlloc(strlen(ch)+strlen(var)+strlen(ord)+9);
652  sprintf(res,"(%s),(%s),(%s)",ch,var,ord);
653  omFree((ADDRESS)ch);
654  omFree((ADDRESS)var);
655  omFree((ADDRESS)ord);
656  return res;
657  }
658  else
659  return omStrDup("NULL");
660 }
char * rVarStr(ring r)
Definition: ring.cc:594
void * ADDRESS
Definition: auxiliary.h:161
#define omAlloc(size)
Definition: omAllocDecl.h:210
poly res
Definition: myNF.cc:322
const ring r
Definition: syzextra.cc:208
#define omFree(addr)
Definition: omAllocDecl.h:261
#define NULL
Definition: omList.c:10
char * rCharStr(const ring r)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar...
Definition: ring.cc:618
char * rOrdStr(ring r)
Definition: ring.cc:522
#define omStrDup(s)
Definition: omAllocDecl.h:263
int rSum ( ring  r1,
ring  r2,
ring &  sum 
)

Definition at line 1265 of file ring.cc.

1266 {
1267  if (r1==r2)
1268  {
1269  sum=r1;
1270  r1->ref++;
1271  return 0;
1272  }
1273  return rSumInternal(r1,r2,sum,TRUE,FALSE);
1274 }
int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp)
Definition: ring.cc:720
#define FALSE
Definition: auxiliary.h:140
#define TRUE
Definition: auxiliary.h:144
int rSumInternal ( ring  r1,
ring  r2,
ring &  sum,
BOOLEAN  vartest,
BOOLEAN  dp_dp 
)

Definition at line 720 of file ring.cc.

721 {
722 
723  ip_sring tmpR;
724  memset(&tmpR,0,sizeof(tmpR));
725  /* check coeff. field =====================================================*/
726 
727  if (r1->cf==r2->cf)
728  {
729  tmpR.cf=nCopyCoeff(r1->cf);
730  }
731  else /* different type */
732  {
733  if (getCoeffType(r1->cf)==n_Zp)
734  {
735  if (getCoeffType(r2->cf)==n_Q)
736  {
737  tmpR.cf=nCopyCoeff(r1->cf);
738  }
739  else if (nCoeff_is_Extension(r2->cf) && rChar(r2) == rChar(r1))
740  {
741  /*AlgExtInfo extParam;
742  extParam.r = r2->cf->extRing;
743  extParam.i = r2->cf->extRing->qideal;*/
744  tmpR.cf=nCopyCoeff(r2->cf);
745  }
746  else
747  {
748  WerrorS("Z/p+...");
749  return -1;
750  }
751  }
752  else if (getCoeffType(r1->cf)==n_R)
753  {
754  WerrorS("R+..");
755  return -1;
756  }
757  else if (getCoeffType(r1->cf)==n_Q)
758  {
759  if (getCoeffType(r2->cf)==n_Zp)
760  {
761  tmpR.cf=nCopyCoeff(r2->cf);
762  }
763  else if (nCoeff_is_Extension(r2->cf))
764  {
765  tmpR.cf=nCopyCoeff(r2->cf);
766  }
767  else
768  {
769  WerrorS("Q+...");
770  return -1;
771  }
772  }
773  else if (nCoeff_is_Extension(r1->cf))
774  {
775  if (r1->cf->extRing->cf==r2->cf)
776  {
777  tmpR.cf=nCopyCoeff(r1->cf);
778  }
779  else if (getCoeffType(r1->cf->extRing->cf)==n_Zp && getCoeffType(r2->cf)==n_Q) //r2->cf == n_Zp should have been handled above
780  {
781  tmpR.cf=nCopyCoeff(r1->cf);
782  }
783  else
784  {
785  WerrorS ("coeff sum of two extension fields not implemented");
786  return -1;
787  }
788  }
789  else
790  {
791  WerrorS("coeff sum not yet implemented");
792  return -1;
793  }
794  }
795  /* variable names ========================================================*/
796  int i,j,k;
797  int l=r1->N+r2->N;
798  char **names=(char **)omAlloc0(l*sizeof(char *));
799  k=0;
800 
801  // collect all varnames from r1, except those which are parameters
802  // of r2, or those which are the empty string
803  for (i=0;i<r1->N;i++)
804  {
805  BOOLEAN b=TRUE;
806 
807  if (*(r1->names[i]) == '\0')
808  b = FALSE;
809  else if ((rParameter(r2)!=NULL) && (strlen(r1->names[i])==1))
810  {
811  if (vartest)
812  {
813  for(j=0;j<rPar(r2);j++)
814  {
815  if (strcmp(r1->names[i],rParameter(r2)[j])==0)
816  {
817  b=FALSE;
818  break;
819  }
820  }
821  }
822  }
823 
824  if (b)
825  {
826  //Print("name : %d: %s\n",k,r1->names[i]);
827  names[k]=omStrDup(r1->names[i]);
828  k++;
829  }
830  //else
831  // Print("no name (par1) %s\n",r1->names[i]);
832  }
833  // Add variables from r2, except those which are parameters of r1
834  // those which are empty strings, and those which equal a var of r1
835  for(i=0;i<r2->N;i++)
836  {
837  BOOLEAN b=TRUE;
838 
839  if (*(r2->names[i]) == '\0')
840  b = FALSE;
841  else if ((rParameter(r1)!=NULL) && (strlen(r2->names[i])==1))
842  {
843  if (vartest)
844  {
845  for(j=0;j<rPar(r1);j++)
846  {
847  if (strcmp(r2->names[i],rParameter(r1)[j])==0)
848  {
849  b=FALSE;
850  break;
851  }
852  }
853  }
854  }
855 
856  if (b)
857  {
858  if (vartest)
859  {
860  for(j=0;j<r1->N;j++)
861  {
862  if (strcmp(r1->names[j],r2->names[i])==0)
863  {
864  b=FALSE;
865  break;
866  }
867  }
868  }
869  if (b)
870  {
871  //Print("name : %d : %s\n",k,r2->names[i]);
872  names[k]=omStrDup(r2->names[i]);
873  k++;
874  }
875  //else
876  // Print("no name (var): %s\n",r2->names[i]);
877  }
878  //else
879  // Print("no name (par): %s\n",r2->names[i]);
880  }
881  // check whether we found any vars at all
882  if (k == 0)
883  {
884  names[k]=omStrDup("");
885  k=1;
886  }
887  tmpR.N=k;
888  tmpR.names=names;
889  /* ordering *======================================================== */
890  tmpR.OrdSgn=1;
891  if (dp_dp
892 #ifdef HAVE_PLURAL
893  && !rIsPluralRing(r1) && !rIsPluralRing(r2)
894 #endif
895  )
896  {
897  tmpR.order=(int*)omAlloc(4*sizeof(int));
898  tmpR.block0=(int*)omAlloc0(4*sizeof(int));
899  tmpR.block1=(int*)omAlloc0(4*sizeof(int));
900  tmpR.wvhdl=(int**)omAlloc0(4*sizeof(int *));
901  tmpR.order[0]=ringorder_dp;
902  tmpR.block0[0]=1;
903  tmpR.block1[0]=rVar(r1);
904  if (r2->OrdSgn==1)
905  {
906  if ((r2->block0[0]==1)
907  && (r2->block1[0]==rVar(r2))
908  && ((r2->order[0]==ringorder_wp)
909  || (r2->order[0]==ringorder_Wp)
910  || (r2->order[0]==ringorder_Dp))
911  )
912  {
913  tmpR.order[1]=r2->order[0];
914  if (r2->wvhdl[0]!=NULL)
915  tmpR.wvhdl[1]=(int *)omMemDup(r2->wvhdl[0]);
916  }
917  else
918  tmpR.order[1]=ringorder_dp;
919  }
920  else
921  {
922  tmpR.order[1]=ringorder_ds;
923  tmpR.OrdSgn=-1;
924  }
925  tmpR.block0[1]=rVar(r1)+1;
926  tmpR.block1[1]=rVar(r1)+rVar(r2);
927  tmpR.order[2]=ringorder_C;
928  tmpR.order[3]=0;
929  }
930  else
931  {
932  if ((r1->order[0]==ringorder_unspec)
933  && (r2->order[0]==ringorder_unspec))
934  {
935  tmpR.order=(int*)omAlloc(3*sizeof(int));
936  tmpR.block0=(int*)omAlloc(3*sizeof(int));
937  tmpR.block1=(int*)omAlloc(3*sizeof(int));
938  tmpR.wvhdl=(int**)omAlloc0(3*sizeof(int *));
939  tmpR.order[0]=ringorder_unspec;
940  tmpR.order[1]=ringorder_C;
941  tmpR.order[2]=0;
942  tmpR.block0[0]=1;
943  tmpR.block1[0]=tmpR.N;
944  }
945  else if (l==k) /* r3=r1+r2 */
946  {
947  int b;
948  ring rb;
949  if (r1->order[0]==ringorder_unspec)
950  {
951  /* extend order of r2 to r3 */
952  b=rBlocks(r2);
953  rb=r2;
954  tmpR.OrdSgn=r2->OrdSgn;
955  }
956  else if (r2->order[0]==ringorder_unspec)
957  {
958  /* extend order of r1 to r3 */
959  b=rBlocks(r1);
960  rb=r1;
961  tmpR.OrdSgn=r1->OrdSgn;
962  }
963  else
964  {
965  b=rBlocks(r1)+rBlocks(r2)-2; /* for only one order C, only one 0 */
966  rb=NULL;
967  }
968  tmpR.order=(int*)omAlloc0(b*sizeof(int));
969  tmpR.block0=(int*)omAlloc0(b*sizeof(int));
970  tmpR.block1=(int*)omAlloc0(b*sizeof(int));
971  tmpR.wvhdl=(int**)omAlloc0(b*sizeof(int *));
972  /* weights not implemented yet ...*/
973  if (rb!=NULL)
974  {
975  for (i=0;i<b;i++)
976  {
977  tmpR.order[i]=rb->order[i];
978  tmpR.block0[i]=rb->block0[i];
979  tmpR.block1[i]=rb->block1[i];
980  if (rb->wvhdl[i]!=NULL)
981  WarnS("rSum: weights not implemented");
982  }
983  tmpR.block0[0]=1;
984  }
985  else /* ring sum for complete rings */
986  {
987  for (i=0;r1->order[i]!=0;i++)
988  {
989  tmpR.order[i]=r1->order[i];
990  tmpR.block0[i]=r1->block0[i];
991  tmpR.block1[i]=r1->block1[i];
992  if (r1->wvhdl[i]!=NULL)
993  tmpR.wvhdl[i] = (int*) omMemDup(r1->wvhdl[i]);
994  }
995  j=i;
996  i--;
997  if ((r1->order[i]==ringorder_c)
998  ||(r1->order[i]==ringorder_C))
999  {
1000  j--;
1001  tmpR.order[b-2]=r1->order[i];
1002  }
1003  for (i=0;r2->order[i]!=0;i++)
1004  {
1005  if ((r2->order[i]!=ringorder_c)
1006  &&(r2->order[i]!=ringorder_C))
1007  {
1008  tmpR.order[j]=r2->order[i];
1009  tmpR.block0[j]=r2->block0[i]+rVar(r1);
1010  tmpR.block1[j]=r2->block1[i]+rVar(r1);
1011  if (r2->wvhdl[i]!=NULL)
1012  {
1013  tmpR.wvhdl[j] = (int*) omMemDup(r2->wvhdl[i]);
1014  }
1015  j++;
1016  }
1017  }
1018  if((r1->OrdSgn==-1)||(r2->OrdSgn==-1))
1019  tmpR.OrdSgn=-1;
1020  }
1021  }
1022  else if ((k==rVar(r1)) && (k==rVar(r2))) /* r1 and r2 are "quite"
1023  the same ring */
1024  /* copy r1, because we have the variables from r1 */
1025  {
1026  int b=rBlocks(r1);
1027 
1028  tmpR.order=(int*)omAlloc0(b*sizeof(int));
1029  tmpR.block0=(int*)omAlloc0(b*sizeof(int));
1030  tmpR.block1=(int*)omAlloc0(b*sizeof(int));
1031  tmpR.wvhdl=(int**)omAlloc0(b*sizeof(int *));
1032  /* weights not implemented yet ...*/
1033  for (i=0;i<b;i++)
1034  {
1035  tmpR.order[i]=r1->order[i];
1036  tmpR.block0[i]=r1->block0[i];
1037  tmpR.block1[i]=r1->block1[i];
1038  if (r1->wvhdl[i]!=NULL)
1039  {
1040  tmpR.wvhdl[i] = (int*) omMemDup(r1->wvhdl[i]);
1041  }
1042  }
1043  tmpR.OrdSgn=r1->OrdSgn;
1044  }
1045  else
1046  {
1047  for(i=0;i<k;i++) omFree((ADDRESS)tmpR.names[i]);
1048  omFreeSize((ADDRESS)names,tmpR.N*sizeof(char *));
1049  Werror("difficulties with variables: %d,%d -> %d",rVar(r1),rVar(r2),k);
1050  return -1;
1051  }
1052  }
1053  tmpR.bitmask=si_max(r1->bitmask,r2->bitmask);
1054  sum=(ring)omAllocBin(sip_sring_bin);
1055  memcpy(sum,&tmpR,sizeof(ip_sring));
1056  rComplete(sum);
1057 
1058 //#ifdef RDEBUG
1059 // rDebugPrint(sum);
1060 //#endif
1061 
1062 
1063 
1064 #ifdef HAVE_PLURAL
1065  if(1)
1066  {
1067 // ring old_ring = currRing;
1068 
1069  BOOLEAN R1_is_nc = rIsPluralRing(r1);
1070  BOOLEAN R2_is_nc = rIsPluralRing(r2);
1071 
1072  if ( (R1_is_nc) || (R2_is_nc))
1073  {
1074  ring R1 = nc_rCreateNCcomm_rCopy(r1);
1075  assume( rIsPluralRing(R1) );
1076 
1077 #if 0
1078 #ifdef RDEBUG
1079  rWrite(R1);
1080  rDebugPrint(R1);
1081 #endif
1082 #endif
1083  ring R2 = nc_rCreateNCcomm_rCopy(r2);
1084 #if 0
1085 #ifdef RDEBUG
1086  rWrite(R2);
1087  rDebugPrint(R2);
1088 #endif
1089 #endif
1090 
1091 // rChangeCurrRing(sum); // ?
1092 
1093  // Projections from R_i into Sum:
1094  /* multiplication matrices business: */
1095  /* find permutations of vars and pars */
1096  int *perm1 = (int *)omAlloc0((rVar(R1)+1)*sizeof(int));
1097  int *par_perm1 = NULL;
1098  if (rPar(R1)!=0) par_perm1=(int *)omAlloc0((rPar(R1)+1)*sizeof(int));
1099 
1100  int *perm2 = (int *)omAlloc0((rVar(R2)+1)*sizeof(int));
1101  int *par_perm2 = NULL;
1102  if (rPar(R2)!=0) par_perm2=(int *)omAlloc0((rPar(R2)+1)*sizeof(int));
1103 
1104  maFindPerm(R1->names, rVar(R1), rParameter(R1), rPar(R1),
1105  sum->names, rVar(sum), rParameter(sum), rPar(sum),
1106  perm1, par_perm1, sum->cf->type);
1107 
1108  maFindPerm(R2->names, rVar(R2), rParameter(R2), rPar(R2),
1109  sum->names, rVar(sum), rParameter(sum), rPar(sum),
1110  perm2, par_perm2, sum->cf->type);
1111 
1112 
1113  matrix C1 = R1->GetNC()->C, C2 = R2->GetNC()->C;
1114  matrix D1 = R1->GetNC()->D, D2 = R2->GetNC()->D;
1115 
1116  // !!!! BUG? C1 and C2 might live in different baserings!!!
1117 
1118  int l = rVar(R1) + rVar(R2);
1119 
1120  matrix C = mpNew(l,l);
1121  matrix D = mpNew(l,l);
1122 
1123  for (i = 1; i <= rVar(R1); i++)
1124  for (j= rVar(R1)+1; j <= l; j++)
1125  MATELEM(C,i,j) = p_One(sum); // in 'sum'
1126 
1127  id_Test((ideal)C, sum);
1128 
1129  nMapFunc nMap1 = n_SetMap(R1->cf,sum->cf); /* can change something global: not usable
1130  after the next nSetMap call :( */
1131  // Create blocked C and D matrices:
1132  for (i=1; i<= rVar(R1); i++)
1133  for (j=i+1; j<=rVar(R1); j++)
1134  {
1135  assume(MATELEM(C1,i,j) != NULL);
1136  MATELEM(C,i,j) = p_PermPoly(MATELEM(C1,i,j), perm1, R1, sum, nMap1, par_perm1, rPar(R1)); // need ADD + CMP ops.
1137 
1138  if (MATELEM(D1,i,j) != NULL)
1139  MATELEM(D,i,j) = p_PermPoly(MATELEM(D1,i,j), perm1, R1, sum, nMap1, par_perm1, rPar(R1));
1140  }
1141 
1142  id_Test((ideal)C, sum);
1143  id_Test((ideal)D, sum);
1144 
1145 
1146  nMapFunc nMap2 = n_SetMap(R2->cf,sum->cf); /* can change something global: not usable
1147  after the next nSetMap call :( */
1148  for (i=1; i<= rVar(R2); i++)
1149  for (j=i+1; j<=rVar(R2); j++)
1150  {
1151  assume(MATELEM(C2,i,j) != NULL);
1152  MATELEM(C,rVar(R1)+i,rVar(R1)+j) = p_PermPoly(MATELEM(C2,i,j),perm2,R2,sum, nMap2,par_perm2,rPar(R2));
1153 
1154  if (MATELEM(D2,i,j) != NULL)
1155  MATELEM(D,rVar(R1)+i,rVar(R1)+j) = p_PermPoly(MATELEM(D2,i,j),perm2,R2,sum, nMap2,par_perm2,rPar(R2));
1156  }
1157 
1158  id_Test((ideal)C, sum);
1159  id_Test((ideal)D, sum);
1160 
1161  // Now sum is non-commutative with blocked structure constants!
1162  if (nc_CallPlural(C, D, NULL, NULL, sum, false, false, true, sum))
1163  WarnS("Error initializing non-commutative multiplication!");
1164 
1165  /* delete R1, R2*/
1166 
1167 #if 0
1168 #ifdef RDEBUG
1169  rWrite(sum);
1170  rDebugPrint(sum);
1171 
1172  Print("\nRefs: R1: %d, R2: %d\n", R1->GetNC()->ref, R2->GetNC()->ref);
1173 
1174 #endif
1175 #endif
1176 
1177 
1178  rDelete(R1);
1179  rDelete(R2);
1180 
1181  /* delete perm arrays */
1182  if (perm1!=NULL) omFree((ADDRESS)perm1);
1183  if (perm2!=NULL) omFree((ADDRESS)perm2);
1184  if (par_perm1!=NULL) omFree((ADDRESS)par_perm1);
1185  if (par_perm2!=NULL) omFree((ADDRESS)par_perm2);
1186 
1187 // rChangeCurrRing(old_ring);
1188  }
1189 
1190  }
1191 #endif
1192 
1193  ideal Q=NULL;
1194  ideal Q1=NULL, Q2=NULL;
1195  if (r1->qideal!=NULL)
1196  {
1197 // rChangeCurrRing(sum);
1198 // if (r2->qideal!=NULL)
1199 // {
1200 // WerrorS("todo: qring+qring");
1201 // return -1;
1202 // }
1203 // else
1204 // {}
1205  /* these were defined in the Plural Part above... */
1206  int *perm1 = (int *)omAlloc0((rVar(r1)+1)*sizeof(int));
1207  int *par_perm1 = NULL;
1208  if (rPar(r1)!=0) par_perm1=(int *)omAlloc0((rPar(r1)+1)*sizeof(int));
1209  maFindPerm(r1->names, rVar(r1), rParameter(r1), rPar(r1),
1210  sum->names, rVar(sum), rParameter(sum), rPar(sum),
1211  perm1, par_perm1, sum->cf->type);
1212  nMapFunc nMap1 = n_SetMap(r1->cf,sum->cf);
1213  Q1 = idInit(IDELEMS(r1->qideal),1);
1214 
1215  for (int for_i=0;for_i<IDELEMS(r1->qideal);for_i++)
1216  Q1->m[for_i] = p_PermPoly(
1217  r1->qideal->m[for_i], perm1,
1218  r1, sum,
1219  nMap1,
1220  par_perm1, rPar(r1));
1221 
1222  omFree((ADDRESS)perm1);
1223  }
1224 
1225  if (r2->qideal!=NULL)
1226  {
1227  //if (currRing!=sum)
1228  // rChangeCurrRing(sum);
1229  int *perm2 = (int *)omAlloc0((rVar(r2)+1)*sizeof(int));
1230  int *par_perm2 = NULL;
1231  if (rPar(r2)!=0) par_perm2=(int *)omAlloc0((rPar(r2)+1)*sizeof(int));
1232  maFindPerm(r2->names, rVar(r2), rParameter(r2), rPar(r2),
1233  sum->names, rVar(sum), rParameter(sum), rPar(sum),
1234  perm2, par_perm2, sum->cf->type);
1235  nMapFunc nMap2 = n_SetMap(r2->cf,sum->cf);
1236  Q2 = idInit(IDELEMS(r2->qideal),1);
1237 
1238  for (int for_i=0;for_i<IDELEMS(r2->qideal);for_i++)
1239  Q2->m[for_i] = p_PermPoly(
1240  r2->qideal->m[for_i], perm2,
1241  r2, sum,
1242  nMap2,
1243  par_perm2, rPar(r2));
1244 
1245  omFree((ADDRESS)perm2);
1246  }
1247  if ( (Q1!=NULL) || ( Q2!=NULL))
1248  {
1249  Q = id_SimpleAdd(Q1,Q2,sum);
1250  }
1251  sum->qideal = Q;
1252 
1253 #ifdef HAVE_PLURAL
1254  if( rIsPluralRing(sum) )
1255  nc_SetupQuotient( sum );
1256 #endif
1257  return 1;
1258 }
short N
Definition: ring.h:259
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
#define omMemDup(s)
Definition: omAllocDecl.h:264
n_Procs_s * cf
Definition: ring.h:324
#define Print
Definition: emacs.cc:83
#define FALSE
Definition: auxiliary.h:140
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:538
#define id_Test(A, lR)
Definition: simpleideals.h:67
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
Definition: old.gring.cc:3475
rational (GMP) numbers
Definition: coeffs.h:30
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
{p < 2^31}
Definition: coeffs.h:29
int rChar(ring r)
Definition: ring.cc:684
const ideal
Definition: gb_hack.h:42
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:531
Definition: ring.h:203
#define TRUE
Definition: auxiliary.h:144
void * ADDRESS
Definition: auxiliary.h:161
void WerrorS(const char *s)
Definition: feFopen.cc:23
int k
Definition: cfEzgcd.cc:93
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:564
#define Q
Definition: sirandom.c:25
#define WarnS
Definition: emacs.cc:81
#define omAlloc(size)
Definition: omAllocDecl.h:210
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
void rDebugPrint(ring r)
Definition: ring.cc:3971
int * block0
Definition: ring.h:210
single prescision (6,6) real numbers
Definition: coeffs.h:31
static int rBlocks(ring r)
Definition: ring.h:507
poly p_One(const ring r)
Definition: p_polys.cc:1318
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition: ring.cc:3371
int * order
Definition: ring.h:209
int j
Definition: myNF.cc:70
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:71
D(ideal gnc_gr_bba(const ideal, const ideal, const intvec *, const intvec *, kStrategy, const ring _currRing)) D(ideal gnc_gr_mora(const ideal
Modified Plural's Buchberger's algorithmus.
omBin sip_sring_bin
Definition: ring.cc:54
static int si_max(const int a, const int b)
Definition: auxiliary.h:166
int i
Definition: cfEzgcd.cc:123
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
#define IDELEMS(i)
Definition: simpleideals.h:19
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition: coeffs.h:718
short OrdSgn
Definition: ring.h:261
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:48
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition: coeffs.h:429
ideal idInit(int idsize, int rank)
Definition: simpleideals.cc:40
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar)
Definition: p_polys.cc:3892
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type...
Definition: old.gring.cc:2734
void maFindPerm(char const *const *const preim_names, int preim_n, char const *const *const preim_par, int preim_p, char const *const *const names, int n, char const *const *const par, int nop, int *perm, int *par_perm, n_coeffType ch)
Definition: maps.cc:169
#define NULL
Definition: omList.c:10
int * block1
Definition: ring.h:211
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:448
char ** names
Definition: ring.h:214
ring nc_rCreateNCcomm_rCopy(ring r)
Definition: ring.cc:692
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:839
int ** wvhdl
Definition: ring.h:213
int BOOLEAN
Definition: auxiliary.h:131
const poly b
Definition: syzextra.cc:213
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
#define MATELEM(mat, i, j)
Definition: matpol.h:29
unsigned long bitmask
Definition: ring.h:308
#define omStrDup(s)
Definition: omAllocDecl.h:263
int rTypeOfMatrixOrder ( intvec order)

Definition at line 195 of file ring.cc.

196 {
197  int i=0,j,typ=1;
198  int sz = (int)sqrt((double)(order->length()-2));
199  if ((sz*sz)!=(order->length()-2))
200  {
201  WerrorS("Matrix order is not a square matrix");
202  typ=0;
203  }
204  while ((i<sz) && (typ==1))
205  {
206  j=0;
207  while ((j<sz) && ((*order)[j*sz+i+2]==0)) j++;
208  if (j>=sz)
209  {
210  typ = 0;
211  WerrorS("Matrix order not complete");
212  }
213  else if ((*order)[j*sz+i+2]<0)
214  typ = -1;
215  else
216  i++;
217  }
218  return typ;
219 }
const const intvec const intvec const ring _currRing const const intvec const intvec const ring _currRing int
Definition: gb_hack.h:53
int length() const
Definition: intvec.h:85
void WerrorS(const char *s)
Definition: feFopen.cc:23
int j
Definition: myNF.cc:70
gmp_float sqrt(const gmp_float &a)
Definition: mpr_complex.cc:329
int i
Definition: cfEzgcd.cc:123
void rUnComplete ( ring  r)

Definition at line 3818 of file ring.cc.

3819 {
3820  if (r == NULL) return;
3821  if (r->VarOffset != NULL)
3822  {
3823  if (r->OrdSize!=0 && r->typ != NULL)
3824  {
3825  for(int i = 0; i < r->OrdSize; i++)
3826  if( r->typ[i].ord_typ == ro_is) // Search for suffixes! (prefix have the same VarOffset)
3827  {
3828  id_Delete(&r->typ[i].data.is.F, r);
3829  r->typ[i].data.is.F = NULL; // ?
3830 
3831  if( r->typ[i].data.is.pVarOffset != NULL )
3832  {
3833  omFreeSize((ADDRESS)r->typ[i].data.is.pVarOffset, (r->N +1)*sizeof(int));
3834  r->typ[i].data.is.pVarOffset = NULL; // ?
3835  }
3836  }
3837  else if (r->typ[i].ord_typ == ro_syz)
3838  {
3839  if(r->typ[i].data.syz.limit > 0)
3840  omFreeSize(r->typ[i].data.syz.syz_index, ((r->typ[i].data.syz.limit) +1)*sizeof(int));
3841  r->typ[i].data.syz.syz_index = NULL;
3842  }
3843  else if (r->typ[i].ord_typ == ro_syzcomp)
3844  {
3845  assume( r->typ[i].data.syzcomp.ShiftedComponents == NULL );
3846  assume( r->typ[i].data.syzcomp.Components == NULL );
3847 // WarnS( "rUnComplete : ord_typ == ro_syzcomp was unhandled!!! Possibly memory leak!!!" );
3848 #ifndef SING_NDEBUG
3849 // assume(0);
3850 #endif
3851  }
3852 
3853  omFreeSize((ADDRESS)r->typ,r->OrdSize*sizeof(sro_ord)); r->typ = NULL;
3854  }
3855 
3856  if (r->PolyBin != NULL)
3857  omUnGetSpecBin(&(r->PolyBin));
3858 
3859  omFreeSize((ADDRESS)r->VarOffset, (r->N +1)*sizeof(int));
3860 
3861  if (r->ordsgn != NULL && r->CmpL_Size != 0)
3862  omFreeSize((ADDRESS)r->ordsgn,r->ExpL_Size*sizeof(long));
3863  if (r->p_Procs != NULL)
3864  omFreeSize(r->p_Procs, sizeof(p_Procs_s));
3865  omfreeSize(r->VarL_Offset, r->VarL_Size*sizeof(int));
3866  }
3867  if (r->NegWeightL_Offset!=NULL)
3868  {
3869  omFreeSize(r->NegWeightL_Offset, r->NegWeightL_Size*sizeof(int));
3870  r->NegWeightL_Offset=NULL;
3871  }
3872 }
Definition: ring.h:68
struct p_Procs_s p_Procs_s
Definition: ring.h:29
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void id_Delete(ideal *h, ring r)
#define omfreeSize(addr, size)
Definition: omAllocDecl.h:236
#define omUnGetSpecBin(bin_ptr)
Definition: omBin.h:14
void * ADDRESS
Definition: auxiliary.h:161
const ring r
Definition: syzextra.cc:208
#define assume(x)
Definition: mod2.h:405
Definition: ring.h:180
int i
Definition: cfEzgcd.cc:123
Definition: ring.h:69
#define NULL
Definition: omList.c:10
char* rVarStr ( ring  r)

Definition at line 594 of file ring.cc.

595 {
596  if ((r==NULL)||(r->names==NULL)) return omStrDup("");
597  int i;
598  int l=2;
599  char *s;
600 
601  for (i=0; i<r->N; i++)
602  {
603  l+=strlen(r->names[i])+1;
604  }
605  s=(char *)omAlloc((long)l);
606  s[0]='\0';
607  for (i=0; i<r->N-1; i++)
608  {
609  strcat(s,r->names[i]);
610  strcat(s,",");
611  }
612  strcat(s,r->names[i]);
613  return s;
614 }
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define omAlloc(size)
Definition: omAllocDecl.h:210
const ring r
Definition: syzextra.cc:208
int i
Definition: cfEzgcd.cc:123
#define NULL
Definition: omList.c:10
int l
Definition: cfEzgcd.cc:94
#define omStrDup(s)
Definition: omAllocDecl.h:263
void rWrite ( ring  r,
BOOLEAN  details 
)

Definition at line 236 of file ring.cc.

237 {
238  if ((r==NULL)||(r->order==NULL))
239  return; /*to avoid printing after errors....*/
240 
241  assume(r != NULL);
242  const coeffs C = r->cf;
243  assume(C != NULL);
244 
245  int nblocks=rBlocks(r);
246 
247  // omCheckAddrSize(r,sizeof(ip_sring));
248  omCheckAddrSize(r->order,nblocks*sizeof(int));
249  omCheckAddrSize(r->block0,nblocks*sizeof(int));
250  omCheckAddrSize(r->block1,nblocks*sizeof(int));
251  omCheckAddrSize(r->wvhdl,nblocks*sizeof(int *));
252  omCheckAddrSize(r->names,r->N*sizeof(char *));
253 
254  nblocks--;
255 
256 
257  if( nCoeff_is_algExt(C) )
258  {
259  // NOTE: the following (non-thread-safe!) UGLYNESS
260  // (changing naRing->ShortOut for a while) is due to Hans!
261  // Just think of other ring using the VERY SAME naRing and possible
262  // side-effects...
263  ring R = C->extRing;
264  const BOOLEAN bSaveShortOut = rShortOut(R); R->ShortOut = rShortOut(r) & rCanShortOut(R);
265 
266  n_CoeffWrite(C, details); // for correct printing of minpoly... WHAT AN UGLYNESS!!!
267 
268  R->ShortOut = bSaveShortOut;
269  }
270  else
271  n_CoeffWrite(C, details);
272 // {
273 // PrintS("// characteristic : ");
274 //
275 // char const * const * const params = rParameter(r);
276 //
277 // if (params!=NULL)
278 // {
279 // Print ("// %d parameter : ",rPar(r));
280 //
281 // char const * const * sp= params;
282 // int nop=0;
283 // while (nop<rPar(r))
284 // {
285 // PrintS(*sp);
286 // PrintS(" ");
287 // sp++; nop++;
288 // }
289 // PrintS("\n// minpoly : ");
290 // if ( rField_is_long_C(r) )
291 // {
292 // // i^2+1:
293 // Print("(%s^2+1)\n", params[0]);
294 // }
295 // else if (rMinpolyIsNULL(r))
296 // {
297 // PrintS("0\n");
298 // }
299 // else
300 // {
301 // StringSetS(""); n_Write(r->cf->minpoly, r); PrintS(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s);
302 // }
303 // //if (r->qideal!=NULL)
304 // //{
305 // // iiWriteMatrix((matrix)r->qideal,"// minpolys",1,r,0);
306 // // PrintLn();
307 // //}
308 // }
309 // }
310  Print("// number of vars : %d",r->N);
311 
312  //for (nblocks=0; r->order[nblocks]; nblocks++);
313  nblocks=rBlocks(r)-1;
314 
315  for (int l=0, nlen=0 ; l<nblocks; l++)
316  {
317  int i;
318  Print("\n// block %3d : ",l+1);
319 
320  Print("ordering %s", rSimpleOrdStr(r->order[l]));
321 
322 
323  if (r->order[l] == ringorder_s)
324  {
325  assume( l == 0 );
326 #ifndef SING_NDEBUG
327  Print(" syzcomp at %d",r->typ[l].data.syz.limit);
328 #endif
329  continue;
330  }
331  else if (r->order[l] == ringorder_IS)
332  {
333  assume( r->block0[l] == r->block1[l] );
334  const int s = r->block0[l];
335  assume( (-2 < s) && (s < 2) );
336  Print("(%d)", s); // 0 => prefix! +/-1 => suffix!
337  continue;
338  }
339  else if (
340  ( (r->order[l] >= ringorder_lp)
341  ||(r->order[l] == ringorder_M)
342  ||(r->order[l] == ringorder_a)
343  ||(r->order[l] == ringorder_am)
344  ||(r->order[l] == ringorder_a64)
345  ||(r->order[l] == ringorder_aa) ) && (r->order[l] < ringorder_IS) )
346  {
347  PrintS("\n// : names ");
348  for (i = r->block0[l]-1; i<r->block1[l]; i++)
349  {
350  nlen = strlen(r->names[i]);
351  Print(" %s",r->names[i]);
352  }
353  }
354 
355  if (r->wvhdl[l]!=NULL)
356  {
357  for (int j= 0;
358  j<(r->block1[l]-r->block0[l]+1)*(r->block1[l]-r->block0[l]+1);
359  j+=i)
360  {
361  PrintS("\n// : weights ");
362  for (i = 0; i<=r->block1[l]-r->block0[l]; i++)
363  {
364  if (r->order[l] == ringorder_a64)
365  {
366  int64 *w=(int64 *)r->wvhdl[l];
367  #if SIZEOF_LONG == 4
368  Print("%*lld " ,nlen,w[i+j]);
369  #else
370  Print(" %*ld" ,nlen,w[i+j]);
371  #endif
372  }
373  else
374  Print(" %*d" ,nlen,r->wvhdl[l][i+j]);
375  }
376  if (r->order[l]!=ringorder_M) break;
377  }
378  if (r->order[l]==ringorder_am)
379  {
380  int m=r->wvhdl[l][i];
381  Print("\n// : %d module weights ",m);
382  m+=i;i++;
383  for(;i<=m;i++) Print(" %*d" ,nlen,r->wvhdl[l][i]);
384  }
385  }
386  }
387 #ifdef HAVE_PLURAL
388  if(rIsPluralRing(r))
389  {
390  PrintS("\n// noncommutative relations:");
391  if( details )
392  {
393  poly pl=NULL;
394  int nl;
395  int i,j;
396  for (i = 1; i<r->N; i++)
397  {
398  for (j = i+1; j<=r->N; j++)
399  {
400  nl = n_IsOne(p_GetCoeff(MATELEM(r->GetNC()->C,i,j),r), r->cf);
401  if ( (MATELEM(r->GetNC()->D,i,j)!=NULL) || (!nl) )
402  {
403  Print("\n// %s%s=",r->names[j-1],r->names[i-1]);
404  pl = MATELEM(r->GetNC()->MT[UPMATELEM(i,j,r->N)],1,1);
405  p_Write0(pl, r, r);
406  }
407  }
408  }
409  } else
410  PrintS(" ...");
411 
412 #if MYTEST /*Singularg should not differ from Singular except in error case*/
413  Print("\n// noncommutative type:%d", (int)ncRingType(r));
414  Print("\n// is skew constant:%d",r->GetNC()->IsSkewConstant);
415  if( rIsSCA(r) )
416  {
417  Print("\n// alternating variables: [%d, %d]", scaFirstAltVar(r), scaLastAltVar(r));
418  const ideal Q = SCAQuotient(r); // resides within r!
419  PrintS("\n// quotient of sca by ideal");
420 
421  if (Q!=NULL)
422  {
423 // if (r==currRing)
424 // {
425 // PrintLn();
426  iiWriteMatrix((matrix)Q,"scaQ",1,r,0);
427 // }
428 // else
429 // PrintS(" ...");
430  }
431  else
432  PrintS(" (NULL)");
433  }
434 #endif
435  }
436 #endif
437  if (r->qideal!=NULL)
438  {
439  PrintS("\n// quotient ring from ideal");
440  if( details )
441  {
442  PrintLn();
443  iiWriteMatrix((matrix)r->qideal,"_",1,r,0);
444  } else PrintS(" ...");
445  }
446 }
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:684
ideal SCAQuotient(const ring r)
Definition: sca.h:10
const CanonicalForm int s
Definition: facAbsFact.cc:55
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
for int64 weights
Definition: ring.h:664
void PrintLn()
Definition: reporter.cc:322
#define Print
Definition: emacs.cc:83
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
const ideal
Definition: gb_hack.h:42
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:520
long int64
Definition: auxiliary.h:112
#define Q
Definition: sirandom.c:25
static bool rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:355
static BOOLEAN rCanShortOut(const ring r)
Definition: ring.h:525
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition: matpol.cc:738
static int rBlocks(ring r)
Definition: ring.h:507
const ring r
Definition: syzextra.cc:208
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:906
int j
Definition: myNF.cc:70
polyrec * poly
Definition: hilb.h:10
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:88
int m
Definition: cfEzgcd.cc:119
int i
Definition: cfEzgcd.cc:123
Induced (Schreyer) ordering.
Definition: ring.h:686
void PrintS(const char *s)
Definition: reporter.cc:294
static short scaFirstAltVar(ring r)
Definition: sca.h:18
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:194
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
Definition: coeffs.h:735
#define NULL
Definition: omList.c:10
#define R
Definition: sirandom.c:26
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
#define p_GetCoeff(p, r)
Definition: monomials.h:57
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:175
s?
Definition: ring.h:669
int BOOLEAN
Definition: auxiliary.h:131
int l
Definition: cfEzgcd.cc:94
#define UPMATELEM(i, j, nVar)
Definition: nc.h:44
#define MATELEM(mat, i, j)
Definition: matpol.h:29
static int sign ( int  x)
inlinestatic

Definition at line 3349 of file ring.cc.

3349 { return (x > 0) - (x < 0);}
Variable x
Definition: cfModGcd.cc:4023

Variable Documentation

omBin char_ptr_bin = omGetSpecBin(sizeof(char*))

Definition at line 55 of file ring.cc.

int pDBsyzComp =0

Definition at line 4955 of file ring.cc.

const char* const ringorder_name[]
static
Initial value:
=
{
" ?",
"a",
"A",
"c",
"C",
"M",
"S",
"s",
"lp",
"dp",
"rp",
"Dp",
"wp",
"Wp",
"ls",
"ds",
"Ds",
"ws",
"Ws",
"am",
"L",
"aa",
"rs",
"IS",
" _"
}

Definition at line 58 of file ring.cc.

omBin sip_sring_bin = omGetSpecBin(sizeof(ip_sring))

Definition at line 54 of file ring.cc.