My Project
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
ring.h File Reference
#include "misc/auxiliary.h"
#include "coeffs/coeffs.h"
#include "misc/intvec.h"
#include "misc/int64vec.h"
#include "polys/monomials/monomials.h"

Go to the source code of this file.

Data Structures

struct  sro_dp
 
struct  sro_wp
 
struct  sro_am
 
struct  sro_wp64
 
struct  sro_cp
 
struct  sro_syzcomp
 
struct  sro_syz
 
struct  sro_ISTemp
 
struct  sro_IS
 
struct  sro_ord
 
struct  ring
 
union  sro_ord.data
 

Macros

#define rField_is_Ring(R)   nCoeff_is_Ring((R)->cf)
 
#define rTest(r)   rDBTest(r, __FILE__, __LINE__)
 

Typedefs

typedef idrecidhdl
 
typedef struct p_Procs_s p_Procs_s
 
typedef kBucketkBucket_pt
 
typedef long(* pLDegProc) (poly p, int *length, ring r)
 
typedef long(* pFDegProc) (poly p, ring r)
 
typedef void(* p_SetmProc) (poly p, const ring r)
 
typedef poly(* pShallowCopyDeleteProc) (poly s_p, ring source_r, ring dest_r, omBin dest_bin)
 returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == dest_r->N and that orderings are the same More...
 
typedef skStrategykStrategy
 
typedef poly(* NF_Proc) (ideal, ideal, poly, int, int, const ring _currRing)
 
typedef ideal(* BBA_Proc) (const ideal, const ideal, const intvec *, const intvec *, kStrategy strat, const ring)
 

Enumerations

enum  ro_typ {
  ro_dp , ro_wp , ro_am , ro_wp64 ,
  ro_wp_neg , ro_cp , ro_syzcomp , ro_syz ,
  ro_isTemp , ro_is , ro_none
}
 
enum  rRingOrder_t {
  ringorder_no = 0 , ringorder_a , ringorder_a64 , ringorder_c ,
  ringorder_C , ringorder_M , ringorder_S , ringorder_s ,
  ringorder_lp , ringorder_dp , ringorder_rp , ringorder_Dp ,
  ringorder_wp , ringorder_Wp , ringorder_ls , ringorder_ds ,
  ringorder_Ds , ringorder_ws , ringorder_Ws , ringorder_am ,
  ringorder_L , ringorder_aa , ringorder_rs , ringorder_IS ,
  ringorder_unspec
}
 order stuff More...
 
enum  rOrderType_t {
  rOrderType_General = 0 , rOrderType_CompExp , rOrderType_ExpComp , rOrderType_Exp ,
  rOrderType_Syz , rOrderType_Schreyer , rOrderType_Syz2dpc , rOrderType_ExpNoComp
}
 

Functions

ring rDefault (int ch, int N, char **n)
 
ring rDefault (const coeffs cf, int N, char **n, const rRingOrder_t o=ringorder_lp)
 
ring rDefault (int ch, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl=NULL)
 
ring rDefault (const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl=NULL, unsigned long bitmask=0)
 
unsigned long rGetExpSize (unsigned long bitmask, int &bits, int N)
 
int r_IsRingVar (const char *n, char **names, int N)
 
void rWrite (ring r, BOOLEAN details=FALSE)
 
ring rCopy (ring r)
 
ring rCopy0 (const ring r, BOOLEAN copy_qideal=TRUE, BOOLEAN copy_ordering=TRUE)
 
ring rCopy0AndAddA (ring r, int64vec *wv64, BOOLEAN copy_qideal=TRUE, BOOLEAN copy_ordering=TRUE)
 
ring rOpposite (ring r)
 
ring rEnvelope (ring r)
 
static BOOLEAN rIsPluralRing (const ring r)
 we must always have this test! More...
 
static BOOLEAN rIsLPRing (const ring r)
 
static BOOLEAN rIsNCRing (const ring r)
 
static BOOLEAN rIsRatGRing (const ring r)
 
void rChangeSComps (int *currComponents, long *currShiftedComponents, int length, ring r)
 
void rGetSComps (int **currComponents, long **currShiftedComponents, int *length, ring r)
 
const char * rSimpleOrdStr (int ord)
 
rRingOrder_t rOrderName (char *ordername)
 
char * rOrdStr (ring r)
 
char * rVarStr (ring r)
 
char * rCharStr (ring r)
 TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar. More...
 
char * rString (ring r)
 
int rChar (ring r)
 
char * rParStr (ring r)
 
int rSum (ring r1, ring r2, ring &sum)
 
int rSumInternal (ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp)
 returns -1 for not compatible, 1 for compatible (and sum) dp_dp:0: block ordering, 1: dp,dp, 2: aa(...),dp vartest: check for name conflicts More...
 
BOOLEAN rEqual (ring r1, ring r2, BOOLEAN qr=TRUE)
 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...
 
void rUnComplete (ring r)
 
BOOLEAN rRing_is_Homog (const ring r)
 
BOOLEAN rRing_has_CompLastBlock (const ring r)
 
BOOLEAN rRing_ord_pure_dp (const ring r)
 
BOOLEAN rRing_ord_pure_Dp (const ring r)
 
BOOLEAN rRing_ord_pure_lp (const ring r)
 
static BOOLEAN rField_is_Ring_2toM (const ring r)
 
static BOOLEAN rField_is_Ring_PtoM (const ring r)
 
static BOOLEAN rField_is_Domain (const ring r)
 
static BOOLEAN rField_has_Units (const ring r)
 
static BOOLEAN rField_is_Zp (const ring r)
 
static BOOLEAN rField_is_Zp (const ring r, int p)
 
static BOOLEAN rField_is_Q (const ring r)
 
static BOOLEAN rField_is_Z (const ring r)
 
static BOOLEAN rField_is_Zn (const ring r)
 
static BOOLEAN rField_is_numeric (const ring r)
 
static BOOLEAN rField_is_R (const ring r)
 
static BOOLEAN rField_is_GF (const ring r)
 
static BOOLEAN rField_is_GF (const ring r, int q)
 
static BOOLEAN rField_is_Zp_a (const ring r)
 
static BOOLEAN rField_is_Zp_a (const ring r, int p)
 
static BOOLEAN rField_is_Q_a (const ring r)
 
static BOOLEAN rField_is_long_R (const ring r)
 
static BOOLEAN rField_is_long_C (const ring r)
 
static BOOLEAN rField_has_simple_inverse (const ring r)
 
static BOOLEAN rField_has_simple_Alloc (const ring r)
 Z/p, GF(p,n), R: nCopy, nNew, nDelete are dummies. More...
 
static n_coeffType rFieldType (const ring r)
 the type of the coefficient filed of r (n_Zp, n_Q, etc) More...
 
BOOLEAN rComplete (ring r, int force=0)
 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 p_SetGlobals (const ring r, BOOLEAN complete=TRUE)
 set all properties of a new ring - also called by rComplete More...
 
static int rBlocks (ring r)
 
static char * rRingVar (short i, const ring r)
 
static BOOLEAN rShortOut (const ring r)
 
static BOOLEAN rCanShortOut (const ring r)
 
static short rVar (const ring r)
 #define rVar(r) (r->N) More...
 
static int rPar (const ring r)
 (r->cf->P) More...
 
static char const ** rParameter (const ring r)
 (r->cf->parameter) More...
 
static number n_Param (const short iParameter, const ring r)
 return the specified parameter as a (new!) number in the given polynomial ring, or NULL if invalid parameters (as variables) begin with 1! More...
 
int n_IsParam (number m, const ring r)
 if m == var(i)/1 => return i, More...
 
static int rInternalChar (const ring r)
 
static BOOLEAN rMinpolyIsNULL (const ring r)
 Tests whether '(r->cf->minpoly) == NULL'. More...
 
static BOOLEAN rIsSyzIndexRing (const ring r)
 
static int rGetCurrSyzLimit (const ring r)
 
void rSetSyzComp (int k, const ring r)
 
ring rAssure_HasComp (const ring r)
 
ring rAssure_SyzOrder (const ring r, BOOLEAN complete)
 
ring rAssure_SyzComp (const ring r, BOOLEAN complete=TRUE)
 
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)
 
ring rAssure_c_dp (const ring r)
 
ring rAssure_CompLastBlock (const ring r, BOOLEAN complete=TRUE)
 makes sure that c/C ordering is last ordering More...
 
ring rAssure_SyzComp_CompLastBlock (const ring r)
 makes sure that c/C ordering is last ordering and SyzIndex is first More...
 
ring rAssure_TDeg (const ring r, int &pos)
 
int rGetMaxSyzComp (int i, const ring r)
 return the max-comonent wchich has syzIndex i Assume: i<= syzIndex_limit More...
 
BOOLEAN rHasSimpleOrder (const ring r)
 
BOOLEAN rHas_c_Ordering (const ring r)
 
BOOLEAN rHasSimpleLexOrder (const ring r)
 returns TRUE, if simple lp or ls ordering More...
 
BOOLEAN rHasGlobalOrdering (const ring r)
 
BOOLEAN rHasLocalOrMixedOrdering (const ring r)
 
BOOLEAN rHasMixedOrdering (const ring r)
 
BOOLEAN rOrd_is_Totaldegree_Ordering (const ring r)
 
BOOLEAN rOrd_SetCompRequiresSetm (const ring r)
 return TRUE if p_SetComp requires p_Setm More...
 
rOrderType_t rGetOrderType (ring r)
 
BOOLEAN rIsPolyVar (int i, const ring r)
 returns TRUE if var(i) belongs to p-block More...
 
static BOOLEAN rOrd_is_Comp_dp (const ring r)
 
BOOLEAN rDBTest (ring r, const char *fn, const int l)
 
ring rModifyRing (ring r, BOOLEAN omit_degree, BOOLEAN omit_comp, unsigned long exp_limit)
 
ring rModifyRing_Wp (ring r, int *weights)
 construct Wp, C ring More...
 
void rModify_a_to_A (ring r)
 
void rKillModifiedRing (ring r)
 
void rKillModified_Wp_Ring (ring r)
 
ring rModifyRing_Simple (ring r, BOOLEAN omit_degree, BOOLEAN omit_comp, unsigned long exp_limit, BOOLEAN &simple)
 
void rDebugPrint (const ring r)
 
void p_DebugPrint (poly p, const ring r)
 
int64rGetWeightVec (const ring r)
 
void rSetWeightVec (ring r, int64 *wv)
 
poly rGetVar (const int varIndex, const ring r)
 
BOOLEAN rSetISReference (const ring r, const ideal F, const int i=0, const int p=0)
 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...
 
int rGetISPos (const int p, const ring r)
 return the position of the p^th IS block order block in r->typ[]... More...
 
void pISUpdateComponents (ideal F, const intvec *const V, const int MIN, const ring r)
 
BOOLEAN rCheckIV (const intvec *iv)
 
int rTypeOfMatrixOrder (const intvec *order)
 
void rDelete (ring r)
 unconditionally deletes fields in r More...
 
ring rPlusVar (const ring r, char *v, int left)
 K[x],"y" -> K[x,y] resp. K[y,x]. More...
 
ring rMinusVar (const ring r, char *v)
 undo rPlusVar More...
 
static ring rIncRefCnt (ring r)
 
static void rDecRefCnt (ring r)
 

Variables

EXTERN_VAR omBin sip_sring_bin
 

Data Structure Documentation

◆ sro_dp

struct sro_dp

Definition at line 113 of file ring.h.

Data Fields
short end
short place
short start

◆ sro_wp

struct sro_wp

Definition at line 122 of file ring.h.

Data Fields
short end
short place
short start
int * weights

◆ sro_am

struct sro_am

Definition at line 132 of file ring.h.

Data Fields
short end
short len_gen
short place
short start
int * weights
int * weights_m

◆ sro_wp64

struct sro_wp64

Definition at line 147 of file ring.h.

Data Fields
short end
short place
short start
int64 * weights64

◆ sro_cp

struct sro_cp

Definition at line 157 of file ring.h.

Data Fields
short end
short place
short start

◆ sro_syzcomp

struct sro_syzcomp

Definition at line 166 of file ring.h.

Data Fields
int * Components
long length
short place
long * ShiftedComponents

◆ sro_syz

struct sro_syz

Definition at line 178 of file ring.h.

Data Fields
int curr_index
int limit
short place
int * syz_index

◆ sro_ISTemp

struct sro_ISTemp

Definition at line 194 of file ring.h.

Data Fields
int * pVarOffset
short start
int suffixpos

◆ sro_IS

struct sro_IS

Definition at line 204 of file ring.h.

Data Fields
short end
ideal F
int limit
int * pVarOffset
short start

◆ sro_ord

struct sro_ord

Definition at line 218 of file ring.h.

Data Fields
union sro_ord.data data
ro_typ ord_typ
int order_index

◆ sro_ord.data

union sro_ord.data

Definition at line 222 of file ring.h.

Data Fields
sro_am am
sro_cp cp
sro_dp dp
sro_IS is
sro_ISTemp isTemp
sro_syz syz
sro_syzcomp syzcomp
sro_wp wp
sro_wp64 wp64

Macro Definition Documentation

◆ rField_is_Ring

#define rField_is_Ring (   R)    nCoeff_is_Ring((R)->cf)

Definition at line 486 of file ring.h.

◆ rTest

#define rTest (   r)    rDBTest(r, __FILE__, __LINE__)

Definition at line 786 of file ring.h.

Typedef Documentation

◆ BBA_Proc

typedef ideal(* BBA_Proc) (const ideal, const ideal, const intvec *, const intvec *, kStrategy strat, const ring)

Definition at line 244 of file ring.h.

◆ idhdl

typedef idrec* idhdl

Definition at line 21 of file ring.h.

◆ kBucket_pt

typedef kBucket* kBucket_pt

Definition at line 25 of file ring.h.

◆ kStrategy

Definition at line 241 of file ring.h.

◆ NF_Proc

typedef poly(* NF_Proc) (ideal, ideal, poly, int, int, const ring _currRing)

Definition at line 243 of file ring.h.

◆ p_Procs_s

typedef struct p_Procs_s p_Procs_s

Definition at line 23 of file ring.h.

◆ p_SetmProc

typedef void(* p_SetmProc) (poly p, const ring r)

Definition at line 39 of file ring.h.

◆ pFDegProc

typedef long(* pFDegProc) (poly p, ring r)

Definition at line 38 of file ring.h.

◆ pLDegProc

typedef long(* pLDegProc) (poly p, int *length, ring r)

Definition at line 37 of file ring.h.

◆ pShallowCopyDeleteProc

typedef poly(* pShallowCopyDeleteProc) (poly s_p, ring source_r, ring dest_r, omBin dest_bin)

returns a poly from dest_r which is a ShallowCopy of s_p from source_r assumes that source_r->N == dest_r->N and that orderings are the same

Definition at line 44 of file ring.h.

Enumeration Type Documentation

◆ ro_typ

enum ro_typ
Enumerator
ro_dp 
ro_wp 
ro_am 
ro_wp64 
ro_wp_neg 
ro_cp 
ro_syzcomp 
ro_syz 
ro_isTemp 
ro_is 
ro_none 

Definition at line 50 of file ring.h.

51{
52 ro_dp, // total degree with weights 1
53 ro_wp, // total weighted degree with weights>0 in wvhdl
54 ro_am, // weights for vars + weights for gen
55 ro_wp64, // weighted64 degree weights in wvhdl
56 ro_wp_neg, // total weighted degree with weights in Z in wvhdl
57 // (with possibly negative weights)
58 ro_cp, // ??ordering duplicates variables
59 ro_syzcomp, // ??ordering indicates "subset" of component number (ringorder_S)
60 ro_syz, // component number if <=syzcomp else 0 (ringorder_s)
61 ro_isTemp, ro_is, // ??Induced Syzygy (Schreyer) ordering (and prefix data placeholder dummy) (ringorder_IS)
63}
@ ro_wp64
Definition: ring.h:55
@ ro_syz
Definition: ring.h:60
@ ro_cp
Definition: ring.h:58
@ ro_dp
Definition: ring.h:52
@ ro_is
Definition: ring.h:61
@ ro_wp_neg
Definition: ring.h:56
@ ro_wp
Definition: ring.h:53
@ ro_isTemp
Definition: ring.h:61
@ ro_am
Definition: ring.h:54
@ ro_none
Definition: ring.h:62
@ ro_syzcomp
Definition: ring.h:59

◆ rOrderType_t

Enumerator
rOrderType_General 

non-simple ordering as specified by currRing

rOrderType_CompExp 

simple ordering, component has priority

rOrderType_ExpComp 

simple ordering, exponent vector has priority component not compatible with exp-vector order

rOrderType_Exp 

simple ordering, exponent vector has priority component is compatible with exp-vector order

rOrderType_Syz 

syzygy ordering

rOrderType_Schreyer 

Schreyer ordering.

rOrderType_Syz2dpc 

syzcomp2dpc

rOrderType_ExpNoComp 

simple ordering, differences in component are not considered

Definition at line 97 of file ring.h.

98{
99 rOrderType_General = 0, ///< non-simple ordering as specified by currRing
100 rOrderType_CompExp, ///< simple ordering, component has priority
101 rOrderType_ExpComp, ///< simple ordering, exponent vector has priority
102 ///< component not compatible with exp-vector order
103 rOrderType_Exp, ///< simple ordering, exponent vector has priority
104 ///< component is compatible with exp-vector order
105 rOrderType_Syz, ///< syzygy ordering
106 rOrderType_Schreyer, ///< Schreyer ordering
107 rOrderType_Syz2dpc, ///< syzcomp2dpc
108 rOrderType_ExpNoComp ///< simple ordering, differences in component are
109 ///< not considered
rOrderType_t
Definition: ring.h:98
@ rOrderType_Syz
syzygy ordering
Definition: ring.h:105
@ rOrderType_Syz2dpc
syzcomp2dpc
Definition: ring.h:107
@ rOrderType_CompExp
simple ordering, component has priority
Definition: ring.h:100
@ rOrderType_Exp
simple ordering, exponent vector has priority component is compatible with exp-vector order
Definition: ring.h:103
@ rOrderType_General
non-simple ordering as specified by currRing
Definition: ring.h:99
@ rOrderType_Schreyer
Schreyer ordering.
Definition: ring.h:106
@ rOrderType_ExpNoComp
simple ordering, differences in component are not considered
Definition: ring.h:108
@ rOrderType_ExpComp
simple ordering, exponent vector has priority component not compatible with exp-vector order
Definition: ring.h:101

◆ rRingOrder_t

order stuff

Enumerator
ringorder_no 
ringorder_a 
ringorder_a64 

for int64 weights

ringorder_c 
ringorder_C 
ringorder_M 
ringorder_S 

S?

ringorder_s 

s?

ringorder_lp 
ringorder_dp 
ringorder_rp 
ringorder_Dp 
ringorder_wp 
ringorder_Wp 
ringorder_ls 
ringorder_ds 
ringorder_Ds 
ringorder_ws 
ringorder_Ws 
ringorder_am 
ringorder_L 
ringorder_aa 

for idElimination, like a, except pFDeg, pWeigths ignore it

ringorder_rs 

opposite of ls

ringorder_IS 

Induced (Schreyer) ordering.

ringorder_unspec 

Definition at line 67 of file ring.h.

68{
69 ringorder_no = 0,
71 ringorder_a64, ///< for int64 weights
75 ringorder_S, ///< S?
76 ringorder_s, ///< s?
90 // the following are only used internally
91 ringorder_aa, ///< for idElimination, like a, except pFDeg, pWeigths ignore it
92 ringorder_rs, ///< opposite of ls
93 ringorder_IS, ///< Induced (Schreyer) ordering
rRingOrder_t
order stuff
Definition: ring.h:68
@ ringorder_lp
Definition: ring.h:77
@ ringorder_a
Definition: ring.h:70
@ ringorder_am
Definition: ring.h:88
@ ringorder_a64
for int64 weights
Definition: ring.h:71
@ ringorder_rs
opposite of ls
Definition: ring.h:92
@ ringorder_C
Definition: ring.h:73
@ ringorder_S
S?
Definition: ring.h:75
@ ringorder_ds
Definition: ring.h:84
@ ringorder_Dp
Definition: ring.h:80
@ ringorder_unspec
Definition: ring.h:94
@ ringorder_L
Definition: ring.h:89
@ ringorder_Ds
Definition: ring.h:85
@ ringorder_dp
Definition: ring.h:78
@ ringorder_c
Definition: ring.h:72
@ ringorder_rp
Definition: ring.h:79
@ ringorder_aa
for idElimination, like a, except pFDeg, pWeigths ignore it
Definition: ring.h:91
@ ringorder_no
Definition: ring.h:69
@ ringorder_Wp
Definition: ring.h:82
@ ringorder_ws
Definition: ring.h:86
@ ringorder_Ws
Definition: ring.h:87
@ ringorder_IS
Induced (Schreyer) ordering.
Definition: ring.h:93
@ ringorder_ls
Definition: ring.h:83
@ ringorder_s
s?
Definition: ring.h:76
@ ringorder_wp
Definition: ring.h:81
@ ringorder_M
Definition: ring.h:74

Function Documentation

◆ n_IsParam()

int n_IsParam ( const number  m,
const ring  r 
)

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

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

Definition at line 5758 of file ring.cc.

5759{
5760 assume(r != NULL);
5761 const coeffs C = r->cf;
5762 assume(C != NULL);
5763
5765
5766 const n_coeffType _filed_type = getCoeffType(C);
5767
5768 if(( _filed_type == n_algExt )||( _filed_type == n_polyExt ))
5769 return naIsParam(m, C);
5770
5771 if( _filed_type == n_transExt )
5772 return ntIsParam(m, C);
5773
5774 Werror("n_IsParam: IsParam is not to be used for (coeff_type = %d)",getCoeffType(C));
5775
5776 return 0;
5777}
int naIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
Definition: algext.cc:1096
int m
Definition: cfEzgcd.cc:128
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition: coeffs.h:846
n_coeffType
Definition: coeffs.h:27
@ n_polyExt
used to represent polys as coeffcients
Definition: coeffs.h:34
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition: coeffs.h:35
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition: coeffs.h:38
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:421
#define assume(x)
Definition: mod2.h:387
The main handler for Singular numbers which are suitable for Singular polynomials.
#define NULL
Definition: omList.c:12
void Werror(const char *fmt,...)
Definition: reporter.cc:189
int ntIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
Definition: transext.cc:2216

◆ n_Param()

static number n_Param ( const short  iParameter,
const ring  r 
)
inlinestatic

return the specified parameter as a (new!) number in the given polynomial ring, or NULL if invalid parameters (as variables) begin with 1!

Definition at line 653 of file ring.h.

654{
655 assume(r != NULL);
656 const coeffs C = r->cf;
657 assume(C != NULL);
658 return n_Param(iParameter, C);
659// const n_coeffType _filed_type = getCoeffType(C);
660//
661// if ( iParameter <= 0 || iParameter > rPar(r) )
662// // Wrong parameter
663// return NULL;
664//
665// if( _filed_type == n_algExt )
666// return naParameter(iParameter, C);
667//
668// if( _filed_type == n_transExt )
669// return ntParameter(iParameter, C);
670//
671// if (_filed_type == n_GF)// if (nCoeff_is_GF(C))
672// {
673// number nfPar (int i, const coeffs);
674// return nfPar(iParameter, C);
675// }
676//
677// if (_filed_type == n_long_C) // if (nCoeff_is_long_C(C))
678// {
679// number ngcPar(int i, const coeffs r);
680// return ngcPar(iParameter, C);
681// }
682//
683// return NULL;
684}
static number n_Param(const short iParameter, const ring r)
return the specified parameter as a (new!) number in the given polynomial ring, or NULL if invalid pa...
Definition: ring.h:653

◆ p_DebugPrint()

void p_DebugPrint ( poly  p,
const ring  r 
)

Definition at line 4272 of file ring.cc.

4273{
4274 int i,j;
4275 p_Write(p,r);
4276 j=2;
4277 while(p!=NULL)
4278 {
4279 Print("\nexp[0..%d]\n",r->ExpL_Size-1);
4280 for(i=0;i<r->ExpL_Size;i++)
4281 Print("%ld ",p->exp[i]);
4282 PrintLn();
4283 Print("v0:%ld ",p_GetComp(p, r));
4284 for(i=1;i<=r->N;i++) Print(" v%d:%ld",i,p_GetExp(p,i, r));
4285 PrintLn();
4286 pIter(p);
4287 j--;
4288 if (j==0) { PrintS("...\n"); break; }
4289 }
4290}
int i
Definition: cfEzgcd.cc:132
int p
Definition: cfModGcd.cc:4077
#define Print
Definition: emacs.cc:80
int j
Definition: facHensel.cc:110
#define p_GetComp(p, r)
Definition: monomials.h:64
#define pIter(p)
Definition: monomials.h:37
void p_Write(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:342
static long p_GetExp(const poly p, const unsigned long iBitmask, const int VarOffset)
get a single variable exponent @Note: the integer VarOffset encodes:
Definition: p_polys.h:469
void PrintS(const char *s)
Definition: reporter.cc:284
void PrintLn()
Definition: reporter.cc:310

◆ p_SetGlobals()

void p_SetGlobals ( const ring  r,
BOOLEAN  complete = TRUE 
)

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

Definition at line 3360 of file ring.cc.

3361{
3362// // // if (r->ppNoether!=NULL) p_Delete(&r->ppNoether,r); // ???
3363
3364 r->pLexOrder=r->LexOrder;
3365 if (complete)
3366 {
3367 si_opt_1 &= ~ TEST_RINGDEP_OPTS;
3368 si_opt_1 |= r->options;
3369 }
3370}
VAR unsigned si_opt_1
Definition: options.c:5

◆ pISUpdateComponents()

void pISUpdateComponents ( ideal  F,
const intvec *const  V,
const int  MIN,
const ring  r 
)

Definition at line 4309 of file ring.cc.

4310{
4311 assume( V != NULL );
4312 assume( MIN >= 0 );
4313
4314 if( F == NULL )
4315 return;
4316
4317 for( int j = (F->ncols*F->nrows) - 1; j >= 0; j-- )
4318 {
4319#ifdef PDEBUG
4320 Print("F[%d]:", j);
4321 p_wrp(F->m[j], r);
4322#endif
4323
4324 for( poly p = F->m[j]; p != NULL; pIter(p) )
4325 {
4326 int c = p_GetComp(p, r);
4327
4328 if( c > MIN )
4329 {
4330#ifdef PDEBUG
4331 Print("gen[%d] -> gen(%d)\n", c, MIN + (*V)[ c - MIN - 1 ]);
4332#endif
4333
4334 p_SetComp( p, MIN + (*V)[ c - MIN - 1 ], r );
4335 }
4336 }
4337#ifdef PDEBUG
4338 Print("new F[%d]:", j);
4339 p_Test(F->m[j], r);
4340 p_wrp(F->m[j], r);
4341#endif
4342 }
4343}
#define MIN(a, b)
Definition: omDebug.c:102
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:247
#define p_Test(p, r)
Definition: p_polys.h:162
void p_wrp(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:373

◆ r_IsRingVar()

int r_IsRingVar ( const char *  n,
char **  names,
int  N 
)

Definition at line 212 of file ring.cc.

213{
214 if (names!=NULL)
215 {
216 for (int i=0; i<N; i++)
217 {
218 if (names[i]==NULL) return -1;
219 if (strcmp(n,names[i]) == 0) return (int)i;
220 }
221 }
222 return -1;
223}
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56

◆ rAssure_C_dp()

ring rAssure_C_dp ( const ring  r)

Definition at line 4926 of file ring.cc.

4927{
4929}
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
Definition: ring.cc:4759

◆ rAssure_c_dp()

ring rAssure_c_dp ( const ring  r)

Definition at line 4931 of file ring.cc.

4932{
4934}

◆ rAssure_CompLastBlock()

ring rAssure_CompLastBlock ( const ring  r,
BOOLEAN  complete = TRUE 
)

makes sure that c/C ordering is last ordering

Definition at line 4649 of file ring.cc.

4650{
4651 int last_block = rBlocks(r) - 2;
4652 if (r->order[last_block] != ringorder_c &&
4653 r->order[last_block] != ringorder_C)
4654 {
4655 int c_pos = 0;
4656 int i;
4657
4658 for (i=0; i< last_block; i++)
4659 {
4660 if (r->order[i] == ringorder_c || r->order[i] == ringorder_C)
4661 {
4662 c_pos = i;
4663 break;
4664 }
4665 }
4666 if (c_pos != -1)
4667 {
4668 ring new_r = rCopy0(r, FALSE, TRUE);
4669 for (i=c_pos+1; i<=last_block; i++)
4670 {
4671 new_r->order[i-1] = new_r->order[i];
4672 new_r->block0[i-1] = new_r->block0[i];
4673 new_r->block1[i-1] = new_r->block1[i];
4674 new_r->wvhdl[i-1] = new_r->wvhdl[i];
4675 }
4676 new_r->order[last_block] = r->order[c_pos];
4677 new_r->block0[last_block] = r->block0[c_pos];
4678 new_r->block1[last_block] = r->block1[c_pos];
4679 new_r->wvhdl[last_block] = r->wvhdl[c_pos];
4680 if (complete)
4681 {
4682 rComplete(new_r, 1);
4683
4684#ifdef HAVE_PLURAL
4685 if (rIsPluralRing(r))
4686 {
4687 if ( nc_rComplete(r, new_r, false) ) // no qideal!
4688 {
4689#ifndef SING_NDEBUG
4690 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4691#endif
4692 }
4693 }
4694 assume(rIsPluralRing(r) == rIsPluralRing(new_r));
4695#endif
4696 }
4697 return new_r;
4698 }
4699 }
4700 return r;
4701}
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
#define WarnS
Definition: emacs.cc:78
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:3395
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition: ring.cc:5647
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition: ring.cc:1363
static int rBlocks(ring r)
Definition: ring.h:569
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400

◆ rAssure_dp_C()

ring rAssure_dp_C ( const ring  r)

Definition at line 4921 of file ring.cc.

4922{
4924}

◆ rAssure_dp_S()

ring rAssure_dp_S ( const ring  r)

Definition at line 4916 of file ring.cc.

4917{
4919}

◆ rAssure_HasComp()

ring rAssure_HasComp ( const ring  r)

Definition at line 4594 of file ring.cc.

4595{
4596 int last_block;
4597 int i=0;
4598 do
4599 {
4600 if (r->order[i] == ringorder_c ||
4601 r->order[i] == ringorder_C) return r;
4602 if (r->order[i] == 0)
4603 break;
4604 i++;
4605 } while (1);
4606 //WarnS("re-creating ring with comps");
4607 last_block=i-1;
4608
4609 ring new_r = rCopy0(r, FALSE, FALSE);
4610 i+=2;
4611 new_r->wvhdl=(int **)omAlloc0(i * sizeof(int *));
4612 new_r->order = (rRingOrder_t *) omAlloc0(i * sizeof(rRingOrder_t));
4613 new_r->block0 = (int *) omAlloc0(i * sizeof(int));
4614 new_r->block1 = (int *) omAlloc0(i * sizeof(int));
4615 memcpy(new_r->order,r->order,(i-1) * sizeof(rRingOrder_t));
4616 memcpy(new_r->block0,r->block0,(i-1) * sizeof(int));
4617 memcpy(new_r->block1,r->block1,(i-1) * sizeof(int));
4618 for (int j=0; j<=last_block; j++)
4619 {
4620 if (r->wvhdl[j]!=NULL)
4621 {
4622 new_r->wvhdl[j] = (int*) omMemDup(r->wvhdl[j]);
4623 }
4624 }
4625 last_block++;
4626 new_r->order[last_block]=ringorder_C;
4627 //new_r->block0[last_block]=0;
4628 //new_r->block1[last_block]=0;
4629 //new_r->wvhdl[last_block]=NULL;
4630
4631 rComplete(new_r, 1);
4632
4633#ifdef HAVE_PLURAL
4634 if (rIsPluralRing(r))
4635 {
4636 if ( nc_rComplete(r, new_r, false) ) // no qideal!
4637 {
4638#ifndef SING_NDEBUG
4639 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4640#endif
4641 }
4642 }
4643 assume(rIsPluralRing(r) == rIsPluralRing(new_r));
4644#endif
4645
4646 return new_r;
4647}
#define omAlloc0(size)
Definition: omAllocDecl.h:211
#define omMemDup(s)
Definition: omAllocDecl.h:264

◆ rAssure_InducedSchreyerOrdering()

ring rAssure_InducedSchreyerOrdering ( const ring  r,
BOOLEAN  complete = TRUE,
int  sgn = 1 
)

Definition at line 4805 of file ring.cc.

4806{ // TODO: ???? Add leading Syz-comp ordering here...????
4807
4808#if MYTEST
4809 Print("rAssure_InducedSchreyerOrdering(r, complete = %d, sgn = %d): r: \n", complete, sgn);
4810 rWrite(r);
4811#ifdef RDEBUG
4812 rDebugPrint(r);
4813#endif
4814 PrintLn();
4815#endif
4816 assume((sgn == 1) || (sgn == -1));
4817
4818 ring res=rCopy0(r, FALSE, FALSE); // No qideal & ordering copy.
4819
4820 int n = rBlocks(r); // Including trailing zero!
4821
4822 // Create 2 more blocks for prefix/suffix:
4823 res->order=(rRingOrder_t *)omAlloc0((n+2)*sizeof(rRingOrder_t)); // 0 .. n+1
4824 res->block0=(int *)omAlloc0((n+2)*sizeof(int));
4825 res->block1=(int *)omAlloc0((n+2)*sizeof(int));
4826 int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
4827
4828 // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
4829 // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
4830
4831 // new 1st block
4832 int j = 0;
4833 res->order[j] = ringorder_IS; // Prefix
4834 res->block0[j] = res->block1[j] = 0;
4835 // wvhdl[j] = NULL;
4836 j++;
4837
4838 for(int i = 0; (i <= n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
4839 {
4840 res->order [j] = r->order [i];
4841 res->block0[j] = r->block0[i];
4842 res->block1[j] = r->block1[i];
4843
4844 if (r->wvhdl[i] != NULL)
4845 {
4846 wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
4847 } // else wvhdl[j] = NULL;
4848 }
4849
4850 // new last block
4851 res->order [j] = ringorder_IS; // Suffix
4852 res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
4853 // wvhdl[j] = NULL;
4854 j++;
4855
4856 // res->order [j] = 0; // The End!
4857 res->wvhdl = wvhdl;
4858
4859 // j == the last zero block now!
4860 assume(j == (n+1));
4861 assume(res->order[0]==ringorder_IS);
4862 assume(res->order[j-1]==ringorder_IS);
4863 assume(res->order[j]==0);
4864
4865
4866 if (complete)
4867 {
4868 rComplete(res, 1);
4869
4870#ifdef HAVE_PLURAL
4871 if (rIsPluralRing(r))
4872 {
4873 if ( nc_rComplete(r, res, false) ) // no qideal!
4874 {
4875#ifndef SING_NDEBUG
4876 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4877#endif
4878 }
4879 }
4881#endif
4882
4883
4884#ifdef HAVE_PLURAL
4885 ring old_ring = r;
4886#endif
4887
4888 if (r->qideal!=NULL)
4889 {
4890 res->qideal= idrCopyR_NoSort(r->qideal, r, res);
4891
4892 assume(id_RankFreeModule(res->qideal, res) == 0);
4893
4894#ifdef HAVE_PLURAL
4895 if( rIsPluralRing(res) )
4896 if( nc_SetupQuotient(res, r, true) )
4897 {
4898// WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
4899 }
4900
4901#endif
4902 assume(id_RankFreeModule(res->qideal, res) == 0);
4903 }
4904
4905#ifdef HAVE_PLURAL
4906 assume((res->qideal==NULL) == (old_ring->qideal==NULL));
4907 assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
4908 assume(rIsSCA(res) == rIsSCA(old_ring));
4909 assume(ncRingType(res) == ncRingType(old_ring));
4910#endif
4911 }
4912
4913 return res;
4914}
int sgn(const Rational &a)
Definition: GMPrat.cc:430
CanonicalForm res
Definition: facAbsFact.cc:60
static bool rIsSCA(const ring r)
Definition: nc.h:190
bool nc_SetupQuotient(ring rGR, const ring rG=NULL, bool bCopy=false)
Definition: old.gring.cc:3403
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:159
ideal idrCopyR_NoSort(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:204
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:226
void rDebugPrint(const ring r)
Definition: ring.cc:4067
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s

◆ rAssure_SyzComp()

ring rAssure_SyzComp ( const ring  r,
BOOLEAN  complete = TRUE 
)

Definition at line 4418 of file ring.cc.

4419{
4420 if ( r->order[0] == ringorder_s ) return r;
4421
4422 if ( r->order[0] == ringorder_IS )
4423 {
4424#ifndef SING_NDEBUG
4425 WarnS("rAssure_SyzComp: input ring has an IS-ordering!");
4426#endif
4427// return r;
4428 }
4429 ring res=rCopy0(r, FALSE, FALSE);
4430 int i=rBlocks(r);
4431 int j;
4432
4433 res->order=(rRingOrder_t *)omAlloc((i+1)*sizeof(rRingOrder_t));
4434 res->block0=(int *)omAlloc0((i+1)*sizeof(int));
4435 res->block1=(int *)omAlloc0((i+1)*sizeof(int));
4436 int ** wvhdl =(int **)omAlloc0((i+1)*sizeof(int**));
4437 for(j=i;j>0;j--)
4438 {
4439 res->order[j]=r->order[j-1];
4440 res->block0[j]=r->block0[j-1];
4441 res->block1[j]=r->block1[j-1];
4442 if (r->wvhdl[j-1] != NULL)
4443 {
4444 wvhdl[j] = (int*) omMemDup(r->wvhdl[j-1]);
4445 }
4446 }
4447 res->order[0]=ringorder_s;
4448
4449 res->wvhdl = wvhdl;
4450
4451 if (complete)
4452 {
4453 rComplete(res, 1);
4454#ifdef HAVE_PLURAL
4455 if (rIsPluralRing(r))
4456 {
4457 if ( nc_rComplete(r, res, false) ) // no qideal!
4458 {
4459#ifndef SING_NDEBUG
4460 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4461#endif
4462 }
4463 }
4465#endif
4466
4467#ifdef HAVE_PLURAL
4468 ring old_ring = r;
4469#endif
4470 if (r->qideal!=NULL)
4471 {
4472 res->qideal= idrCopyR_NoSort(r->qideal, r, res);
4473 assume(id_RankFreeModule(res->qideal, res) == 0);
4474#ifdef HAVE_PLURAL
4475 if( rIsPluralRing(res) )
4476 {
4477 if( nc_SetupQuotient(res, r, true) )
4478 {
4479// WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
4480 }
4481 assume(id_RankFreeModule(res->qideal, res) == 0);
4482 }
4483#endif
4484 }
4485
4486#ifdef HAVE_PLURAL
4487 assume((res->qideal==NULL) == (old_ring->qideal==NULL));
4488 assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
4489 assume(rIsSCA(res) == rIsSCA(old_ring));
4490 assume(ncRingType(res) == ncRingType(old_ring));
4491#endif
4492 }
4493 return res;
4494}
#define omAlloc(size)
Definition: omAllocDecl.h:210

◆ rAssure_SyzComp_CompLastBlock()

ring rAssure_SyzComp_CompLastBlock ( const ring  r)

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

? rChangeCurrRing(new_r);

Definition at line 4704 of file ring.cc.

4705{
4706 rTest(r);
4707
4708 ring new_r_1 = rAssure_CompLastBlock(r, FALSE); // due to this FALSE - no completion!
4709 ring new_r = rAssure_SyzComp(new_r_1, FALSE); // new_r_1 is used only here!!!
4710
4711 if (new_r == r)
4712 return r;
4713
4714 ring old_r = r;
4715 if (new_r_1 != new_r && new_r_1 != old_r) rDelete(new_r_1);
4716
4717 rComplete(new_r, TRUE);
4718#ifdef HAVE_PLURAL
4719 if (rIsPluralRing(old_r))
4720 {
4721 if ( nc_rComplete(old_r, new_r, false) ) // no qideal!
4722 {
4723# ifndef SING_NDEBUG
4724 WarnS("error in nc_rComplete"); // cleanup? rDelete(res); return r; // just go on...?
4725# endif
4726 }
4727 }
4728#endif
4729
4730///? rChangeCurrRing(new_r);
4731 if (old_r->qideal != NULL)
4732 {
4733 new_r->qideal = idrCopyR(old_r->qideal, old_r, new_r);
4734 }
4735
4736#ifdef HAVE_PLURAL
4737 if( rIsPluralRing(old_r) )
4738 if( nc_SetupQuotient(new_r, old_r, true) )
4739 {
4740#ifndef SING_NDEBUG
4741 WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
4742#endif
4743 }
4744#endif
4745
4746#ifdef HAVE_PLURAL
4747 assume((new_r->qideal==NULL) == (old_r->qideal==NULL));
4748 assume(rIsPluralRing(new_r) == rIsPluralRing(old_r));
4749 assume(rIsSCA(new_r) == rIsSCA(old_r));
4750 assume(ncRingType(new_r) == ncRingType(old_r));
4751#endif
4752
4753 rTest(new_r);
4754 rTest(old_r);
4755 return new_r;
4756}
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition: prCopy.cc:191
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition: ring.cc:4418
void rDelete(ring r)
unconditionally deletes fields in r
Definition: ring.cc:449
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
Definition: ring.cc:4649
#define rTest(r)
Definition: ring.h:786

◆ rAssure_SyzOrder()

ring rAssure_SyzOrder ( const ring  r,
BOOLEAN  complete 
)

Definition at line 4413 of file ring.cc.

4414{
4415 if ( r->order[0] == ringorder_c ) return r;
4416 return rAssure_SyzComp(r,complete);
4417}

◆ rAssure_TDeg()

ring rAssure_TDeg ( const ring  r,
int &  pos 
)

Definition at line 4496 of file ring.cc.

4497{
4498 if (r->N==1) // special: dp(1)==lp(1)== no entry in typ
4499 {
4500 pos=r->VarL_LowIndex;
4501 return r;
4502 }
4503 if (r->typ!=NULL)
4504 {
4505 for(int i=r->OrdSize-1;i>=0;i--)
4506 {
4507 if ((r->typ[i].ord_typ==ro_dp)
4508 && (r->typ[i].data.dp.start==1)
4509 && (r->typ[i].data.dp.end==r->N))
4510 {
4511 pos=r->typ[i].data.dp.place;
4512 //printf("no change, pos=%d\n",pos);
4513 return r;
4514 }
4515 }
4516 }
4517
4518#ifdef HAVE_PLURAL
4519 nc_struct* save=r->GetNC();
4520 r->GetNC()=NULL;
4521#endif
4522 ring res=rCopy(r);
4523 if (res->qideal!=NULL)
4524 {
4525 id_Delete(&res->qideal,r);
4526 }
4527
4528 int j;
4529
4530 res->ExpL_Size=r->ExpL_Size+1; // one word more in each monom
4531 res->PolyBin=omGetSpecBin(POLYSIZE + (res->ExpL_Size)*sizeof(long));
4532 omFree((ADDRESS)res->ordsgn);
4533 res->ordsgn=(long *)omAlloc0(res->ExpL_Size*sizeof(long));
4534 for(j=0;j<r->CmpL_Size;j++)
4535 {
4536 res->ordsgn[j] = r->ordsgn[j];
4537 }
4538 res->OrdSize=r->OrdSize+1; // one block more for pSetm
4539 if (r->typ!=NULL)
4540 omFree((ADDRESS)res->typ);
4541 res->typ=(sro_ord*)omAlloc0(res->OrdSize*sizeof(sro_ord));
4542 if (r->typ!=NULL)
4543 memcpy(res->typ,r->typ,r->OrdSize*sizeof(sro_ord));
4544 // the additional block for pSetm: total degree at the last word
4545 // but not included in the compare part
4546 res->typ[res->OrdSize-1].ord_typ=ro_dp;
4547 res->typ[res->OrdSize-1].data.dp.start=1;
4548 res->typ[res->OrdSize-1].data.dp.end=res->N;
4549 res->typ[res->OrdSize-1].data.dp.place=res->ExpL_Size-1;
4550 pos=res->ExpL_Size-1;
4551 //res->pOrdIndex=pos; //NO: think of a(1,0),dp !
4552 extern void p_Setm_General(poly p, ring r);
4553 res->p_Setm=p_Setm_General;
4554 // ----------------------------
4555 omFree((ADDRESS)res->p_Procs);
4556 res->p_Procs = (p_Procs_s*)omAlloc(sizeof(p_Procs_s));
4557
4558 p_ProcsSet(res, res->p_Procs);
4559#ifdef HAVE_PLURAL
4560 r->GetNC()=save;
4561 if (rIsPluralRing(r))
4562 {
4563 if ( nc_rComplete(r, res, false) ) // no qideal!
4564 {
4565#ifndef SING_NDEBUG
4566 WarnS("error in nc_rComplete");
4567#endif
4568 // just go on..
4569 }
4570 }
4571#endif
4572 if (r->qideal!=NULL)
4573 {
4574 res->qideal=idrCopyR_NoSort(r->qideal,r, res);
4575#ifdef HAVE_PLURAL
4576 if (rIsPluralRing(res))
4577 {
4578// nc_SetupQuotient(res, currRing);
4579 nc_SetupQuotient(res, r); // ?
4580 }
4581 assume((res->qideal==NULL) == (r->qideal==NULL));
4582#endif
4583 }
4584
4585#ifdef HAVE_PLURAL
4587 assume(rIsSCA(res) == rIsSCA(r));
4589#endif
4590
4591 return res;
4592}
void * ADDRESS
Definition: auxiliary.h:119
#define POLYSIZE
Definition: monomials.h:233
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omGetSpecBin(size)
Definition: omBin.h:11
void p_ProcsSet(ring r, p_Procs_s *p_Procs)
Definition: p_Procs_Set.h:141
void p_Setm_General(poly p, const ring r)
Definition: p_polys.cc:158
ring rCopy(ring r)
Definition: ring.cc:1645
struct p_Procs_s p_Procs_s
Definition: ring.h:23
Definition: ring.h:219
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition: nc.h:68

◆ rBlocks()

static int rBlocks ( ring  r)
inlinestatic

Definition at line 569 of file ring.h.

570{
571 assume(r != NULL);
572 int i=0;
573 while (r->order[i]!=0) i++;
574 return i+1;
575}

◆ rCanShortOut()

static BOOLEAN rCanShortOut ( const ring  r)
inlinestatic

Definition at line 587 of file ring.h.

588{
589 assume(r != NULL); return (r->CanShortOut);
590}

◆ rChangeSComps()

void rChangeSComps ( int *  currComponents,
long *  currShiftedComponents,
int  length,
ring  r 
)

Definition at line 4388 of file ring.cc.

4389{
4390#ifdef PDEBUG
4391 rDBChangeSComps(currComponents, currShiftedComponents, length, r);
4392#else
4393 rNChangeSComps(currComponents, currShiftedComponents, r);
4394#endif
4395}
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257
static void rNChangeSComps(int *currComponents, long *currShiftedComponents, ring r)
Definition: ring.cc:4350
static void rDBChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition: ring.cc:4366
EXTERN_VAR long * currShiftedComponents
Definition: syz.h:118

◆ rChar()

int rChar ( ring  r)

Definition at line 711 of file ring.cc.

711{ return r->cf->ch; }

◆ rCharStr()

char * rCharStr ( ring  r)

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

Definition at line 645 of file ring.cc.

645{ assume( r != NULL ); return nCoeffString(r->cf); }
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:959

◆ rCheckIV()

BOOLEAN rCheckIV ( const intvec iv)

Definition at line 175 of file ring.cc.

176{
177 if ((iv->length()!=2)&&(iv->length()!=3))
178 {
179 WerrorS("weights only for orderings wp,ws,Wp,Ws,a,M");
180 return TRUE;
181 }
182 return FALSE;
183}
int length() const
Definition: intvec.h:94
void WerrorS(const char *s)
Definition: feFopen.cc:24

◆ rComplete()

BOOLEAN rComplete ( ring  r,
int  force = 0 
)

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 3395 of file ring.cc.

3396{
3397 if (r->VarOffset!=NULL && force == 0) return FALSE;
3398 rSetOutParams(r);
3399 int n=rBlocks(r)-1;
3400 int i;
3401 int bits;
3402 r->bitmask=rGetExpSize(r->wanted_maxExp,bits,r->N);
3403 r->BitsPerExp = bits;
3404 r->ExpPerLong = BIT_SIZEOF_LONG / bits;
3405 r->divmask=rGetDivMask(bits);
3406
3407 // will be used for ordsgn:
3408 long *tmp_ordsgn=(long *)omAlloc0(3*(n+r->N)*sizeof(long));
3409 // will be used for VarOffset:
3410 int *v=(int *)omAlloc((r->N+1)*sizeof(int));
3411 for(i=r->N; i>=0 ; i--)
3412 {
3413 v[i]=-1;
3414 }
3415 sro_ord *tmp_typ=(sro_ord *)omAlloc0(3*(n+r->N)*sizeof(sro_ord));
3416 int typ_i=0;
3417 int prev_ordsgn=0;
3418
3419 // fill in v, tmp_typ, tmp_ordsgn, determine typ_i (== ordSize)
3420 int j=0;
3421 int j_bits=BITS_PER_LONG;
3422
3423 BOOLEAN need_to_add_comp=FALSE; // Only for ringorder_s and ringorder_S!
3424
3425 for(i=0;i<n;i++)
3426 {
3427 tmp_typ[typ_i].order_index=i;
3428 switch (r->order[i])
3429 {
3430 case ringorder_a:
3431 case ringorder_aa:
3432 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3433 r->wvhdl[i]);
3434 typ_i++;
3435 break;
3436
3437 case ringorder_am:
3438 rO_WMDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3439 r->wvhdl[i]);
3440 typ_i++;
3441 break;
3442
3443 case ringorder_a64:
3444 rO_WDegree64(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3445 tmp_typ[typ_i], (int64 *)(r->wvhdl[i]));
3446 typ_i++;
3447 break;
3448
3449 case ringorder_c:
3450 rO_Align(j, j_bits);
3451 rO_LexVars_neg(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3452 r->ComponentOrder=1;
3453 break;
3454
3455 case ringorder_C:
3456 rO_Align(j, j_bits);
3457 rO_LexVars(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3458 r->ComponentOrder=-1;
3459 break;
3460
3461 case ringorder_M:
3462 {
3463 int k,l;
3464 k=r->block1[i]-r->block0[i]+1; // number of vars
3465 for(l=0;l<k;l++)
3466 {
3467 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3468 tmp_typ[typ_i],
3469 r->wvhdl[i]+(r->block1[i]-r->block0[i]+1)*l);
3470 typ_i++;
3471 }
3472 break;
3473 }
3474
3475 case ringorder_lp:
3476 rO_LexVars(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3477 tmp_ordsgn,v,bits, -1);
3478 break;
3479
3480 case ringorder_ls:
3481 rO_LexVars_neg(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3482 tmp_ordsgn,v, bits, -1);
3483 break;
3484
3485 case ringorder_rs:
3486 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3487 tmp_ordsgn,v, bits, -1);
3488 break;
3489
3490 case ringorder_rp:
3491 rO_LexVars(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3492 tmp_ordsgn,v, bits, -1);
3493 break;
3494
3495 case ringorder_dp:
3496 if (r->block0[i]==r->block1[i])
3497 {
3498 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3499 tmp_ordsgn,v, bits, -1);
3500 }
3501 else
3502 {
3503 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3504 tmp_typ[typ_i]);
3505 typ_i++;
3506 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i]+1,
3507 prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3508 }
3509 break;
3510
3511 case ringorder_Dp:
3512 if (r->block0[i]==r->block1[i])
3513 {
3514 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3515 tmp_ordsgn,v, bits, -1);
3516 }
3517 else
3518 {
3519 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3520 tmp_typ[typ_i]);
3521 typ_i++;
3522 rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3523 tmp_ordsgn,v, bits, r->block1[i]);
3524 }
3525 break;
3526
3527 case ringorder_ds:
3528 if (r->block0[i]==r->block1[i])
3529 {
3530 rO_LexVars_neg(j, j_bits,r->block0[i],r->block1[i],prev_ordsgn,
3531 tmp_ordsgn,v,bits, -1);
3532 }
3533 else
3534 {
3535 rO_TDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3536 tmp_typ[typ_i]);
3537 typ_i++;
3538 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i]+1,
3539 prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3540 }
3541 break;
3542
3543 case ringorder_Ds:
3544 if (r->block0[i]==r->block1[i])
3545 {
3546 rO_LexVars_neg(j, j_bits, r->block0[i],r->block0[i],prev_ordsgn,
3547 tmp_ordsgn,v, bits, -1);
3548 }
3549 else
3550 {
3551 rO_TDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3552 tmp_typ[typ_i]);
3553 typ_i++;
3554 rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3555 tmp_ordsgn,v, bits, r->block1[i]);
3556 }
3557 break;
3558
3559 case ringorder_wp:
3560 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3561 tmp_typ[typ_i], r->wvhdl[i]);
3562 typ_i++;
3563 { // check for weights <=0
3564 int jj;
3565 BOOLEAN have_bad_weights=FALSE;
3566 for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3567 {
3568 if (r->wvhdl[i][jj]<=0) have_bad_weights=TRUE;
3569 }
3570 if (have_bad_weights)
3571 {
3572 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3573 tmp_typ[typ_i]);
3574 typ_i++;
3575 }
3576 }
3577 if (r->block1[i]!=r->block0[i])
3578 {
3579 rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3580 tmp_ordsgn, v,bits, r->block0[i]);
3581 }
3582 break;
3583
3584 case ringorder_Wp:
3585 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3586 tmp_typ[typ_i], r->wvhdl[i]);
3587 typ_i++;
3588 { // check for weights <=0
3589 int jj;
3590 BOOLEAN have_bad_weights=FALSE;
3591 for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3592 {
3593 if (r->wvhdl[i][jj]<=0) have_bad_weights=TRUE;
3594 }
3595 if (have_bad_weights)
3596 {
3597 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3598 tmp_typ[typ_i]);
3599 typ_i++;
3600 }
3601 }
3602 if (r->block1[i]!=r->block0[i])
3603 {
3604 rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3605 tmp_ordsgn,v, bits, r->block1[i]);
3606 }
3607 break;
3608
3609 case ringorder_ws:
3610 rO_WDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3611 tmp_typ[typ_i], r->wvhdl[i]);
3612 typ_i++;
3613 if (r->block1[i]!=r->block0[i])
3614 {
3615 rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3616 tmp_ordsgn, v,bits, r->block0[i]);
3617 }
3618 break;
3619
3620 case ringorder_Ws:
3621 rO_WDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3622 tmp_typ[typ_i], r->wvhdl[i]);
3623 typ_i++;
3624 if (r->block1[i]!=r->block0[i])
3625 {
3626 rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3627 tmp_ordsgn,v, bits, r->block1[i]);
3628 }
3629 break;
3630
3631 case ringorder_S:
3632 assume(typ_i == 1); // For LaScala3 only: on the 2nd place ([1])!
3633 // TODO: for K[x]: it is 0...?!
3634 rO_Syzcomp(j, j_bits,prev_ordsgn, tmp_ordsgn,tmp_typ[typ_i]);
3635 need_to_add_comp=TRUE;
3636 r->ComponentOrder=-1;
3637 typ_i++;
3638 break;
3639
3640 case ringorder_s:
3641 assume(typ_i == 0 && j == 0);
3642 rO_Syz(j, j_bits, prev_ordsgn, r->block0[i], tmp_ordsgn, tmp_typ[typ_i]); // set syz-limit?
3643 need_to_add_comp=TRUE;
3644 r->ComponentOrder=-1;
3645 typ_i++;
3646 break;
3647
3648 case ringorder_IS:
3649 {
3650
3651 assume( r->block0[i] == r->block1[i] );
3652 const int s = r->block0[i];
3653 assume( -2 < s && s < 2);
3654
3655 if(s == 0) // Prefix IS
3656 rO_ISPrefix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ[typ_i++]); // What about prev_ordsgn?
3657 else // s = +1 or -1 // Note: typ_i might be incrimented here inside!
3658 {
3659 rO_ISSuffix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ, typ_i, s); // Suffix.
3660 need_to_add_comp=FALSE;
3661 }
3662
3663 break;
3664 }
3665 case ringorder_unspec:
3666 case ringorder_no:
3667 default:
3668 dReportError("undef. ringorder used\n");
3669 break;
3670 }
3671 }
3672 rCheckOrdSgn(r,n-1);
3673
3674 int j0=j; // save j
3675 int j_bits0=j_bits; // save jbits
3676 rO_Align(j,j_bits);
3677 r->CmpL_Size = j;
3678
3679 j_bits=j_bits0; j=j0;
3680
3681 // fill in some empty slots with variables not already covered
3682 // v0 is special, is therefore normally already covered
3683 // now we do have rings without comp...
3684 if((need_to_add_comp) && (v[0]== -1))
3685 {
3686 if (prev_ordsgn==1)
3687 {
3688 rO_Align(j, j_bits);
3689 rO_LexVars(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3690 }
3691 else
3692 {
3693 rO_Align(j, j_bits);
3694 rO_LexVars_neg(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3695 }
3696 }
3697 // the variables
3698 for(i=1 ; i<=r->N ; i++)
3699 {
3700 if(v[i]==(-1))
3701 {
3702 if (prev_ordsgn==1)
3703 {
3704 rO_LexVars(j, j_bits, i,i, prev_ordsgn,tmp_ordsgn,v,bits, -1);
3705 }
3706 else
3707 {
3708 rO_LexVars_neg(j,j_bits,i,i, prev_ordsgn,tmp_ordsgn,v,bits, -1);
3709 }
3710 }
3711 }
3712
3713 rO_Align(j,j_bits);
3714 // ----------------------------
3715 // finished with constructing the monomial, computing sizes:
3716
3717 r->ExpL_Size=j;
3718 r->PolyBin = omGetSpecBin(POLYSIZE + (r->ExpL_Size)*sizeof(long));
3719 assume(r->PolyBin != NULL);
3720
3721 // ----------------------------
3722 // indices and ordsgn vector for comparison
3723 //
3724 // r->pCompHighIndex already set
3725 r->ordsgn=(long *)omAlloc0(r->ExpL_Size*sizeof(long));
3726
3727 for(j=0;j<r->CmpL_Size;j++)
3728 {
3729 r->ordsgn[j] = tmp_ordsgn[j];
3730 }
3731
3732 omFreeSize((ADDRESS)tmp_ordsgn,(3*(n+r->N)*sizeof(long)));
3733
3734 // ----------------------------
3735 // description of orderings for setm:
3736 //
3737 r->OrdSize=typ_i;
3738 if (typ_i==0) r->typ=NULL;
3739 else
3740 {
3741 r->typ=(sro_ord*)omAlloc(typ_i*sizeof(sro_ord));
3742 memcpy(r->typ,tmp_typ,typ_i*sizeof(sro_ord));
3743 }
3744 omFreeSize((ADDRESS)tmp_typ,(3*(n+r->N)*sizeof(sro_ord)));
3745
3746 // ----------------------------
3747 // indices for (first copy of ) variable entries in exp.e vector (VarOffset):
3748 r->VarOffset=v;
3749
3750 // ----------------------------
3751 // other indicies
3752 r->pCompIndex=(r->VarOffset[0] & 0xffff); //r->VarOffset[0];
3753 i=0; // position
3754 j=0; // index in r->typ
3755 if (i==r->pCompIndex) i++; // IS???
3756 while ((j < r->OrdSize)
3757 && ((r->typ[j].ord_typ==ro_syzcomp) ||
3758 (r->typ[j].ord_typ==ro_syz) || (r->typ[j].ord_typ==ro_isTemp) || (r->typ[j].ord_typ==ro_is) ||
3759 (r->order[r->typ[j].order_index] == ringorder_aa)))
3760 {
3761 i++; j++;
3762 }
3763
3764 if (i==r->pCompIndex) i++;
3765 r->pOrdIndex=i;
3766
3767 // ----------------------------
3768 rSetDegStuff(r); // OrdSgn etc already set
3769 rSetOption(r);
3770 // ----------------------------
3771 // r->p_Setm
3772 r->p_Setm = p_GetSetmProc(r);
3773
3774 // ----------------------------
3775 // set VarL_*
3776 rSetVarL(r);
3777
3778 // ----------------------------
3779 // right-adjust VarOffset
3781
3782 // ----------------------------
3783 // set NegWeightL*
3784 rSetNegWeight(r);
3785
3786 // ----------------------------
3787 // p_Procs: call AFTER NegWeightL
3788 r->p_Procs = (p_Procs_s*)omAlloc(sizeof(p_Procs_s));
3789 p_ProcsSet(r, r->p_Procs);
3790
3791 // use totaldegree on crazy oderings:
3792 if ((r->pFDeg==p_WTotaldegree) && rOrd_is_MixedDegree_Ordering(r))
3793 r->pFDeg = p_Totaldegree;
3794 return FALSE;
3795}
long int64
Definition: auxiliary.h:68
#define BIT_SIZEOF_LONG
Definition: auxiliary.h:80
int BOOLEAN
Definition: auxiliary.h:87
int l
Definition: cfEzgcd.cc:100
int k
Definition: cfEzgcd.cc:99
const CanonicalForm int s
Definition: facAbsFact.cc:51
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
int dReportError(const char *fmt,...)
Definition: dError.cc:43
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
long p_WTotaldegree(poly p, const ring r)
Definition: p_polys.cc:609
p_SetmProc p_GetSetmProc(const ring r)
Definition: p_polys.cc:556
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1479
static void rSetNegWeight(ring r)
Definition: ring.cc:3292
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:2419
static void rSetOption(ring r)
Definition: ring.cc:3329
#define BITS_PER_LONG
Definition: ring.cc:40
static void rO_WDegree64(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int64 *weights)
Definition: ring.cc:2240
static void rSetVarL(ring r)
set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex
Definition: ring.cc:3972
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:2284
BOOLEAN rOrd_is_MixedDegree_Ordering(ring r)
Definition: ring.cc:3373
static void rSetOutParams(ring r)
Definition: ring.cc:3025
static void rSetDegStuff(ring r)
Definition: ring.cc:3122
static void rO_WDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition: ring.cc:2258
static void rO_Syzcomp(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
Definition: ring.cc:2360
static void rO_TDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
Definition: ring.cc:2150
static void rO_WMDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition: ring.cc:2218
static void rO_Syz(int &place, int &bitplace, int &prev_ord, int syz_comp, long *o, sro_ord &ord_struct)
Definition: ring.cc:2375
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
Definition: ring.cc:2510
static void rCheckOrdSgn(ring r, int i)
Definition: ring.cc:3797
static unsigned long rGetDivMask(int bits)
get r->divmask depending on bits per exponent
Definition: ring.cc:4053
static void rRightAdjustVarOffset(ring r)
right-adjust r->VarOffset
Definition: ring.cc:4027
static void rO_ISPrefix(int &place, int &bitplace, int &prev_ord, long *o, int, int *v, sro_ord &ord_struct)
Definition: ring.cc:2401
static void rO_Align(int &place, int &bitplace)
Definition: ring.cc:2139
static void rO_TDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
Definition: ring.cc:2164
static void rO_WDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition: ring.cc:2178
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:2321
int order_index
Definition: ring.h:221

◆ rCopy()

ring rCopy ( ring  r)

Definition at line 1645 of file ring.cc.

1646{
1647 if (r == NULL) return NULL;
1648 ring res=rCopy0(r,FALSE,TRUE);
1649 rComplete(res, 1); // res is purely commutative so far
1650 if (r->qideal!=NULL) res->qideal=idrCopyR_NoSort(r->qideal, r, res);
1651
1652#ifdef HAVE_PLURAL
1653 if (rIsPluralRing(r))
1654 if( nc_rCopy(res, r, true) ) {}
1655#endif
1656
1657 return res;
1658}
bool nc_rCopy(ring res, const ring r, bool bSetupQuotient)
Definition: old.gring.cc:3003

◆ rCopy0()

ring rCopy0 ( const ring  r,
BOOLEAN  copy_qideal = TRUE,
BOOLEAN  copy_ordering = TRUE 
)

Definition at line 1363 of file ring.cc.

1364{
1365 if (r == NULL) return NULL;
1366 int i,j;
1367 ring res=(ring)omAlloc0Bin(sip_sring_bin);
1368 //memset: res->idroot=NULL; /* local objects */
1369 //ideal minideal;
1370 res->options=r->options; /* ring dependent options */
1371
1372 //memset: res->ordsgn=NULL;
1373 //memset: res->typ=NULL;
1374 //memset: res->VarOffset=NULL;
1375 //memset: res->firstwv=NULL;
1376
1377 //struct omBin PolyBin; /* Bin from where monoms are allocated */
1378 //memset: res->PolyBin=NULL; // rComplete
1379 res->cf=nCopyCoeff(r->cf); /* coeffs */
1380
1381 //memset: res->ref=0; /* reference counter to the ring */
1382
1383 res->N=rVar(r); /* number of vars */
1384
1385 res->firstBlockEnds=r->firstBlockEnds;
1386#ifdef HAVE_PLURAL
1387 res->real_var_start=r->real_var_start;
1388 res->real_var_end=r->real_var_end;
1389#endif
1390
1391#ifdef HAVE_SHIFTBBA
1392 res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
1393 res->LPncGenCount=r->LPncGenCount;
1394#endif
1395
1396 res->VectorOut=r->VectorOut;
1397 res->ShortOut=r->ShortOut;
1398 res->CanShortOut=r->CanShortOut;
1399
1400 //memset: res->ExpL_Size=0;
1401 //memset: res->CmpL_Size=0;
1402 //memset: res->VarL_Size=0;
1403 //memset: res->pCompIndex=0;
1404 //memset: res->pOrdIndex=0;
1405 //memset: res->OrdSize=0;
1406 //memset: res->VarL_LowIndex=0;
1407 //memset: res->NegWeightL_Size=0;
1408 //memset: res->NegWeightL_Offset=NULL;
1409 //memset: res->VarL_Offset=NULL;
1410
1411 // the following are set by rComplete unless predefined
1412 // therefore, we copy these values: maybe they are non-standard
1413 /* mask for getting single exponents */
1414 res->bitmask=r->bitmask;
1415 res->divmask=r->divmask;
1416 res->BitsPerExp = r->BitsPerExp;
1417 res->ExpPerLong = r->ExpPerLong;
1418
1419 //memset: res->p_Procs=NULL;
1420 //memset: res->pFDeg=NULL;
1421 //memset: res->pLDeg=NULL;
1422 //memset: res->pFDegOrig=NULL;
1423 //memset: res->pLDegOrig=NULL;
1424 //memset: res->p_Setm=NULL;
1425 //memset: res->cf=NULL;
1426
1427/*
1428 if (r->extRing!=NULL)
1429 r->extRing->ref++;
1430
1431 res->extRing=r->extRing;
1432 //memset: res->qideal=NULL;
1433*/
1434
1435
1436 if (copy_ordering == TRUE)
1437 {
1438 res->LexOrder=r->LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks
1439 res->MixedOrder=r->MixedOrder; // TRUE for mixed (global/local) ordering, FALSE otherwise,
1440 i=rBlocks(r);
1441 res->wvhdl = (int **)omAlloc(i * sizeof(int *));
1442 res->order = (rRingOrder_t *) omAlloc(i * sizeof(rRingOrder_t));
1443 res->block0 = (int *) omAlloc(i * sizeof(int));
1444 res->block1 = (int *) omAlloc(i * sizeof(int));
1445 for (j=0; j<i; j++)
1446 {
1447 if (r->wvhdl[j]!=NULL)
1448 {
1449 res->wvhdl[j] = (int*) omMemDup(r->wvhdl[j]);
1450 }
1451 else
1452 res->wvhdl[j]=NULL;
1453 }
1454 memcpy(res->order,r->order,i * sizeof(rRingOrder_t));
1455 memcpy(res->block0,r->block0,i * sizeof(int));
1456 memcpy(res->block1,r->block1,i * sizeof(int));
1457 }
1458 //memset: else
1459 //memset: {
1460 //memset: res->wvhdl = NULL;
1461 //memset: res->order = NULL;
1462 //memset: res->block0 = NULL;
1463 //memset: res->block1 = NULL;
1464 //memset: }
1465
1466 res->names = (char **)omAlloc0(rVar(r) * sizeof(char *));
1467 for (i=0; i<rVar(res); i++)
1468 {
1469 res->names[i] = omStrDup(r->names[i]);
1470 }
1471 if (r->qideal!=NULL)
1472 {
1473 if (copy_qideal)
1474 {
1475 assume(copy_ordering);
1476 rComplete(res);
1477 res->qideal= idrCopyR_NoSort(r->qideal, r, res);
1479 }
1480 //memset: else res->qideal = NULL;
1481 }
1482 //memset: else res->qideal = NULL;
1483 //memset: res->GetNC() = NULL; // copy is purely commutative!!!
1484 return res;
1485}
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition: coeffs.h:429
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
VAR omBin sip_sring_bin
Definition: ring.cc:43
void rUnComplete(ring r)
Definition: ring.cc:3910
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition: ring.h:593

◆ rCopy0AndAddA()

ring rCopy0AndAddA ( ring  r,
int64vec wv64,
BOOLEAN  copy_qideal = TRUE,
BOOLEAN  copy_ordering = TRUE 
)

Definition at line 1492 of file ring.cc.

1493{
1494 if (r == NULL) return NULL;
1495 int i,j;
1496 ring res=(ring)omAlloc0Bin(sip_sring_bin);
1497 //memcpy(res,r,sizeof(ip_sring));
1498 //memset: res->idroot=NULL; /* local objects */
1499 //ideal minideal;
1500 res->options=r->options; /* ring dependent options */
1501
1502 //memset: res->ordsgn=NULL;
1503 //memset: res->typ=NULL;
1504 //memset: res->VarOffset=NULL;
1505 //memset: res->firstwv=NULL;
1506
1507 //struct omBin PolyBin; /* Bin from where monoms are allocated */
1508 //memset: res->PolyBin=NULL; // rComplete
1509 res->cf=nCopyCoeff(r->cf); /* coeffs */
1510
1511 //memset: res->ref=0; /* reference counter to the ring */
1512
1513 res->N=rVar(r); /* number of vars */
1514
1515 res->firstBlockEnds=r->firstBlockEnds;
1516#ifdef HAVE_PLURAL
1517 res->real_var_start=r->real_var_start;
1518 res->real_var_end=r->real_var_end;
1519#endif
1520
1521#ifdef HAVE_SHIFTBBA
1522 res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
1523 res->LPncGenCount=r->LPncGenCount;
1524#endif
1525
1526 res->VectorOut=r->VectorOut;
1527 res->ShortOut=r->ShortOut;
1528 res->CanShortOut=r->CanShortOut;
1529 res->LexOrder=r->LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks
1530 res->MixedOrder=r->MixedOrder; // TRUE for mixed (global/local) ordering, FALSE otherwise,
1531
1532 //memset: res->ExpL_Size=0;
1533 //memset: res->CmpL_Size=0;
1534 //memset: res->VarL_Size=0;
1535 //memset: res->pCompIndex=0;
1536 //memset: res->pOrdIndex=0;
1537 //memset: res->OrdSize=0;
1538 //memset: res->VarL_LowIndex=0;
1539 //memset: res->NegWeightL_Size=0;
1540 //memset: res->NegWeightL_Offset=NULL;
1541 //memset: res->VarL_Offset=NULL;
1542
1543 // the following are set by rComplete unless predefined
1544 // therefore, we copy these values: maybe they are non-standard
1545 /* mask for getting single exponents */
1546 res->bitmask=r->bitmask;
1547 res->divmask=r->divmask;
1548 res->BitsPerExp = r->BitsPerExp;
1549 res->ExpPerLong = r->ExpPerLong;
1550
1551 //memset: res->p_Procs=NULL;
1552 //memset: res->pFDeg=NULL;
1553 //memset: res->pLDeg=NULL;
1554 //memset: res->pFDegOrig=NULL;
1555 //memset: res->pLDegOrig=NULL;
1556 //memset: res->p_Setm=NULL;
1557 //memset: res->cf=NULL;
1558
1559/*
1560 if (r->extRing!=NULL)
1561 r->extRing->ref++;
1562
1563 res->extRing=r->extRing;
1564 //memset: res->qideal=NULL;
1565*/
1566
1567
1568 if (copy_ordering == TRUE)
1569 {
1570 i=rBlocks(r)+1; // DIFF to rCopy0
1571 res->wvhdl = (int **)omAlloc(i * sizeof(int *));
1572 res->order = (rRingOrder_t *) omAlloc(i * sizeof(rRingOrder_t));
1573 res->block0 = (int *) omAlloc(i * sizeof(int));
1574 res->block1 = (int *) omAlloc(i * sizeof(int));
1575 for (j=0; j<i-1; j++)
1576 {
1577 if (r->wvhdl[j]!=NULL)
1578 {
1579 res->wvhdl[j+1] = (int*) omMemDup(r->wvhdl[j]); //DIFF
1580 }
1581 else
1582 res->wvhdl[j+1]=NULL; //DIFF
1583 }
1584 memcpy(&(res->order[1]),r->order,(i-1) * sizeof(rRingOrder_t)); //DIFF
1585 memcpy(&(res->block0[1]),r->block0,(i-1) * sizeof(int)); //DIFF
1586 memcpy(&(res->block1[1]),r->block1,(i-1) * sizeof(int)); //DIFF
1587 }
1588 //memset: else
1589 //memset: {
1590 //memset: res->wvhdl = NULL;
1591 //memset: res->order = NULL;
1592 //memset: res->block0 = NULL;
1593 //memset: res->block1 = NULL;
1594 //memset: }
1595
1596 //the added A
1597 res->order[0]=ringorder_a64;
1598 int length=wv64->rows();
1599 int64 *A=(int64 *)omAlloc(length*sizeof(int64));
1600 for(j=length-1;j>=0;j--)
1601 {
1602 A[j]=(*wv64)[j];
1603 }
1604 res->wvhdl[0]=(int *)A;
1605 res->block0[0]=1;
1606 res->block1[0]=length;
1607 //
1608
1609 res->names = (char **)omAlloc0(rVar(r) * sizeof(char *));
1610 for (i=0; i<rVar(res); i++)
1611 {
1612 res->names[i] = omStrDup(r->names[i]);
1613 }
1614 if (r->qideal!=NULL)
1615 {
1616 if (copy_qideal)
1617 {
1618 #ifndef SING_NDEBUG
1619 if (!copy_ordering)
1620 WerrorS("internal error: rCopy0(Q,TRUE,FALSE)");
1621 else
1622 #endif
1623 {
1624 #ifndef SING_NDEBUG
1625 WarnS("internal bad stuff: rCopy0(Q,TRUE,TRUE)");
1626 #endif
1627 rComplete(res);
1628 res->qideal= idrCopyR_NoSort(r->qideal, r, res);
1630 }
1631 }
1632 //memset: else res->qideal = NULL;
1633 }
1634 //memset: else res->qideal = NULL;
1635 //memset: res->GetNC() = NULL; // copy is purely commutative!!!
1636 return res;
1637}
int rows() const
Definition: int64vec.h:66
#define A
Definition: sirandom.c:24

◆ rDBTest()

BOOLEAN rDBTest ( ring  r,
const char *  fn,
const int  l 
)

Definition at line 1989 of file ring.cc.

1990{
1991 int i,j;
1992
1993 if (r == NULL)
1994 {
1995 dReportError("Null ring in %s:%d", fn, l);
1996 return FALSE;
1997 }
1998
1999
2000 if (r->N == 0) return TRUE;
2001
2002 if ((r->OrdSgn!=1) && (r->OrdSgn!= -1))
2003 {
2004 dReportError("missing OrdSgn in %s:%d", fn, l);
2005 return FALSE;
2006 }
2007
2008// omCheckAddrSize(r,sizeof(ip_sring));
2009#if OM_CHECK > 0
2010 i=rBlocks(r);
2011 omCheckAddrSize(r->order,i*sizeof(int));
2012 omCheckAddrSize(r->block0,i*sizeof(int));
2013 omCheckAddrSize(r->block1,i*sizeof(int));
2014 for(int j=0;j<=i;j++)
2015 {
2016 if((r->order[j]<0)||(r->order[j]>ringorder_unspec))
2017 dError("wrong order in r->order");
2018 }
2019 if (r->wvhdl!=NULL)
2020 {
2021 omCheckAddrSize(r->wvhdl,i*sizeof(int *));
2022 for (j=0;j<i; j++)
2023 {
2024 if (r->wvhdl[j] != NULL) omCheckAddr(r->wvhdl[j]);
2025 }
2026 }
2027#endif
2028 if (r->VarOffset == NULL)
2029 {
2030 dReportError("Null ring VarOffset -- no rComplete (?) in n %s:%d", fn, l);
2031 return FALSE;
2032 }
2033 omCheckAddrSize(r->VarOffset,(r->N+1)*sizeof(int));
2034
2035 if ((r->OrdSize==0)!=(r->typ==NULL))
2036 {
2037 dReportError("mismatch OrdSize and typ-pointer in %s:%d");
2038 return FALSE;
2039 }
2040 omcheckAddrSize(r->typ,r->OrdSize*sizeof(*(r->typ)));
2041 omCheckAddrSize(r->VarOffset,(r->N+1)*sizeof(*(r->VarOffset)));
2042 // test assumptions:
2043 for(i=0;i<=r->N;i++) // for all variables (i = 0..N)
2044 {
2045 if(r->typ!=NULL)
2046 {
2047 for(j=0;j<r->OrdSize;j++) // for all ordering blocks (j =0..OrdSize-1)
2048 {
2049 if(r->typ[j].ord_typ == ro_isTemp)
2050 {
2051 const int p = r->typ[j].data.isTemp.suffixpos;
2052
2053 if(p <= j)
2054 dReportError("ordrec prefix %d is unmatched",j);
2055
2056 assume( p < r->OrdSize );
2057
2058 if(r->typ[p].ord_typ != ro_is)
2059 dReportError("ordrec prefix %d is unmatched (suffix: %d is wrong!!!)",j, p);
2060
2061 // Skip all intermediate blocks for undone variables:
2062 if(r->typ[j].data.isTemp.pVarOffset[i] != -1) // Check i^th variable
2063 {
2064 j = p - 1; // SKIP ALL INTERNAL BLOCKS...???
2065 continue; // To make for check OrdSize bound...
2066 }
2067 }
2068 else if (r->typ[j].ord_typ == ro_is)
2069 {
2070 // Skip all intermediate blocks for undone variables:
2071 if(r->typ[j].data.is.pVarOffset[i] != -1)
2072 {
2073 // TODO???
2074 }
2075
2076 }
2077 else
2078 {
2079 if (r->typ[j].ord_typ==ro_cp)
2080 {
2081 if(((short)r->VarOffset[i]) == r->typ[j].data.cp.place)
2082 dReportError("ordrec %d conflicts with var %d",j,i);
2083 }
2084 else
2085 if ((r->typ[j].ord_typ!=ro_syzcomp)
2086 && (r->VarOffset[i] == r->typ[j].data.dp.place))
2087 dReportError("ordrec %d conflicts with var %d",j,i);
2088 }
2089 }
2090 }
2091 int tmp;
2092 tmp=r->VarOffset[i] & 0xffffff;
2093 #if SIZEOF_LONG == 8
2094 if ((r->VarOffset[i] >> 24) >63)
2095 #else
2096 if ((r->VarOffset[i] >> 24) >31)
2097 #endif
2098 dReportError("bit_start out of range:%d",r->VarOffset[i] >> 24);
2099 if (i > 0 && ((tmp<0) ||(tmp>r->ExpL_Size-1)))
2100 {
2101 dReportError("varoffset out of range for var %d: %d",i,tmp);
2102 }
2103 }
2104 if(r->typ!=NULL)
2105 {
2106 for(j=0;j<r->OrdSize;j++)
2107 {
2108 if ((r->typ[j].ord_typ==ro_dp)
2109 || (r->typ[j].ord_typ==ro_wp)
2110 || (r->typ[j].ord_typ==ro_wp_neg))
2111 {
2112 if (r->typ[j].data.dp.start > r->typ[j].data.dp.end)
2113 dReportError("in ordrec %d: start(%d) > end(%d)",j,
2114 r->typ[j].data.dp.start, r->typ[j].data.dp.end);
2115 if ((r->typ[j].data.dp.start < 1)
2116 || (r->typ[j].data.dp.end > r->N))
2117 dReportError("in ordrec %d: start(%d)<1 or end(%d)>vars(%d)",j,
2118 r->typ[j].data.dp.start, r->typ[j].data.dp.end,r->N);
2119 }
2120 }
2121 }
2122
2123 assume(r != NULL);
2124 assume(r->cf != NULL);
2125
2126 if (nCoeff_is_algExt(r->cf))
2127 {
2128 assume(r->cf->extRing != NULL);
2129 assume(r->cf->extRing->qideal != NULL);
2130 omCheckAddr(r->cf->extRing->qideal->m[0]);
2131 }
2132
2133 //assume(r->cf!=NULL);
2134
2135 return TRUE;
2136}
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:910
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
#define omcheckAddrSize(addr, size)
Definition: omAllocDecl.h:329

◆ rDebugPrint()

void rDebugPrint ( const ring  r)

Definition at line 4067 of file ring.cc.

4068{
4069 if (r==NULL)
4070 {
4071 PrintS("NULL ?\n");
4072 return;
4073 }
4074 // corresponds to ro_typ from ring.h:
4075 const char *TYP[]={"ro_dp","ro_wp","ro_am","ro_wp64","ro_wp_neg","ro_cp",
4076 "ro_syzcomp", "ro_syz", "ro_isTemp", "ro_is", "ro_none"};
4077 int i,j;
4078
4079 Print("ExpL_Size:%d ",r->ExpL_Size);
4080 Print("CmpL_Size:%d ",r->CmpL_Size);
4081 Print("VarL_Size:%d\n",r->VarL_Size);
4082 Print("bitmask=0x%lx (expbound=%ld) \n",r->bitmask, r->bitmask);
4083 Print("divmask=%lx\n", r->divmask);
4084 Print("BitsPerExp=%d ExpPerLong=%d at L[%d]\n", r->BitsPerExp, r->ExpPerLong, r->VarL_Offset[0]);
4085
4086 Print("VarL_LowIndex: %d\n", r->VarL_LowIndex);
4087 PrintS("VarL_Offset:\n");
4088 if (r->VarL_Offset==NULL) PrintS(" NULL");
4089 else
4090 for(j = 0; j < r->VarL_Size; j++)
4091 Print(" VarL_Offset[%d]: %d ", j, r->VarL_Offset[j]);
4092 PrintLn();
4093
4094
4095 PrintS("VarOffset:\n");
4096 if (r->VarOffset==NULL) PrintS(" NULL\n");
4097 else
4098 for(j=0;j<=r->N;j++)
4099 Print(" v%d at e-pos %d, bit %d\n",
4100 j,r->VarOffset[j] & 0xffffff, r->VarOffset[j] >>24);
4101 PrintS("ordsgn:\n");
4102 for(j=0;j<r->CmpL_Size;j++)
4103 Print(" ordsgn %ld at pos %d\n",r->ordsgn[j],j);
4104 Print("OrdSgn:%d\n",r->OrdSgn);
4105 PrintS("ordrec:\n");
4106 for(j=0;j<r->OrdSize;j++)
4107 {
4108 Print(" typ %s", TYP[r->typ[j].ord_typ]);
4109 if (r->typ[j].ord_typ==ro_syz)
4110 {
4111 const short place = r->typ[j].data.syz.place;
4112 const int limit = r->typ[j].data.syz.limit;
4113 const int curr_index = r->typ[j].data.syz.curr_index;
4114 const int* syz_index = r->typ[j].data.syz.syz_index;
4115
4116 Print(" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
4117
4118 if( syz_index == NULL )
4119 PrintS("(NULL)");
4120 else
4121 {
4122 PrintS("{");
4123 for( i=0; i <= limit; i++ )
4124 Print("%d ", syz_index[i]);
4125 PrintS("}");
4126 }
4127
4128 }
4129 else if (r->typ[j].ord_typ==ro_isTemp)
4130 {
4131 Print(" start (level) %d, suffixpos: %d, VO: ",r->typ[j].data.isTemp.start, r->typ[j].data.isTemp.suffixpos);
4132
4133 }
4134 else if (r->typ[j].ord_typ==ro_is)
4135 {
4136 Print(" start %d, end: %d: ",r->typ[j].data.is.start, r->typ[j].data.is.end);
4137
4138// 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]);
4139
4140 Print(" limit %d",r->typ[j].data.is.limit);
4141#ifndef SING_NDEBUG
4142 //PrintS(" F: ");idShow(r->typ[j].data.is.F, r, r, 1);
4143#endif
4144
4145 PrintLn();
4146 }
4147 else if (r->typ[j].ord_typ==ro_am)
4148 {
4149 Print(" place %d",r->typ[j].data.am.place);
4150 Print(" start %d",r->typ[j].data.am.start);
4151 Print(" end %d",r->typ[j].data.am.end);
4152 Print(" len_gen %d",r->typ[j].data.am.len_gen);
4153 PrintS(" w:");
4154 int l=0;
4155 for(l=r->typ[j].data.am.start;l<=r->typ[j].data.am.end;l++)
4156 Print(" %d",r->typ[j].data.am.weights[l-r->typ[j].data.am.start]);
4157 l=r->typ[j].data.am.end+1;
4158 int ll=r->typ[j].data.am.weights[l-r->typ[j].data.am.start];
4159 PrintS(" m:");
4160 for(int lll=l+1;lll<l+ll+1;lll++)
4161 Print(" %d",r->typ[j].data.am.weights[lll-r->typ[j].data.am.start]);
4162 }
4163 else
4164 {
4165 Print(" place %d",r->typ[j].data.dp.place);
4166
4167 if (r->typ[j].ord_typ!=ro_syzcomp && r->typ[j].ord_typ!=ro_syz)
4168 {
4169 Print(" start %d",r->typ[j].data.dp.start);
4170 Print(" end %d",r->typ[j].data.dp.end);
4171 if ((r->typ[j].ord_typ==ro_wp)
4172 || (r->typ[j].ord_typ==ro_wp_neg))
4173 {
4174 PrintS(" w:");
4175 for(int l=r->typ[j].data.wp.start;l<=r->typ[j].data.wp.end;l++)
4176 Print(" %d",r->typ[j].data.wp.weights[l-r->typ[j].data.wp.start]);
4177 }
4178 else if (r->typ[j].ord_typ==ro_wp64)
4179 {
4180 PrintS(" w64:");
4181 int l;
4182 for(l=r->typ[j].data.wp64.start;l<=r->typ[j].data.wp64.end;l++)
4183 Print(" %ld",(long)(((int64*)r->typ[j].data.wp64.weights64)+l-r->typ[j].data.wp64.start));
4184 }
4185 }
4186 }
4187 PrintLn();
4188 }
4189 Print("pOrdIndex:%d pCompIndex:%d\n", r->pOrdIndex, r->pCompIndex);
4190 Print("OrdSize:%d\n",r->OrdSize);
4191 PrintS("--------------------\n");
4192 for(j=0;j<r->ExpL_Size;j++)
4193 {
4194 Print("L[%d]: ",j);
4195 if (j< r->CmpL_Size)
4196 Print("ordsgn %ld ", r->ordsgn[j]);
4197 else
4198 PrintS("no comp ");
4199 i=1;
4200 for(;i<=r->N;i++)
4201 {
4202 if( (r->VarOffset[i] & 0xffffff) == j )
4203 { Print("v%d at e[%d], bit %d; ", i,r->VarOffset[i] & 0xffffff,
4204 r->VarOffset[i] >>24 ); }
4205 }
4206 if( r->pCompIndex==j ) PrintS("v0; ");
4207 for(i=0;i<r->OrdSize;i++)
4208 {
4209 if (r->typ[i].data.dp.place == j)
4210 {
4211 Print("ordrec:%s (start:%d, end:%d) ",TYP[r->typ[i].ord_typ],
4212 r->typ[i].data.dp.start, r->typ[i].data.dp.end);
4213 }
4214 }
4215
4216 if (j==r->pOrdIndex)
4217 PrintS("pOrdIndex\n");
4218 else
4219 PrintLn();
4220 }
4221 Print("LexOrder:%d, MixedOrder:%d\n",r->LexOrder, r->MixedOrder);
4222
4223 Print("NegWeightL_Size: %d, NegWeightL_Offset: ", r->NegWeightL_Size);
4224 if (r->NegWeightL_Offset==NULL) PrintS(" NULL");
4225 else
4226 for(j = 0; j < r->NegWeightL_Size; j++)
4227 Print(" [%d]: %d ", j, r->NegWeightL_Offset[j]);
4228 PrintLn();
4229
4230 // p_Procs stuff
4231 p_Procs_s proc_names;
4232 const char* field;
4233 const char* length;
4234 const char* ord;
4235 p_Debug_GetProcNames(r, &proc_names); // changes p_Procs!!!
4236 p_Debug_GetSpecNames(r, field, length, ord);
4237
4238 Print("p_Spec : %s, %s, %s\n", field, length, ord);
4239 PrintS("p_Procs :\n");
4240 for (i=0; i<(int) (sizeof(p_Procs_s)/sizeof(void*)); i++)
4241 {
4242 Print(" %s,\n", ((char**) &proc_names)[i]);
4243 }
4244
4245 {
4246 PrintLn();
4247 PrintS("pFDeg : ");
4248#define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
4252 pFDeg_CASE(p_Deg); else
4253#undef pFDeg_CASE
4254 Print("(%p)", r->pFDeg); // default case
4255
4256 PrintLn();
4257 Print("pLDeg : (%p)", r->pLDeg);
4258 PrintLn();
4259 }
4260 PrintS("pSetm:");
4261 void p_Setm_Dummy(poly p, const ring r);
4262 void p_Setm_TotalDegree(poly p, const ring r);
4263 void p_Setm_WFirstTotalDegree(poly p, const ring r);
4264 void p_Setm_General(poly p, const ring r);
4265 if (r->p_Setm==p_Setm_General) PrintS("p_Setm_General\n");
4266 else if (r->p_Setm==p_Setm_Dummy) PrintS("p_Setm_Dummy\n");
4267 else if (r->p_Setm==p_Setm_TotalDegree) PrintS("p_Setm_Totaldegree\n");
4268 else if (r->p_Setm==p_Setm_WFirstTotalDegree) PrintS("p_Setm_WFirstTotalDegree\n");
4269 else Print("%p\n",r->p_Setm);
4270}
void p_Debug_GetProcNames(const ring r, p_Procs_s *p_Procs)
Definition: p_Procs_Set.h:232
void p_Debug_GetSpecNames(const ring r, const char *&field, const char *&length, const char *&ord)
Definition: p_Procs_Set.h:221
void p_Setm_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:550
long p_WFirstTotalDegree(poly p, const ring r)
Definition: p_polys.cc:592
void p_Setm_Dummy(poly p, const ring r)
Definition: p_polys.cc:537
void p_Setm_TotalDegree(poly p, const ring r)
Definition: p_polys.cc:543
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:583
#define pFDeg_CASE(A)

◆ rDecRefCnt()

static void rDecRefCnt ( ring  r)
inlinestatic

Definition at line 844 of file ring.h.

844{ r->ref--; }

◆ rDefault() [1/4]

ring rDefault ( const coeffs  cf,
int  N,
char **  n,
const rRingOrder_t  o = ringorder_lp 
)

Definition at line 138 of file ring.cc.

139{
140 assume( cf != NULL);
141 /*order: o=lp,0*/
142 rRingOrder_t *order = (rRingOrder_t *) omAlloc(2* sizeof(rRingOrder_t));
143 int *block0 = (int *)omAlloc0(2 * sizeof(int));
144 int *block1 = (int *)omAlloc0(2 * sizeof(int));
145 /* ringorder o=lp for the first block: var 1..N */
146 order[0] = o;
147 block0[0] = 1;
148 block1[0] = N;
149 /* the last block: everything is 0 */
150 order[1] = (rRingOrder_t)0;
151
152 return rDefault(cf,N,n,2,order,block0,block1);
153}
CanonicalForm cf
Definition: cfModGcd.cc:4082
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
Definition: ring.cc:102

◆ rDefault() [2/4]

ring rDefault ( const coeffs  cf,
int  N,
char **  n,
int  ord_size,
rRingOrder_t ord,
int *  block0,
int *  block1,
int **  wvhdl = NULL,
unsigned long  bitmask = 0 
)

Definition at line 102 of file ring.cc.

103{
104 assume( cf != NULL);
105 ring r=(ring) omAlloc0Bin(sip_sring_bin);
106 r->N = N;
107 r->cf = cf;
108 /*rPar(r) = 0; Alloc0 */
109 /*names*/
110 r->names = (char **) omAlloc0(N * sizeof(char *));
111 int i;
112 for(i=0;i<N;i++)
113 {
114 r->names[i] = omStrDup(n[i]);
115 }
116 /*weights: entries for 2 blocks: NULL*/
117 if (wvhdl==NULL)
118 r->wvhdl = (int **)omAlloc0((ord_size+1) * sizeof(int *));
119 else
120 r->wvhdl=wvhdl;
121 r->order = ord;
122 r->block0 = block0;
123 r->block1 = block1;
124 if (bitmask!=0) r->wanted_maxExp=bitmask;
125
126 /* complete ring intializations */
127 rComplete(r);
128 return r;
129}

◆ rDefault() [3/4]

ring rDefault ( int  ch,
int  N,
char **  n 
)

Definition at line 155 of file ring.cc.

156{
157 coeffs cf;
158 if (ch==0) cf=nInitChar(n_Q,NULL);
159 else cf=nInitChar(n_Zp,(void*)(long)ch);
160 assume( cf != NULL);
161 return rDefault(cf,N,n);
162}
@ n_Q
rational (GMP) numbers
Definition: coeffs.h:30
@ n_Zp
\F{p < 2^31}
Definition: coeffs.h:29
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
Definition: numbers.cc:354

◆ rDefault() [4/4]

ring rDefault ( int  ch,
int  N,
char **  n,
int  ord_size,
rRingOrder_t ord,
int *  block0,
int *  block1,
int **  wvhdl = NULL 
)

Definition at line 130 of file ring.cc.

131{
132 coeffs cf;
133 if (ch==0) cf=nInitChar(n_Q,NULL);
134 else cf=nInitChar(n_Zp,(void*)(long)ch);
135 assume( cf != NULL);
136 return rDefault(cf,N,n,ord_size,ord,block0,block1,wvhdl);
137}

◆ rDelete()

void rDelete ( ring  r)

unconditionally deletes fields in r

Definition at line 449 of file ring.cc.

450{
451 int i, j;
452
453 if (r == NULL) return;
454 if( r->ref > 0 ) // ->ref means the number of Interpreter objects referring to the ring...
455 return;
456
457 if( r->qideal != NULL )
458 {
459 ideal q = r->qideal;
460 r->qideal = NULL;
461 id_Delete(&q, r);
462 }
463
464#ifdef HAVE_PLURAL
465 if (rIsPluralRing(r))
466 nc_rKill(r);
467#endif
468
469 rUnComplete(r); // may need r->cf for p_Delete
470 nKillChar(r->cf); r->cf = NULL;
471 // delete order stuff
472 if (r->order != NULL)
473 {
474 i=rBlocks(r);
475 assume(r->block0 != NULL && r->block1 != NULL && r->wvhdl != NULL);
476 // delete order
477 omFreeSize((ADDRESS)r->order,i*sizeof(rRingOrder_t));
478 omFreeSize((ADDRESS)r->block0,i*sizeof(int));
479 omFreeSize((ADDRESS)r->block1,i*sizeof(int));
480 // delete weights
481 for (j=0; j<i; j++)
482 {
483 if (r->wvhdl[j]!=NULL)
484 omFree(r->wvhdl[j]);
485 }
486 omFreeSize((ADDRESS)r->wvhdl,i*sizeof(int *));
487 }
488 else
489 {
490 assume(r->block0 == NULL && r->block1 == NULL && r->wvhdl == NULL);
491 }
492
493 // delete varnames
494 if(r->names!=NULL)
495 {
496 for (i=0; i<r->N; i++)
497 {
498 if (r->names[i] != NULL) omFree((ADDRESS)r->names[i]);
499 }
500 omFreeSize((ADDRESS)r->names,r->N*sizeof(char *));
501 }
502
504}
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:522
void nc_rKill(ring r)
complete destructor
Definition: old.gring.cc:2475
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259

◆ rEnvelope()

ring rEnvelope ( ring  r)

Definition at line 5633 of file ring.cc.

5636{
5637 ring Ropp = rOpposite(R);
5638 ring Renv = NULL;
5639 int stat = rSum(R, Ropp, Renv); /* takes care of qideals */
5640 if ( stat <=0 )
5641 WarnS("Error in rEnvelope at rSum");
5642 rTest(Renv);
5643 return Renv;
5644}
int rSum(ring r1, ring r2, ring &sum)
Definition: ring.cc:1344
ring rOpposite(ring src)
Definition: ring.cc:5243
#define R
Definition: sirandom.c:27

◆ rEqual()

BOOLEAN rEqual ( ring  r1,
ring  r2,
BOOLEAN  qr = TRUE 
)

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 1660 of file ring.cc.

1661{
1662 if (r1 == r2) return TRUE;
1663 if (r1 == NULL || r2 == NULL) return FALSE;
1664 if (r1->cf!=r2->cf) return FALSE;
1665 if (rVar(r1)!=rVar(r2)) return FALSE;
1666 if (r1->bitmask!=r2->bitmask) return FALSE;
1667 #ifdef HAVE_SHIFTBBA
1668 if (r1->isLPring!=r2->isLPring) return FALSE;
1669 if (r1->LPncGenCount!=r2->LPncGenCount) return FALSE;
1670 #endif
1671
1672 if( !rSamePolyRep(r1, r2) )
1673 return FALSE;
1674
1675 int i/*, j*/;
1676
1677 for (i=0; i<rVar(r1); i++)
1678 {
1679 if ((r1->names[i] != NULL) && (r2->names[i] != NULL))
1680 {
1681 if (strcmp(r1->names[i], r2->names[i])) return FALSE;
1682 }
1683 else if ((r1->names[i] != NULL) ^ (r2->names[i] != NULL))
1684 {
1685 return FALSE;
1686 }
1687 }
1688
1689 if (qr)
1690 {
1691 if (r1->qideal != NULL)
1692 {
1693 ideal id1 = r1->qideal, id2 = r2->qideal;
1694 int i, n;
1695 poly *m1, *m2;
1696
1697 if (id2 == NULL) return FALSE;
1698 if ((n = IDELEMS(id1)) != IDELEMS(id2)) return FALSE;
1699
1700 {
1701 m1 = id1->m;
1702 m2 = id2->m;
1703 for (i=0; i<n; i++)
1704 if (! p_EqualPolys(m1[i],m2[i], r1, r2)) return FALSE;
1705 }
1706 }
1707 else if (r2->qideal != NULL) return FALSE;
1708 }
1709
1710 return TRUE;
1711}
Definition: qr.h:46
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition: p_polys.cc:4545
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:1713
#define IDELEMS(i)
Definition: simpleideals.h:23

◆ rField_has_simple_Alloc()

static BOOLEAN rField_has_simple_Alloc ( const ring  r)
inlinestatic

Z/p, GF(p,n), R: nCopy, nNew, nDelete are dummies.

Definition at line 553 of file ring.h.

554{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_has_simple_Alloc(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_has_simple_Alloc(const coeffs r)
TRUE if n_Delete/n_New are empty operations.
Definition: coeffs.h:906

◆ rField_has_simple_inverse()

static BOOLEAN rField_has_simple_inverse ( const ring  r)
inlinestatic

Definition at line 549 of file ring.h.

550{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_has_simple_inverse(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_has_simple_inverse(const coeffs r)
TRUE, if the computation of the inverse is fast, i.e. prefer leading coeff. 1 over content.
Definition: coeffs.h:902

◆ rField_has_Units()

static BOOLEAN rField_has_Units ( const ring  r)
inlinestatic

Definition at line 491 of file ring.h.

492{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_has_Units(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_has_Units(const coeffs r)
returns TRUE, if r is not a field and r has non-trivial units
Definition: coeffs.h:797

◆ rField_is_Domain()

static BOOLEAN rField_is_Domain ( const ring  r)
inlinestatic

Definition at line 488 of file ring.h.

489{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_Domain(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_Domain(const coeffs r)
returns TRUE, if r is a field or r has no zero divisors (i.e is a domain)
Definition: coeffs.h:739

◆ rField_is_GF() [1/2]

static BOOLEAN rField_is_GF ( const ring  r)
inlinestatic

Definition at line 522 of file ring.h.

523{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_GF(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:839

◆ rField_is_GF() [2/2]

static BOOLEAN rField_is_GF ( const ring  r,
int  q 
)
inlinestatic

Definition at line 525 of file ring.h.

526{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_GF(r->cf, q); }

◆ rField_is_long_C()

static BOOLEAN rField_is_long_C ( const ring  r)
inlinestatic

Definition at line 546 of file ring.h.

547{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_long_C(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
Definition: coeffs.h:894

◆ rField_is_long_R()

static BOOLEAN rField_is_long_R ( const ring  r)
inlinestatic

Definition at line 543 of file ring.h.

544{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_long_R(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
Definition: coeffs.h:891

◆ rField_is_numeric()

static BOOLEAN rField_is_numeric ( const ring  r)
inlinestatic

Definition at line 516 of file ring.h.

517{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_numeric(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_numeric(const coeffs r)
Definition: coeffs.h:832

◆ rField_is_Q()

static BOOLEAN rField_is_Q ( const ring  r)
inlinestatic

Definition at line 507 of file ring.h.

508{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_Q(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
Definition: coeffs.h:806

◆ rField_is_Q_a()

static BOOLEAN rField_is_Q_a ( const ring  r)
inlinestatic

Definition at line 540 of file ring.h.

541{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_Q_a(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_Q_a(const coeffs r)
Definition: coeffs.h:885

◆ rField_is_R()

static BOOLEAN rField_is_R ( const ring  r)
inlinestatic

Definition at line 519 of file ring.h.

520{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_R(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
Definition: coeffs.h:836

◆ rField_is_Ring_2toM()

static BOOLEAN rField_is_Ring_2toM ( const ring  r)
inlinestatic

Definition at line 480 of file ring.h.

481{ assume(r != NULL); assume(r->cf != NULL); return ( nCoeff_is_Ring_2toM(r->cf) ); }
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_2toM(const coeffs r)
Definition: coeffs.h:724

◆ rField_is_Ring_PtoM()

static BOOLEAN rField_is_Ring_PtoM ( const ring  r)
inlinestatic

Definition at line 483 of file ring.h.

484{ assume(r != NULL); assume(r->cf != NULL); return ( nCoeff_is_Ring_PtoM(r->cf) ); }
static FORCE_INLINE BOOLEAN nCoeff_is_Ring_PtoM(const coeffs r)
Definition: coeffs.h:727

◆ rField_is_Z()

static BOOLEAN rField_is_Z ( const ring  r)
inlinestatic

Definition at line 510 of file ring.h.

511{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_Z(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
Definition: coeffs.h:816

◆ rField_is_Zn()

static BOOLEAN rField_is_Zn ( const ring  r)
inlinestatic

Definition at line 513 of file ring.h.

514{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_Zn(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_Zn(const coeffs r)
Definition: coeffs.h:826

◆ rField_is_Zp() [1/2]

static BOOLEAN rField_is_Zp ( const ring  r)
inlinestatic

Definition at line 501 of file ring.h.

502{ assume(r != NULL); assume(r->cf != NULL); return (getCoeffType(r->cf) == n_Zp); }

◆ rField_is_Zp() [2/2]

static BOOLEAN rField_is_Zp ( const ring  r,
int  p 
)
inlinestatic

Definition at line 504 of file ring.h.

505{ assume(r != NULL); assume(r->cf != NULL); return (getCoeffType(r->cf) == n_Zp) && (r->cf->ch == p); }

◆ rField_is_Zp_a() [1/2]

static BOOLEAN rField_is_Zp_a ( const ring  r)
inlinestatic

Definition at line 530 of file ring.h.

531{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_Zp_a(r->cf); }
static FORCE_INLINE BOOLEAN nCoeff_is_Zp_a(const coeffs r)
Definition: coeffs.h:859

◆ rField_is_Zp_a() [2/2]

static BOOLEAN rField_is_Zp_a ( const ring  r,
int  p 
)
inlinestatic

Definition at line 535 of file ring.h.

536{ assume(r != NULL); assume(r->cf != NULL); return nCoeff_is_Zp_a(r->cf, p); }

◆ rFieldType()

static n_coeffType rFieldType ( const ring  r)
inlinestatic

the type of the coefficient filed of r (n_Zp, n_Q, etc)

Definition at line 557 of file ring.h.

557{ return (r->cf->type); }

◆ rGetCurrSyzLimit()

static int rGetCurrSyzLimit ( const ring  r)
inlinestatic

Definition at line 724 of file ring.h.

725{ assume(r != NULL); assume(r->cf != NULL); return (rIsSyzIndexRing(r)? r->typ[0].data.syz.limit : 0);}
static BOOLEAN rIsSyzIndexRing(const ring r)
Definition: ring.h:721

◆ rGetExpSize()

unsigned long rGetExpSize ( unsigned long  bitmask,
int &  bits,
int  N 
)

Definition at line 2603 of file ring.cc.

2604{
2605#if SIZEOF_LONG == 8
2606 if (N<4) N=4;
2607#else
2608 if (N<2) N=2;
2609#endif
2610 bitmask =rGetExpSize(bitmask, bits);
2611 int vars_per_long=BIT_SIZEOF_LONG/bits;
2612 int bits1;
2613 loop
2614 {
2615 if (bits == BIT_SIZEOF_LONG-1)
2616 {
2617 bits = BIT_SIZEOF_LONG - 1;
2618 return LONG_MAX;
2619 }
2620 unsigned long bitmask1 =rGetExpSize(bitmask+1, bits1);
2621 int vars_per_long1=BIT_SIZEOF_LONG/bits1;
2622 if ((((N+vars_per_long-1)/vars_per_long) ==
2623 ((N+vars_per_long1-1)/vars_per_long1)))
2624 {
2625 vars_per_long=vars_per_long1;
2626 bits=bits1;
2627 bitmask=bitmask1;
2628 }
2629 else
2630 {
2631 return bitmask; /* and bits */
2632 }
2633 }
2634}
#define loop
Definition: structs.h:75

◆ rGetISPos()

int rGetISPos ( const int  p,
const ring  r 
)

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

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

Definition at line 4941 of file ring.cc.

4942{
4943 // Put the reference set F into the ring -ordering -recor
4944#if MYTEST
4945 Print("rIsIS(p: %d)\nF:", p);
4946 PrintLn();
4947#endif
4948
4949 if (r->typ==NULL)
4950 {
4951// dReportError("'rIsIS:' Error: wrong ring! (typ == NULL)");
4952 return -1;
4953 }
4954
4955 int j = p; // Which IS record to use...
4956 for( int pos = 0; pos < r->OrdSize; pos++ )
4957 if( r->typ[pos].ord_typ == ro_is)
4958 if( j-- == 0 )
4959 return pos;
4960
4961 return -1;
4962}

◆ rGetMaxSyzComp()

int rGetMaxSyzComp ( int  i,
const ring  r 
)

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

Definition at line 5099 of file ring.cc.

5100{
5101 if ((r->typ!=NULL) && (r->typ[0].ord_typ==ro_syz) &&
5102 r->typ[0].data.syz.limit > 0 && i > 0)
5103 {
5104 assume(i <= r->typ[0].data.syz.limit);
5105 int j;
5106 for (j=0; j<r->typ[0].data.syz.limit; j++)
5107 {
5108 if (r->typ[0].data.syz.syz_index[j] == i &&
5109 r->typ[0].data.syz.syz_index[j+1] != i)
5110 {
5111 assume(r->typ[0].data.syz.syz_index[j+1] == i+1);
5112 return j;
5113 }
5114 }
5115 return r->typ[0].data.syz.limit;
5116 }
5117 else
5118 {
5119 #ifndef SING_NDEBUG
5120 WarnS("rGetMaxSyzComp: order c");
5121 #endif
5122 return 0;
5123 }
5124}

◆ rGetOrderType()

rOrderType_t rGetOrderType ( ring  r)

Definition at line 1754 of file ring.cc.

1755{
1756 // check for simple ordering
1757 if (rHasSimpleOrder(r))
1758 {
1759 if ((r->order[1] == ringorder_c)
1760 || (r->order[1] == ringorder_C))
1761 {
1762 switch(r->order[0])
1763 {
1764 case ringorder_dp:
1765 case ringorder_wp:
1766 case ringorder_ds:
1767 case ringorder_ws:
1768 case ringorder_ls:
1769 case ringorder_unspec:
1770 if (r->order[1] == ringorder_C
1771 || r->order[0] == ringorder_unspec)
1772 return rOrderType_ExpComp;
1773 return rOrderType_Exp;
1774
1775 default:
1776 assume(r->order[0] == ringorder_lp ||
1777 r->order[0] == ringorder_rs ||
1778 r->order[0] == ringorder_Dp ||
1779 r->order[0] == ringorder_Wp ||
1780 r->order[0] == ringorder_Ds ||
1781 r->order[0] == ringorder_Ws);
1782
1783 if (r->order[1] == ringorder_c) return rOrderType_ExpComp;
1784 return rOrderType_Exp;
1785 }
1786 }
1787 else
1788 {
1789 assume((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C));
1790 return rOrderType_CompExp;
1791 }
1792 }
1793 else
1794 return rOrderType_General;
1795}
BOOLEAN rHasSimpleOrder(const ring r)
Definition: ring.cc:1801

◆ rGetSComps()

void rGetSComps ( int **  currComponents,
long **  currShiftedComponents,
int *  length,
ring  r 
)

Definition at line 4397 of file ring.cc.

4398{
4399#ifdef PDEBUG
4400 rDBGetSComps(currComponents, currShiftedComponents, length, r);
4401#else
4402 rNGetSComps(currComponents, currShiftedComponents, r);
4403#endif
4404}
static void rNGetSComps(int **currComponents, long **currShiftedComponents, ring r)
Definition: ring.cc:4358
static void rDBGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
Definition: ring.cc:4376

◆ rGetVar()

poly rGetVar ( const int  varIndex,
const ring  r 
)

Definition at line 5748 of file ring.cc.

5749{
5750 poly p = p_ISet(1, r);
5751 p_SetExp(p, varIndex, 1, r);
5752 p_Setm(p, r);
5753 return p;
5754}
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1293
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition: p_polys.h:488
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:233

◆ rGetWeightVec()

int64 * rGetWeightVec ( const ring  r)

Definition at line 5184 of file ring.cc.

5185{
5186 assume(r!=NULL);
5187 assume(r->OrdSize>0);
5188 int i=0;
5189 while((r->typ[i].ord_typ!=ro_wp64) && (r->typ[i].ord_typ>0)) i++;
5190 assume(r->typ[i].ord_typ==ro_wp64);
5191 return (int64*)(r->typ[i].data.wp64.weights64);
5192}

◆ rHas_c_Ordering()

BOOLEAN rHas_c_Ordering ( const ring  r)

Definition at line 1797 of file ring.cc.

1798{
1799 return (r->order[0] == ringorder_c);
1800}

◆ rHasGlobalOrdering()

BOOLEAN rHasGlobalOrdering ( const ring  r)
inline

Definition at line 760 of file ring.h.

760{ return (r->OrdSgn==1); }

◆ rHasLocalOrMixedOrdering()

BOOLEAN rHasLocalOrMixedOrdering ( const ring  r)
inline

Definition at line 761 of file ring.h.

761{ return (r->OrdSgn==-1); }

◆ rHasMixedOrdering()

BOOLEAN rHasMixedOrdering ( const ring  r)
inline

Definition at line 762 of file ring.h.

762{ return (r->MixedOrder); }

◆ rHasSimpleLexOrder()

BOOLEAN rHasSimpleLexOrder ( const ring  r)

returns TRUE, if simple lp or ls ordering

Definition at line 1833 of file ring.cc.

1834{
1835 return rHasSimpleOrder(r) &&
1836 (r->order[0] == ringorder_ls ||
1837 r->order[0] == ringorder_lp ||
1838 r->order[1] == ringorder_ls ||
1839 r->order[1] == ringorder_lp);
1840}

◆ rHasSimpleOrder()

BOOLEAN rHasSimpleOrder ( const ring  r)

Definition at line 1801 of file ring.cc.

1802{
1803 if (r->order[0] == ringorder_unspec) return TRUE;
1804 int blocks = rBlocks(r) - 1;
1805 assume(blocks >= 1);
1806 if (blocks == 1) return TRUE;
1807
1808 int s = 0;
1809 while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) )
1810 {
1811 s++;
1812 blocks--;
1813 }
1814
1815 if ((blocks - s) > 2) return FALSE;
1816
1817 assume( blocks == s + 2 );
1818
1819 if (
1820 (r->order[s] != ringorder_c)
1821 && (r->order[s] != ringorder_C)
1822 && (r->order[s+1] != ringorder_c)
1823 && (r->order[s+1] != ringorder_C)
1824 )
1825 return FALSE;
1826 if ((r->order[s+1] == ringorder_M)
1827 || (r->order[s] == ringorder_M))
1828 return FALSE;
1829 return TRUE;
1830}

◆ rIncRefCnt()

static ring rIncRefCnt ( ring  r)
inlinestatic

Definition at line 843 of file ring.h.

843{ r->ref++; return r; }

◆ rInternalChar()

static int rInternalChar ( const ring  r)
inlinestatic

Definition at line 690 of file ring.h.

691{
692 assume(r != NULL);
693 const coeffs C = r->cf;
694 assume(C != NULL);
695 return C->ch;
696}

◆ rIsLPRing()

static BOOLEAN rIsLPRing ( const ring  r)
inlinestatic

Definition at line 411 of file ring.h.

412{
413 assume(r != NULL);
414#ifdef HAVE_SHIFTBBA
415 return (r->isLPring!=0);
416#else
417 return FALSE;
418#endif
419}

◆ rIsNCRing()

static BOOLEAN rIsNCRing ( const ring  r)
inlinestatic

Definition at line 421 of file ring.h.

422{
423 assume(r != NULL);
424 return rIsPluralRing(r) || rIsLPRing(r);
425}
static BOOLEAN rIsLPRing(const ring r)
Definition: ring.h:411

◆ rIsPluralRing()

static BOOLEAN rIsPluralRing ( const ring  r)
inlinestatic

we must always have this test!

Definition at line 400 of file ring.h.

401{
402 assume(r != NULL);
403#ifdef HAVE_PLURAL
404 nc_struct *n;
405 return ((n=r->GetNC()) != NULL) /*&& (n->type != nc_error)*/;
406#else
407 return FALSE;
408#endif
409}

◆ rIsPolyVar()

BOOLEAN rIsPolyVar ( int  i,
const ring  r 
)

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

Definition at line 1950 of file ring.cc.

1951{
1952 int i=0;
1953 while(r->order[i]!=0)
1954 {
1955 if((r->block0[i]<=v)
1956 && (r->block1[i]>=v))
1957 {
1958 switch(r->order[i])
1959 {
1960 case ringorder_a:
1961 return (r->wvhdl[i][v-r->block0[i]]>0);
1962 case ringorder_M:
1963 return 2; /*don't know*/
1964 case ringorder_a64: /* assume: all weight are non-negative!*/
1965 case ringorder_lp:
1966 case ringorder_rs:
1967 case ringorder_dp:
1968 case ringorder_Dp:
1969 case ringorder_wp:
1970 case ringorder_Wp:
1971 return TRUE;
1972 case ringorder_ls:
1973 case ringorder_ds:
1974 case ringorder_Ds:
1975 case ringorder_ws:
1976 case ringorder_Ws:
1977 return FALSE;
1978 default:
1979 break;
1980 }
1981 }
1982 i++;
1983 }
1984 return 3; /* could not find var v*/
1985}

◆ rIsRatGRing()

static BOOLEAN rIsRatGRing ( const ring  r)
inlinestatic

Definition at line 427 of file ring.h.

428{
429 assume(r != NULL);
430#ifdef HAVE_PLURAL
431 /* nc_struct *n; */
432 return (r != NULL) /* && ((n=r->GetNC()) != NULL) */
433 && (r->real_var_start>1);
434#else
435 return FALSE;
436#endif
437}

◆ rIsSyzIndexRing()

static BOOLEAN rIsSyzIndexRing ( const ring  r)
inlinestatic

Definition at line 721 of file ring.h.

722{ assume(r != NULL); assume(r->cf != NULL); return r->order[0] == ringorder_s;}

◆ rKillModified_Wp_Ring()

void rKillModified_Wp_Ring ( ring  r)

Definition at line 3014 of file ring.cc.

3015{
3016 rUnComplete(r);
3017 omFree(r->order);
3018 omFree(r->block0);
3019 omFree(r->block1);
3020 omFree(r->wvhdl[0]);
3021 omFree(r->wvhdl);
3023}

◆ rKillModifiedRing()

void rKillModifiedRing ( ring  r)

Definition at line 3004 of file ring.cc.

3005{
3006 rUnComplete(r);
3007 omFree(r->order);
3008 omFree(r->block0);
3009 omFree(r->block1);
3010 omFree(r->wvhdl);
3012}

◆ rMinpolyIsNULL()

static BOOLEAN rMinpolyIsNULL ( const ring  r)
inlinestatic

Tests whether '(r->cf->minpoly) == NULL'.

Definition at line 700 of file ring.h.

701{
702 assume(r != NULL);
703 const coeffs C = r->cf;
704 assume(C != NULL);
705
706 const BOOLEAN ret = nCoeff_is_algExt(C); // || nCoeff_is_GF(C) || nCoeff_is_long_C(C);
707
708 if( ret )
709 {
710 assume( (C->extRing) != NULL );
711 BOOLEAN idIs0 (ideal h);
712 assume((!((C->extRing)->qideal==NULL)) && (!idIs0((C->extRing)->qideal)));
713 }
714
715 // TODO: this leads to test fails (due to rDecompose?)
716 return !ret;
717}
BOOLEAN idIs0(ideal h)
returns true if h is the zero ideal
STATIC_VAR Poly * h
Definition: janet.cc:971

◆ rMinusVar()

ring rMinusVar ( const ring  r,
char *  v 
)

undo rPlusVar

Definition at line 5861 of file ring.cc.

5862{
5863 if (r->order[2]!=0)
5864 {
5865 WerrorS("only for rings with an ordering of one block");
5866 return NULL;
5867 }
5868 int p;
5869 if((r->order[0]==ringorder_C)
5870 ||(r->order[0]==ringorder_c))
5871 p=1;
5872 else
5873 p=0;
5874 if((r->order[p]!=ringorder_dp)
5875 && (r->order[p]!=ringorder_Dp)
5876 && (r->order[p]!=ringorder_lp)
5877 && (r->order[p]!=ringorder_rp)
5878 && (r->order[p]!=ringorder_ds)
5879 && (r->order[p]!=ringorder_Ds)
5880 && (r->order[p]!=ringorder_ls))
5881 {
5882 WerrorS("ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5883 return NULL;
5884 }
5885 ring R=rCopy0(r);
5886 int i=R->N-1;
5887 while(i>=0)
5888 {
5889 if (strcmp(R->names[i],v)==0)
5890 {
5891 R->N--;
5892 omFree(R->names[i]);
5893 for(int j=i;j<R->N;j++) R->names[j]=R->names[j+1];
5894 R->names=(char**)omReallocSize(R->names,r->N*sizeof(char_ptr),R->N*sizeof(char_ptr));
5895 }
5896 i--;
5897 }
5898 R->block1[p]=R->N;
5899 rComplete(R,1);
5900 return R;
5901}
#define omReallocSize(addr, o_size, size)
Definition: omAllocDecl.h:220
char * char_ptr
Definition: structs.h:53

◆ rModify_a_to_A()

void rModify_a_to_A ( ring  r)

Definition at line 5725 of file ring.cc.

5728{
5729 int i=0;
5730 int j;
5731 while(r->order[i]!=0)
5732 {
5733 if (r->order[i]==ringorder_a)
5734 {
5735 r->order[i]=ringorder_a64;
5736 int *w=r->wvhdl[i];
5737 int64 *w64=(int64 *)omAlloc((r->block1[i]-r->block0[i]+1)*sizeof(int64));
5738 for(j=r->block1[i]-r->block0[i];j>=0;j--)
5739 w64[j]=(int64)w[j];
5740 r->wvhdl[i]=(int*)w64;
5741 omFreeSize(w,(r->block1[i]-r->block0[i]+1)*sizeof(int));
5742 }
5743 i++;
5744 }
5745}
const CanonicalForm & w
Definition: facAbsFact.cc:51

◆ rModifyRing()

ring rModifyRing ( ring  r,
BOOLEAN  omit_degree,
BOOLEAN  omit_comp,
unsigned long  exp_limit 
)

< How many induced ordering block do we have?

Definition at line 2643 of file ring.cc.

2646{
2647 assume (r != NULL );
2648 assume (exp_limit > 1);
2649 BOOLEAN omitted_degree = FALSE;
2650
2651 int bits;
2652 exp_limit=rGetExpSize(exp_limit, bits, r->N);
2653 BOOLEAN need_other_ring = (exp_limit != r->bitmask);
2654
2655 int iNeedInducedOrderingSetup = 0; ///< How many induced ordering block do we have?
2656
2657 int nblocks=rBlocks(r);
2658 rRingOrder_t *order=(rRingOrder_t*)omAlloc0((nblocks+1)*sizeof(rRingOrder_t));
2659 int *block0=(int*)omAlloc0((nblocks+1)*sizeof(int));
2660 int *block1=(int*)omAlloc0((nblocks+1)*sizeof(int));
2661 int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int *));
2662
2663 int i=0;
2664 int j=0; /* i index in r, j index in res */
2665
2666 for( rRingOrder_t r_ord=r->order[i]; (r_ord != (rRingOrder_t)0) && (i < nblocks); j++, r_ord=r->order[++i])
2667 {
2668 BOOLEAN copy_block_index=TRUE;
2669
2670 if (r->block0[i]==r->block1[i])
2671 {
2672 switch(r_ord)
2673 {
2674 case ringorder_wp:
2675 case ringorder_dp:
2676 case ringorder_Wp:
2677 case ringorder_Dp:
2678 r_ord=ringorder_lp;
2679 break;
2680 case ringorder_Ws:
2681 case ringorder_Ds:
2682 case ringorder_ws:
2683 case ringorder_ds:
2684 r_ord=ringorder_ls;
2685 break;
2686 default:
2687 break;
2688 }
2689 }
2690 switch(r_ord)
2691 {
2692 case ringorder_S:
2693 {
2694#ifndef SING_NDEBUG
2695 Warn("Error: unhandled ordering in rModifyRing: ringorder_S = [%d]", r_ord);
2696#endif
2697 order[j]=r_ord; /*r->order[i];*/
2698 break;
2699 }
2700 case ringorder_C:
2701 case ringorder_c:
2702 if (!try_omit_comp)
2703 {
2704 order[j]=r_ord; /*r->order[i]*/;
2705 }
2706 else
2707 {
2708 j--;
2709 need_other_ring=TRUE;
2710 try_omit_comp=FALSE;
2711 copy_block_index=FALSE;
2712 }
2713 break;
2714 case ringorder_wp:
2715 case ringorder_dp:
2716 case ringorder_ws:
2717 case ringorder_ds:
2718 if(!omit_degree)
2719 {
2720 order[j]=r_ord; /*r->order[i]*/;
2721 }
2722 else
2723 {
2724 order[j]=ringorder_rs;
2725 need_other_ring=TRUE;
2726 omit_degree=FALSE;
2727 omitted_degree = TRUE;
2728 }
2729 break;
2730 case ringorder_Wp:
2731 case ringorder_Dp:
2732 case ringorder_Ws:
2733 case ringorder_Ds:
2734 if(!omit_degree)
2735 {
2736 order[j]=r_ord; /*r->order[i];*/
2737 }
2738 else
2739 {
2740 order[j]=ringorder_lp;
2741 need_other_ring=TRUE;
2742 omit_degree=FALSE;
2743 omitted_degree = TRUE;
2744 }
2745 break;
2746 case ringorder_IS:
2747 {
2748 if (try_omit_comp)
2749 {
2750 // tried, but cannot omit component due to the ordering block [%d]: %d (ringorder_IS)", i, r_ord
2751 try_omit_comp = FALSE;
2752 }
2753 order[j]=r_ord; /*r->order[i];*/
2754 iNeedInducedOrderingSetup++;
2755 break;
2756 }
2757 case ringorder_s:
2758 {
2759 assume((i == 0) && (j == 0));
2760 if (try_omit_comp)
2761 {
2762 // tried, but cannot omit component due to the ordering block [%d]: %d (ringorder_s)", i, r_ord
2763 try_omit_comp = FALSE;
2764 }
2765 order[j]=r_ord; /*r->order[i];*/
2766 break;
2767 }
2768 default:
2769 order[j]=r_ord; /*r->order[i];*/
2770 break;
2771 }
2772 if (copy_block_index)
2773 {
2774 block0[j]=r->block0[i];
2775 block1[j]=r->block1[i];
2776 wvhdl[j]=r->wvhdl[i];
2777 }
2778
2779 // order[j]=ringorder_no; // done by omAlloc0
2780 }
2781 if(!need_other_ring)
2782 {
2783 omFreeSize(order,(nblocks+1)*sizeof(rRingOrder_t));
2784 omFreeSize(block0,(nblocks+1)*sizeof(int));
2785 omFreeSize(block1,(nblocks+1)*sizeof(int));
2786 omFreeSize(wvhdl,(nblocks+1)*sizeof(int *));
2787 return r;
2788 }
2789 ring res=(ring)omAlloc0Bin(sip_sring_bin);
2790 *res = *r;
2791
2792#ifdef HAVE_PLURAL
2793 res->GetNC() = NULL;
2794#endif
2795
2796 // res->qideal, res->idroot ???
2797 res->wvhdl=wvhdl;
2798 res->order=order;
2799 res->block0=block0;
2800 res->block1=block1;
2801 res->bitmask=exp_limit;
2802 res->wanted_maxExp=r->wanted_maxExp;
2803 //int tmpref=r->cf->ref0;
2804 rComplete(res, 1);
2805 //r->cf->ref=tmpref;
2806
2807 // adjust res->pFDeg: if it was changed globally, then
2808 // it must also be changed for new ring
2809 if (r->pFDegOrig != res->pFDegOrig &&
2811 {
2812 // still might need adjustment for weighted orderings
2813 // and omit_degree
2814 res->firstwv = r->firstwv;
2815 res->firstBlockEnds = r->firstBlockEnds;
2816 res->pFDeg = res->pFDegOrig = p_WFirstTotalDegree;
2817 }
2818 if (omitted_degree)
2819 res->pLDeg = r->pLDegOrig;
2820
2821 rOptimizeLDeg(res); // also sets res->pLDegOrig
2822
2823 // set syzcomp
2824 if (res->typ != NULL)
2825 {
2826 if( res->typ[0].ord_typ == ro_syz) // "s" Always on [0] place!
2827 {
2828 res->typ[0] = r->typ[0]; // Copy struct!? + setup the same limit!
2829
2830 if (r->typ[0].data.syz.limit > 0)
2831 {
2832 res->typ[0].data.syz.syz_index
2833 = (int*) omAlloc((r->typ[0].data.syz.limit +1)*sizeof(int));
2834 memcpy(res->typ[0].data.syz.syz_index, r->typ[0].data.syz.syz_index,
2835 (r->typ[0].data.syz.limit +1)*sizeof(int));
2836 }
2837 }
2838
2839 if( iNeedInducedOrderingSetup > 0 )
2840 {
2841 for(j = 0, i = 0; (i < nblocks) && (iNeedInducedOrderingSetup > 0); i++)
2842 if( res->typ[i].ord_typ == ro_is ) // Search for suffixes!
2843 {
2844 ideal F = idrHeadR(r->typ[i].data.is.F, r, res); // Copy F from r into res!
2845 assume(
2847 F, // WILL BE COPIED!
2848 r->typ[i].data.is.limit,
2849 j++
2850 )
2851 );
2852 id_Delete(&F, res);
2853 iNeedInducedOrderingSetup--;
2854 }
2855 } // Process all induced Ordering blocks! ...
2856 }
2857 // the special case: homog (omit_degree) and 1 block rs: that is global:
2858 // it comes from dp
2859 res->OrdSgn=r->OrdSgn;
2860
2861
2862#ifdef HAVE_PLURAL
2863 if (rIsPluralRing(r))
2864 {
2865 if ( nc_rComplete(r, res, false) ) // no qideal!
2866 {
2867#ifndef SING_NDEBUG
2868 WarnS("error in nc_rComplete");
2869#endif
2870 // cleanup?
2871
2872// rDelete(res);
2873// return r;
2874
2875 // just go on..
2876 }
2877
2878 if( rIsSCA(r) )
2879 {
2881 WarnS("error in sca_Force!");
2882 }
2883 }
2884#endif
2885
2886 return res;
2887}
#define Warn
Definition: emacs.cc:77
bool sca_Force(ring rGR, int b, int e)
Definition: sca.cc:1161
ideal idrHeadR(ideal id, ring r, ring dest_r)
Copy leading terms of id[i] via prHeeadR into dest_r.
Definition: prCopy.cc:155
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:4973
static void rOptimizeLDeg(ring r)
Definition: ring.cc:3095
BOOLEAN rOrd_is_WeightedDegree_Ordering(const ring r)
Definition: ring.cc:1941
static short scaLastAltVar(ring r)
Definition: sca.h:25
static short scaFirstAltVar(ring r)
Definition: sca.h:18

◆ rModifyRing_Simple()

ring rModifyRing_Simple ( ring  r,
BOOLEAN  omit_degree,
BOOLEAN  omit_comp,
unsigned long  exp_limit,
BOOLEAN simple 
)

Definition at line 2938 of file ring.cc.

2939{
2940 simple=TRUE;
2941 if (!rHasSimpleOrder(r))
2942 {
2943 simple=FALSE; // sorting needed
2944 assume (r != NULL );
2945 assume (exp_limit > 1);
2946 int bits;
2947
2948 exp_limit=rGetExpSize(exp_limit, bits, r->N);
2949
2950 int nblocks=1+(ommit_comp!=0);
2951 rRingOrder_t *order=(rRingOrder_t*)omAlloc0((nblocks+1)*sizeof(rRingOrder_t));
2952 int *block0=(int*)omAlloc0((nblocks+1)*sizeof(int));
2953 int *block1=(int*)omAlloc0((nblocks+1)*sizeof(int));
2954 int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int *));
2955
2956 order[0]=ringorder_lp;
2957 block0[0]=1;
2958 block1[0]=r->N;
2959 if (!ommit_comp)
2960 {
2961 order[1]=ringorder_C;
2962 }
2963 ring res=(ring)omAlloc0Bin(sip_sring_bin);
2964 *res = *r;
2965#ifdef HAVE_PLURAL
2966 res->GetNC() = NULL;
2967#endif
2968 // res->qideal, res->idroot ???
2969 res->wvhdl=wvhdl;
2970 res->order=order;
2971 res->block0=block0;
2972 res->block1=block1;
2973 res->bitmask=exp_limit;
2974 res->wanted_maxExp=r->wanted_maxExp;
2975 //int tmpref=r->cf->ref;
2976 rComplete(res, 1);
2977 //r->cf->ref=tmpref;
2978
2979#ifdef HAVE_PLURAL
2980 if (rIsPluralRing(r))
2981 {
2982 if ( nc_rComplete(r, res, false) ) // no qideal!
2983 {
2984#ifndef SING_NDEBUG
2985 WarnS("error in nc_rComplete");
2986#endif
2987 // cleanup?
2988
2989// rDelete(res);
2990// return r;
2991
2992 // just go on..
2993 }
2994 }
2995#endif
2996
2998
2999 return res;
3000 }
3001 return rModifyRing(r, ommit_degree, ommit_comp, exp_limit);
3002}
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition: ring.cc:2643

◆ rModifyRing_Wp()

ring rModifyRing_Wp ( ring  r,
int *  weights 
)

construct Wp, C ring

Definition at line 2890 of file ring.cc.

2891{
2892 ring res=(ring)omAlloc0Bin(sip_sring_bin);
2893 *res = *r;
2894#ifdef HAVE_PLURAL
2895 res->GetNC() = NULL;
2896#endif
2897
2898 /*weights: entries for 3 blocks: NULL*/
2899 res->wvhdl = (int **)omAlloc0(3 * sizeof(int *));
2900 /*order: Wp,C,0*/
2901 res->order = (rRingOrder_t *) omAlloc(3 * sizeof(rRingOrder_t *));
2902 res->block0 = (int *)omAlloc0(3 * sizeof(int *));
2903 res->block1 = (int *)omAlloc0(3 * sizeof(int *));
2904 /* ringorder Wp for the first block: var 1..r->N */
2905 res->order[0] = ringorder_Wp;
2906 res->block0[0] = 1;
2907 res->block1[0] = r->N;
2908 res->wvhdl[0] = weights;
2909 /* ringorder C for the second block: no vars */
2910 res->order[1] = ringorder_C;
2911 /* the last block: everything is 0 */
2912 res->order[2] = (rRingOrder_t)0;
2913
2914 //int tmpref=r->cf->ref;
2915 rComplete(res, 1);
2916 //r->cf->ref=tmpref;
2917#ifdef HAVE_PLURAL
2918 if (rIsPluralRing(r))
2919 {
2920 if ( nc_rComplete(r, res, false) ) // no qideal!
2921 {
2922#ifndef SING_NDEBUG
2923 WarnS("error in nc_rComplete");
2924#endif
2925 // cleanup?
2926
2927// rDelete(res);
2928// return r;
2929
2930 // just go on..
2931 }
2932 }
2933#endif
2934 return res;
2935}

◆ rOpposite()

ring rOpposite ( ring  r)

Definition at line 5243 of file ring.cc.

5247{
5248 if (src == NULL) return(NULL);
5249
5250 //rChangeCurrRing(src);
5251#ifdef RDEBUG
5252 rTest(src);
5253// rWrite(src);
5254// rDebugPrint(src);
5255#endif
5256
5257 ring r = rCopy0(src,FALSE);
5258 if (src->qideal != NULL)
5259 {
5260 id_Delete(&(r->qideal), src);
5261 }
5262
5263 // change vars v1..vN -> vN..v1
5264 int i;
5265 int i2 = (rVar(r)-1)/2;
5266 for(i=i2; i>=0; i--)
5267 {
5268 // index: 0..N-1
5269 //Print("ex var names: %d <-> %d\n",i,rOppVar(r,i));
5270 // exchange names
5271 char *p;
5272 p = r->names[rVar(r)-1-i];
5273 r->names[rVar(r)-1-i] = r->names[i];
5274 r->names[i] = p;
5275 }
5276// i2=(rVar(r)+1)/2;
5277// for(int i=i2; i>0; i--)
5278// {
5279// // index: 1..N
5280// //Print("ex var places: %d <-> %d\n",i,rVar(r)+1-i);
5281// // exchange VarOffset
5282// int t;
5283// t=r->VarOffset[i];
5284// r->VarOffset[i]=r->VarOffset[rOppVar(r,i)];
5285// r->VarOffset[rOppVar(r,i)]=t;
5286// }
5287 // change names:
5288 // TODO: does this work the same way for Letterplace?
5289 for (i=rVar(r)-1; i>=0; i--)
5290 {
5291 char *p=r->names[i];
5292 if(isupper(*p)) *p = tolower(*p);
5293 else *p = toupper(*p);
5294 }
5295 // change ordering: listing
5296 // change ordering: compare
5297// for(i=0; i<r->OrdSize; i++)
5298// {
5299// int t,tt;
5300// switch(r->typ[i].ord_typ)
5301// {
5302// case ro_dp:
5303// //
5304// t=r->typ[i].data.dp.start;
5305// r->typ[i].data.dp.start=rOppVar(r,r->typ[i].data.dp.end);
5306// r->typ[i].data.dp.end=rOppVar(r,t);
5307// break;
5308// case ro_wp:
5309// case ro_wp_neg:
5310// {
5311// t=r->typ[i].data.wp.start;
5312// r->typ[i].data.wp.start=rOppVar(r,r->typ[i].data.wp.end);
5313// r->typ[i].data.wp.end=rOppVar(r,t);
5314// // invert r->typ[i].data.wp.weights
5315// rOppWeight(r->typ[i].data.wp.weights,
5316// r->typ[i].data.wp.end-r->typ[i].data.wp.start);
5317// break;
5318// }
5319// //case ro_wp64:
5320// case ro_syzcomp:
5321// case ro_syz:
5322// WerrorS("not implemented in rOpposite");
5323// // should not happen
5324// break;
5325//
5326// case ro_cp:
5327// t=r->typ[i].data.cp.start;
5328// r->typ[i].data.cp.start=rOppVar(r,r->typ[i].data.cp.end);
5329// r->typ[i].data.cp.end=rOppVar(r,t);
5330// break;
5331// case ro_none:
5332// default:
5333// Werror("unknown type in rOpposite(%d)",r->typ[i].ord_typ);
5334// break;
5335// }
5336// }
5337 // Change order/block structures (needed for rPrint, rAdd etc.)
5338
5339 int j=0;
5340 int l=rBlocks(src);
5341 if ( ! rIsLPRing(src) )
5342 {
5343 // ie Plural or commutative
5344 for(i=0; src->order[i]!=0; i++)
5345 {
5346 switch (src->order[i])
5347 {
5348 case ringorder_c: /* c-> c */
5349 case ringorder_C: /* C-> C */
5350 case ringorder_no /*=0*/: /* end-of-block */
5351 r->order[j]=src->order[i];
5352 j++; break;
5353 case ringorder_lp: /* lp -> rp */
5354 r->order[j]=ringorder_rp;
5355 r->block0[j]=rOppVar(r, src->block1[i]);
5356 r->block1[j]=rOppVar(r, src->block0[i]);
5357 j++;break;
5358 case ringorder_rp: /* rp -> lp */
5359 r->order[j]=ringorder_lp;
5360 r->block0[j]=rOppVar(r, src->block1[i]);
5361 r->block1[j]=rOppVar(r, src->block0[i]);
5362 j++;break;
5363 case ringorder_dp: /* dp -> a(1..1),ls */
5364 {
5365 l=rRealloc1(r,l,j);
5366 r->order[j]=ringorder_a;
5367 r->block0[j]=rOppVar(r, src->block1[i]);
5368 r->block1[j]=rOppVar(r, src->block0[i]);
5369 r->wvhdl[j]=(int*)omAlloc((r->block1[j]-r->block0[j]+1)*sizeof(int));
5370 for(int k=r->block0[j]; k<=r->block1[j]; k++)
5371 r->wvhdl[j][k-r->block0[j]]=1;
5372 j++;
5373 r->order[j]=ringorder_ls;
5374 r->block0[j]=rOppVar(r, src->block1[i]);
5375 r->block1[j]=rOppVar(r, src->block0[i]);
5376 j++;
5377 break;
5378 }
5379 case ringorder_Dp: /* Dp -> a(1..1),rp */
5380 {
5381 l=rRealloc1(r,l,j);
5382 r->order[j]=ringorder_a;
5383 r->block0[j]=rOppVar(r, src->block1[i]);
5384 r->block1[j]=rOppVar(r, src->block0[i]);
5385 r->wvhdl[j]=(int*)omAlloc((r->block1[j]-r->block0[j]+1)*sizeof(int));
5386 for(int k=r->block0[j]; k<=r->block1[j]; k++)
5387 r->wvhdl[j][k-r->block0[j]]=1;
5388 j++;
5389 r->order[j]=ringorder_rp;
5390 r->block0[j]=rOppVar(r, src->block1[i]);
5391 r->block1[j]=rOppVar(r, src->block0[i]);
5392 j++;
5393 break;
5394 }
5395 case ringorder_wp: /* wp -> a(...),ls */
5396 {
5397 l=rRealloc1(r,l,j);
5398 r->order[j]=ringorder_a;
5399 r->block0[j]=rOppVar(r, src->block1[i]);
5400 r->block1[j]=rOppVar(r, src->block0[i]);
5401 r->wvhdl[j]=r->wvhdl[j+1]; r->wvhdl[j+1]=NULL;
5402 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5403 j++;
5404 r->order[j]=ringorder_ls;
5405 r->block0[j]=rOppVar(r, src->block1[i]);
5406 r->block1[j]=rOppVar(r, src->block0[i]);
5407 j++;
5408 break;
5409 }
5410 case ringorder_Wp: /* Wp -> a(...),rp */
5411 {
5412 l=rRealloc1(r,l,j);
5413 r->order[j]=ringorder_a;
5414 r->block0[j]=rOppVar(r, src->block1[i]);
5415 r->block1[j]=rOppVar(r, src->block0[i]);
5416 r->wvhdl[j]=r->wvhdl[j+1]; r->wvhdl[j+1]=NULL;
5417 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5418 j++;
5419 r->order[j]=ringorder_rp;
5420 r->block0[j]=rOppVar(r, src->block1[i]);
5421 r->block1[j]=rOppVar(r, src->block0[i]);
5422 j++;
5423 break;
5424 }
5425 case ringorder_M: /* M -> M */
5426 {
5427 r->order[j]=ringorder_M;
5428 r->block0[j]=rOppVar(r, src->block1[i]);
5429 r->block1[j]=rOppVar(r, src->block0[i]);
5430 int n=r->block1[j]-r->block0[j];
5431 /* M is a (n+1)x(n+1) matrix */
5432 for (int nn=0; nn<=n; nn++)
5433 {
5434 rOppWeight(&(r->wvhdl[j][nn*(n+1)]), n /*r->block1[j]-r->block0[j]*/);
5435 }
5436 j++;
5437 break;
5438 }
5439 case ringorder_a: /* a(...),ls -> wp/dp */
5440 {
5441 r->block0[j]=rOppVar(r, src->block1[i]);
5442 r->block1[j]=rOppVar(r, src->block0[i]);
5443 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5444 if (src->order[i+1]==ringorder_ls)
5445 {
5446 r->order[j]=ringorder_wp;
5447 i++;
5448 //l=rReallocM1(r,l,j);
5449 }
5450 else
5451 {
5452 r->order[j]=ringorder_a;
5453 }
5454 j++;
5455 break;
5456 }
5457 // not yet done:
5458 case ringorder_ls:
5459 case ringorder_rs:
5460 case ringorder_ds:
5461 case ringorder_Ds:
5462 case ringorder_ws:
5463 case ringorder_Ws:
5464 case ringorder_am:
5465 case ringorder_a64:
5466 // should not occur:
5467 case ringorder_S:
5468 case ringorder_IS:
5469 case ringorder_s:
5470 case ringorder_aa:
5471 case ringorder_L:
5472 case ringorder_unspec:
5473 Werror("order %s not (yet) supported", rSimpleOrdStr(src->order[i]));
5474 break;
5475 }
5476 }
5477 } /* end if (!rIsLPRing(src)) */
5478 if (rIsLPRing(src))
5479 {
5480 // applies to Letterplace only
5481 // Letterplace conventions: dp<->Dp, lp<->rp
5482 // Wp(v) cannot be converted since wp(v) does not encode a monomial ordering
5483 // (a(w),<) is troublesome and thus postponed
5484 for(i=0; src->order[i]!=0; i++)
5485 {
5486 switch (src->order[i])
5487 {
5488 case ringorder_c: /* c-> c */
5489 case ringorder_C: /* C-> C */
5490 case ringorder_no /*=0*/: /* end-of-block */
5491 r->order[j]=src->order[i];
5492 j++; break;
5493 case ringorder_lp: /* lp -> rp */
5494 r->order[j]=ringorder_rp;
5495 r->block0[j]=rOppVar(r, src->block1[i]);
5496 r->block1[j]=rOppVar(r, src->block0[i]);
5497 j++;break;
5498 case ringorder_rp: /* rp -> lp */
5499 r->order[j]=ringorder_lp;
5500 r->block0[j]=rOppVar(r, src->block1[i]);
5501 r->block1[j]=rOppVar(r, src->block0[i]);
5502 j++;break;
5503 case ringorder_dp: /* dp -> Dp */
5504 {
5505 r->order[j]=ringorder_Dp;
5506 r->block0[j]=rOppVar(r, src->block1[i]);
5507 r->block1[j]=rOppVar(r, src->block0[i]);
5508 j++;break;
5509 }
5510 case ringorder_Dp: /* Dp -> dp*/
5511 {
5512 r->order[j]=ringorder_dp;
5513 r->block0[j]=rOppVar(r, src->block1[i]);
5514 r->block1[j]=rOppVar(r, src->block0[i]);
5515 j++;break;
5516 }
5517 // not clear how to do:
5518 case ringorder_wp:
5519 case ringorder_Wp:
5520 case ringorder_M:
5521 case ringorder_a:
5522 // not yet done:
5523 case ringorder_ls:
5524 case ringorder_rs:
5525 case ringorder_ds:
5526 case ringorder_Ds:
5527 case ringorder_ws:
5528 case ringorder_Ws:
5529 case ringorder_am:
5530 case ringorder_a64:
5531 // should not occur:
5532 case ringorder_S:
5533 case ringorder_IS:
5534 case ringorder_s:
5535 case ringorder_aa:
5536 case ringorder_L:
5537 case ringorder_unspec:
5538 Werror("order %s not (yet) supported", rSimpleOrdStr(src->order[i]));
5539 break;
5540 }
5541 }
5542 } /* end if (rIsLPRing(src)) */
5543 rComplete(r);
5544
5545 //rChangeCurrRing(r);
5546#ifdef RDEBUG
5547 rTest(r);
5548// rWrite(r);
5549// rDebugPrint(r);
5550#endif
5551
5552#ifdef HAVE_PLURAL
5553 // now, we initialize a non-comm structure on r
5554 if (rIsPluralRing(src))
5555 {
5556// assume( currRing == r);
5557
5558 int *perm = (int *)omAlloc0((rVar(r)+1)*sizeof(int));
5559 int *par_perm = NULL;
5560 nMapFunc nMap = n_SetMap(src->cf,r->cf);
5561 int ni,nj;
5562 for(i=1; i<=r->N; i++)
5563 {
5564 perm[i] = rOppVar(r,i);
5565 }
5566
5567 matrix C = mpNew(rVar(r),rVar(r));
5568 matrix D = mpNew(rVar(r),rVar(r));
5569
5570 for (i=1; i< rVar(r); i++)
5571 {
5572 for (j=i+1; j<=rVar(r); j++)
5573 {
5574 ni = r->N +1 - i;
5575 nj = r->N +1 - j; /* i<j ==> nj < ni */
5576
5577 assume(MATELEM(src->GetNC()->C,i,j) != NULL);
5578 MATELEM(C,nj,ni) = p_PermPoly(MATELEM(src->GetNC()->C,i,j),perm,src,r, nMap,par_perm,rPar(src));
5579
5580 if(MATELEM(src->GetNC()->D,i,j) != NULL)
5581 MATELEM(D,nj,ni) = p_PermPoly(MATELEM(src->GetNC()->D,i,j),perm,src,r, nMap,par_perm,rPar(src));
5582 }
5583 }
5584
5585 id_Test((ideal)C, r);
5586 id_Test((ideal)D, r);
5587
5588 if (nc_CallPlural(C, D, NULL, NULL, r, false, false, true, r)) // no qring setup!
5589 WarnS("Error initializing non-commutative multiplication!");
5590
5591#ifdef RDEBUG
5592 rTest(r);
5593// rWrite(r);
5594// rDebugPrint(r);
5595#endif
5596
5597 assume( r->GetNC()->IsSkewConstant == src->GetNC()->IsSkewConstant);
5598
5599 omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
5600 }
5601#endif /* HAVE_PLURAL */
5602
5603 /* now oppose the qideal for qrings */
5604 if (src->qideal != NULL)
5605 {
5606#ifdef HAVE_PLURAL
5607 r->qideal = idOppose(src, src->qideal, r); // into the currRing: r
5608#else
5609 r->qideal = id_Copy(src->qideal, r); // ?
5610#endif
5611
5612#ifdef HAVE_PLURAL
5613 if( rIsPluralRing(r) )
5614 {
5616#ifdef RDEBUG
5617 rTest(r);
5618// rWrite(r);
5619// rDebugPrint(r);
5620#endif
5621 }
5622#endif
5623 }
5624#ifdef HAVE_PLURAL
5625 if( rIsPluralRing(r) )
5626 assume( ncRingType(r) == ncRingType(src) );
5627#endif
5628 rTest(r);
5629
5630 return r;
5631}
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:700
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
#define D(A)
Definition: gentable.cc:131
ideal id_Copy(ideal h1, const ring r)
copy an ideal
ideal idOppose(ring Rop_src, ideal I, const ring Rop_dst)
opposes a module I from Rop to currRing(dst)
Definition: old.gring.cc:3381
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:2682
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
#define MATELEM(mat, i, j)
1-based access to matrix
Definition: matpol.h:29
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition: p_polys.cc:4163
#define rOppVar(R, I)
Definition: ring.cc:5240
const char * rSimpleOrdStr(int ord)
Definition: ring.cc:77
static void rOppWeight(int *w, int l)
Definition: ring.cc:5227
static int rRealloc1(ring r, int size, int pos)
Definition: ring.cc:5204
static int rPar(const ring r)
(r->cf->P)
Definition: ring.h:600
#define id_Test(A, lR)
Definition: simpleideals.h:78

◆ rOrd_is_Comp_dp()

static BOOLEAN rOrd_is_Comp_dp ( const ring  r)
inlinestatic

Definition at line 776 of file ring.h.

777{
778 assume(r != NULL);
779 assume(r->cf != NULL);
780 return ((r->order[0] == ringorder_c || r->order[0] == ringorder_C) &&
781 r->order[1] == ringorder_dp &&
782 r->order[2] == 0);
783}

◆ rOrd_is_Totaldegree_Ordering()

BOOLEAN rOrd_is_Totaldegree_Ordering ( const ring  r)

Definition at line 1927 of file ring.cc.

1928{
1929 // Hmm.... what about Syz orderings?
1930 return (rVar(r) > 1 &&
1931 ((rHasSimpleOrder(r) &&
1932 (rOrder_is_DegOrdering((rRingOrder_t)r->order[0]) ||
1933 rOrder_is_DegOrdering(( rRingOrder_t)r->order[1]))) ||
1934 (rHasSimpleOrderAA(r) &&
1935 (rOrder_is_DegOrdering((rRingOrder_t)r->order[1]) ||
1936 ((r->order[1]!=0) &&
1937 rOrder_is_DegOrdering((rRingOrder_t)r->order[2]))))));
1938}
BOOLEAN rOrder_is_DegOrdering(const rRingOrder_t order)
Definition: ring.cc:1842
BOOLEAN rHasSimpleOrderAA(ring r)
Definition: ring.cc:1876

◆ rOrd_SetCompRequiresSetm()

BOOLEAN rOrd_SetCompRequiresSetm ( const ring  r)

return TRUE if p_SetComp requires p_Setm

Definition at line 1907 of file ring.cc.

1908{
1909 if (r->typ != NULL)
1910 {
1911 int pos;
1912 for (pos=0;pos<r->OrdSize;pos++)
1913 {
1914 sro_ord* o=&(r->typ[pos]);
1915 if ( (o->ord_typ == ro_syzcomp)
1916 || (o->ord_typ == ro_syz)
1917 || (o->ord_typ == ro_is)
1918 || (o->ord_typ == ro_am)
1919 || (o->ord_typ == ro_isTemp))
1920 return TRUE;
1921 }
1922 }
1923 return FALSE;
1924}
ro_typ ord_typ
Definition: ring.h:220

◆ rOrderName()

rRingOrder_t rOrderName ( char *  ordername)

Definition at line 506 of file ring.cc.

507{
508 int order=ringorder_unspec;
509 while (order!= 0)
510 {
511 if (strcmp(ordername,rSimpleOrdStr(order))==0)
512 break;
513 order--;
514 }
515 if (order==0) Werror("wrong ring order `%s`",ordername);
516 omFree((ADDRESS)ordername);
517 return (rRingOrder_t)order;
518}

◆ rOrdStr()

char * rOrdStr ( ring  r)

Definition at line 520 of file ring.cc.

521{
522 if ((r==NULL)||(r->order==NULL)) return omStrDup("");
523 int nblocks,l,i;
524
525 for (nblocks=0; r->order[nblocks]; nblocks++);
526 nblocks--;
527
528 StringSetS("");
529 for (l=0; ; l++)
530 {
531 StringAppendS((char *)rSimpleOrdStr(r->order[l]));
532 if (r->order[l] == ringorder_s)
533 {
534 StringAppend("(%d)",r->block0[l]);
535 }
536 else if (
537 (r->order[l] != ringorder_c)
538 && (r->order[l] != ringorder_C)
539 && (r->order[l] != ringorder_s)
540 && (r->order[l] != ringorder_S)
541 && (r->order[l] != ringorder_IS)
542 )
543 {
544 if (r->wvhdl[l]!=NULL)
545 {
546 #ifndef SING_NDEBUG
547 if((r->order[l] != ringorder_wp)
548 &&(r->order[l] != ringorder_Wp)
549 &&(r->order[l] != ringorder_ws)
550 &&(r->order[l] != ringorder_Ws)
551 &&(r->order[l] != ringorder_a)
552 &&(r->order[l] != ringorder_am)
553 &&(r->order[l] != ringorder_M))
554 {
555 Warn("should not have wvhdl entry at pos. %d",l);
556 StringAppend("(%d)",r->block1[l]-r->block0[l]+1);
557 }
558 else
559 #endif
560 {
561 StringAppendS("(");
562 for (int j= 0;
563 j<(r->block1[l]-r->block0[l]+1)*(r->block1[l]-r->block0[l]+1);
564 j+=i+1)
565 {
566 char c=',';
567 if(r->order[l]==ringorder_a64)
568 {
569 int64 * w=(int64 *)r->wvhdl[l];
570 for (i = 0; i<r->block1[l]-r->block0[l]; i++)
571 {
572 StringAppend("%lld," ,w[i]);
573 }
574 StringAppend("%lld)" ,w[i]);
575 break;
576 }
577 else
578 {
579 for (i = 0; i<r->block1[l]-r->block0[l]; i++)
580 {
581 StringAppend("%d," ,r->wvhdl[l][i+j]);
582 }
583 }
584 if (r->order[l]!=ringorder_M)
585 {
586 StringAppend("%d)" ,r->wvhdl[l][i+j]);
587 break;
588 }
589 if (j+i+1==(r->block1[l]-r->block0[l]+1)*(r->block1[l]-r->block0[l]+1))
590 c=')';
591 StringAppend("%d%c" ,r->wvhdl[l][i+j],c);
592 }
593 }
594 }
595 else
596 StringAppend("(%d)",r->block1[l]-r->block0[l]+1);
597 }
598 else if (r->order[l] == ringorder_IS)
599 {
600 assume( r->block0[l] == r->block1[l] );
601 const int s = r->block0[l];
602 assume( (-2 < s) && (s < 2) );
603
604 StringAppend("(%d)", s);
605 }
606
607 if (l==nblocks)
608 {
609 if (r->wanted_maxExp!=0)
610 {
611 long mm=r->wanted_maxExp;
612 if (mm>MAX_INT_VAL) mm=MAX_INT_VAL;
613 StringAppend(",L(%ld)",mm);
614 }
615 return StringEndS();
616 }
617 StringAppendS(",");
618 }
619}
for(int i=0;i<=n;i++) degsf[i]
Definition: cfEzgcd.cc:72
#define StringAppend
Definition: emacs.cc:79
const int MAX_INT_VAL
Definition: mylimits.h:12
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
char * StringEndS()
Definition: reporter.cc:151

◆ rPar()

static int rPar ( const ring  r)
inlinestatic

(r->cf->P)

Definition at line 600 of file ring.h.

601{
602 assume(r != NULL);
603 const coeffs C = r->cf;
604 assume(C != NULL);
605
606 return n_NumberOfParameters(C);
607// if( nCoeff_is_Extension(C) )
608// {
609// const ring R = C->extRing;
610// assume( R != NULL );
611// return rVar( R );
612// }
613// else if (nCoeff_is_GF(C))
614// {
615// return 1;
616// }
617// else if (nCoeff_is_long_C(C))
618// {
619// return 1;
620// }
621// return 0;
622}
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:774

◆ rParameter()

static char const ** rParameter ( const ring  r)
inlinestatic

(r->cf->parameter)

Definition at line 626 of file ring.h.

627{
628 assume(r != NULL);
629 const coeffs C = r->cf;
630 assume(C != NULL);
631
632 return n_ParameterNames(C);
633// if( nCoeff_is_Extension(C) ) // only alg / trans. exts...
634// {
635// const ring R = C->extRing;
636// assume( R != NULL );
637// return R->names;
638// }
639// else if (nCoeff_is_GF(C))
640// {
641// return &(C->m_nfParameter);
642// }
643// else if (nCoeff_is_long_C(C))
644// {
645// return &(C->complex_parameter);
646// }
647// return NULL;
648}
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:778

◆ rParStr()

char * rParStr ( ring  r)

Definition at line 647 of file ring.cc.

648{
649 if ((r==NULL)||(rParameter(r)==NULL)) return omStrDup("");
650
651 char const * const * const params = rParameter(r);
652
653 int i;
654 int l=2;
655
656 for (i=0; i<rPar(r); i++)
657 {
658 l+=strlen(params[i])+1;
659 }
660 char *s=(char *)omAlloc((long)l);
661 s[0]='\0';
662 for (i=0; i<rPar(r)-1; i++)
663 {
664 strcat(s, params[i]);
665 strcat(s,",");
666 }
667 strcat(s, params[i]);
668 return s;
669}
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition: ring.h:626

◆ rPlusVar()

ring rPlusVar ( const ring  r,
char *  v,
int  left 
)

K[x],"y" -> K[x,y] resp. K[y,x].

Definition at line 5779 of file ring.cc.

5780{
5781 if (r->order[2]!=0)
5782 {
5783 WerrorS("only for rings with an ordering of one block");
5784 return NULL;
5785 }
5786 int p;
5787 if((r->order[0]==ringorder_C)
5788 ||(r->order[0]==ringorder_c))
5789 p=1;
5790 else
5791 p=0;
5792 if((r->order[p]!=ringorder_dp)
5793 && (r->order[p]!=ringorder_Dp)
5794 && (r->order[p]!=ringorder_lp)
5795 && (r->order[p]!=ringorder_rp)
5796 && (r->order[p]!=ringorder_ds)
5797 && (r->order[p]!=ringorder_Ds)
5798 && (r->order[p]!=ringorder_ls))
5799 {
5800 WerrorS("ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5801 return NULL;
5802 }
5803 for(int i=r->N-1;i>=0;i--)
5804 {
5805 if (strcmp(r->names[i],v)==0)
5806 {
5807 Werror("duplicate variable name >>%s<<",v);
5808 return NULL;
5809 }
5810 }
5811 ring R=rCopy0(r);
5812 char **names;
5813 #ifdef HAVE_SHIFTBBA
5814 if (rIsLPRing(r))
5815 {
5816 R->isLPring=r->isLPring+1;
5817 R->N=((r->N)/r->isLPring)+r->N;
5818 names=(char**)omAlloc(R->N*sizeof(char_ptr));
5819 if (left)
5820 {
5821 for(int b=0;b<((r->N)/r->isLPring);b++)
5822 {
5823 names[b*R->isLPring]=omStrDup(v);
5824 for(int i=R->isLPring-1;i>0;i--)
5825 names[i+b*R->isLPring]=R->names[i-1+b*r->isLPring];
5826 }
5827 }
5828 else
5829 {
5830 for(int b=0;b<((r->N)/r->isLPring);b++)
5831 {
5832 names[(b+1)*R->isLPring-1]=omStrDup(v);
5833 for(int i=R->isLPring-2;i>=0;i--)
5834 names[i+b*R->isLPring]=R->names[i+b*r->isLPring];
5835 }
5836 }
5837 }
5838 else
5839 #endif
5840 {
5841 R->N++;
5842 names=(char**)omAlloc(R->N*sizeof(char_ptr));
5843 if (left)
5844 {
5845 names[0]=omStrDup(v);
5846 for(int i=R->N-1;i>0;i--) names[i]=R->names[i-1];
5847 }
5848 else
5849 {
5850 names[R->N-1]=omStrDup(v);
5851 for(int i=R->N-2;i>=0;i--) names[i]=R->names[i];
5852 }
5853 }
5854 omFreeSize(R->names,r->N*sizeof(char_ptr));
5855 R->names=names;
5856 R->block1[p]=R->N;
5857 rComplete(R);
5858 return R;
5859}
CanonicalForm b
Definition: cfModGcd.cc:4102

◆ rRing_has_CompLastBlock()

BOOLEAN rRing_has_CompLastBlock ( const ring  r)

Definition at line 5147 of file ring.cc.

5148{
5149 assume(r != NULL);
5150 int lb = rBlocks(r) - 2;
5151 return (r->order[lb] == ringorder_c || r->order[lb] == ringorder_C);
5152}

◆ rRing_is_Homog()

BOOLEAN rRing_is_Homog ( const ring  r)

Definition at line 5126 of file ring.cc.

5127{
5128 if (r == NULL) return FALSE;
5129 int i, j, nb = rBlocks(r);
5130 for (i=0; i<nb; i++)
5131 {
5132 if (r->wvhdl[i] != NULL)
5133 {
5134 int length = r->block1[i] - r->block0[i];
5135 int* wvhdl = r->wvhdl[i];
5136 if (r->order[i] == ringorder_M) length *= length;
5137
5138 for (j=0; j< length; j++)
5139 {
5140 if (wvhdl[j] != 0 && wvhdl[j] != 1) return FALSE;
5141 }
5142 }
5143 }
5144 return TRUE;
5145}

◆ rRing_ord_pure_dp()

BOOLEAN rRing_ord_pure_dp ( const ring  r)

Definition at line 5154 of file ring.cc.

5155{
5156 if ((r->order[0]==ringorder_dp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5157 return TRUE;
5158 if (((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C))
5159 && ((r->order[1]==ringorder_dp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5160 return TRUE;
5161 return FALSE;
5162}

◆ rRing_ord_pure_Dp()

BOOLEAN rRing_ord_pure_Dp ( const ring  r)

Definition at line 5164 of file ring.cc.

5165{
5166 if ((r->order[0]==ringorder_Dp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5167 return TRUE;
5168 if (((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C))
5169 && ((r->order[1]==ringorder_Dp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5170 return TRUE;
5171 return FALSE;
5172}

◆ rRing_ord_pure_lp()

BOOLEAN rRing_ord_pure_lp ( const ring  r)

Definition at line 5174 of file ring.cc.

5175{
5176 if ((r->order[0]==ringorder_lp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5177 return TRUE;
5178 if (((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C))
5179 && ((r->order[1]==ringorder_lp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5180 return TRUE;
5181 return FALSE;
5182}

◆ rRingVar()

static char * rRingVar ( short  i,
const ring  r 
)
inlinestatic

Definition at line 578 of file ring.h.

579{
580 assume(r != NULL); assume(r->cf != NULL); return r->names[i];
581}

◆ rSamePolyRep()

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 1713 of file ring.cc.

1714{
1715 int i, j;
1716
1717 if (r1 == r2) return TRUE;
1718
1719 if (r1 == NULL || r2 == NULL) return FALSE;
1720
1721 if ((r1->cf != r2->cf)
1722 || (rVar(r1) != rVar(r2))
1723 || (r1->OrdSgn != r2->OrdSgn))
1724 return FALSE;
1725
1726 i=0;
1727 while (r1->order[i] != 0)
1728 {
1729 if (r2->order[i] == 0) return FALSE;
1730 if ((r1->order[i] != r2->order[i])
1731 || (r1->block0[i] != r2->block0[i])
1732 || (r1->block1[i] != r2->block1[i]))
1733 return FALSE;
1734 if (r1->wvhdl[i] != NULL)
1735 {
1736 if (r2->wvhdl[i] == NULL)
1737 return FALSE;
1738 for (j=0; j<r1->block1[i]-r1->block0[i]+1; j++)
1739 if (r2->wvhdl[i][j] != r1->wvhdl[i][j])
1740 return FALSE;
1741 }
1742 else if (r2->wvhdl[i] != NULL) return FALSE;
1743 i++;
1744 }
1745 if (r2->order[i] != 0) return FALSE;
1746
1747 // we do not check variable names
1748 // we do not check minpoly/minideal
1749 // we do not check qideal
1750
1751 return TRUE;
1752}

◆ rSetISReference()

BOOLEAN rSetISReference ( const ring  r,
const ideal  F,
const int  i = 0,
const int  p = 0 
)

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 4973 of file ring.cc.

4974{
4975 // Put the reference set F into the ring -ordering -recor
4976
4977 if (r->typ==NULL)
4978 {
4979 dReportError("Error: WRONG USE of rSetISReference: wrong ring! (typ == NULL)");
4980 return FALSE;
4981 }
4982
4983
4984 int pos = rGetISPos(p, r);
4985
4986 if( pos == -1 )
4987 {
4988 dReportError("Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
4989 return FALSE;
4990 }
4991
4992#if MYTEST
4993 if( i != r->typ[pos].data.is.limit )
4994 Print("Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit, i);
4995#endif
4996
4997 const ideal FF = idrHeadR(F, r, r); // id_Copy(F, r); // ???
4998
4999
5000 if( r->typ[pos].data.is.F != NULL)
5001 {
5002#if MYTEST
5003 PrintS("Deleting old reference set F... \n"); // idShow(r->typ[pos].data.is.F, r); PrintLn();
5004#endif
5005 id_Delete(&r->typ[pos].data.is.F, r);
5006 r->typ[pos].data.is.F = NULL;
5007 }
5008
5009 assume(r->typ[pos].data.is.F == NULL);
5010
5011 r->typ[pos].data.is.F = FF; // F is owened by ring now! TODO: delete at the end!
5012
5013 r->typ[pos].data.is.limit = i; // First induced component
5014
5015#if MYTEST
5016 PrintS("New reference set FF : \n"); idShow(FF, r, r, 1); PrintLn();
5017#endif
5018
5019 return TRUE;
5020}
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!...
Definition: ring.cc:4941
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)
Definition: simpleideals.cc:57

◆ rSetSyzComp()

void rSetSyzComp ( int  k,
const ring  r 
)

Definition at line 5027 of file ring.cc.

5028{
5029 if(k < 0)
5030 {
5031 dReportError("rSetSyzComp with negative limit!");
5032 return;
5033 }
5034
5035 assume( k >= 0 );
5036 if (TEST_OPT_PROT) Print("{%d}", k);
5037 if ((r->typ!=NULL) && (r->typ[0].ord_typ==ro_syz))
5038 {
5039 r->block0[0]=r->block1[0] = k;
5040 if( k == r->typ[0].data.syz.limit )
5041 return; // nothing to do
5042
5043 int i;
5044 if (r->typ[0].data.syz.limit == 0)
5045 {
5046 r->typ[0].data.syz.syz_index = (int*) omAlloc0((k+1)*sizeof(int));
5047 r->typ[0].data.syz.syz_index[0] = 0;
5048 r->typ[0].data.syz.curr_index = 1;
5049 }
5050 else
5051 {
5052 r->typ[0].data.syz.syz_index = (int*)
5053 omReallocSize(r->typ[0].data.syz.syz_index,
5054 (r->typ[0].data.syz.limit+1)*sizeof(int),
5055 (k+1)*sizeof(int));
5056 }
5057 for (i=r->typ[0].data.syz.limit + 1; i<= k; i++)
5058 {
5059 r->typ[0].data.syz.syz_index[i] =
5060 r->typ[0].data.syz.curr_index;
5061 }
5062 if(k < r->typ[0].data.syz.limit) // ?
5063 {
5064#ifndef SING_NDEBUG
5065 Warn("rSetSyzComp called with smaller limit (%d) as before (%d)", k, r->typ[0].data.syz.limit);
5066#endif
5067 r->typ[0].data.syz.curr_index = 1 + r->typ[0].data.syz.syz_index[k];
5068 }
5069
5070
5071 r->typ[0].data.syz.limit = k;
5072 r->typ[0].data.syz.curr_index++;
5073 }
5074 else if(
5075 (r->typ!=NULL) &&
5076 (r->typ[0].ord_typ==ro_isTemp)
5077 )
5078 {
5079// (r->typ[currRing->typ[0].data.isTemp.suffixpos].data.is.limit == k)
5080#ifndef SING_NDEBUG
5081 Warn("rSetSyzComp(%d) in an IS ring! Be careful!", k);
5082#endif
5083 }
5084 else if (r->order[0]==ringorder_s)
5085 {
5086 r->block0[0] = r->block1[0] = k;
5087 }
5088 else if (r->order[0]!=ringorder_c)
5089 {
5090 dReportError("syzcomp in incompatible ring");
5091 }
5092#ifdef PDEBUG
5094 pDBsyzComp=k;
5095#endif
5096}
#define EXTERN_VAR
Definition: globaldefs.h:6
#define TEST_OPT_PROT
Definition: options.h:103
VAR int pDBsyzComp
Definition: ring.cc:5023

◆ rSetWeightVec()

void rSetWeightVec ( ring  r,
int64 wv 
)

Definition at line 5194 of file ring.cc.

5195{
5196 assume(r!=NULL);
5197 assume(r->OrdSize>0);
5198 assume(r->typ[0].ord_typ==ro_wp64);
5199 memcpy(r->typ[0].data.wp64.weights64,wv,r->N*sizeof(int64));
5200}

◆ rShortOut()

static BOOLEAN rShortOut ( const ring  r)
inlinestatic

Definition at line 582 of file ring.h.

583{
584 assume(r != NULL); return (r->ShortOut);
585}

◆ rSimpleOrdStr()

const char * rSimpleOrdStr ( int  ord)

Definition at line 77 of file ring.cc.

78{
79 return ringorder_name[ord];
80}
static const char *const ringorder_name[]
Definition: ring.cc:47

◆ rString()

char * rString ( ring  r)

Definition at line 671 of file ring.cc.

672{
673 if ((r!=NULL)&&(r->cf!=NULL))
674 {
675 char *ch=rCharStr(r);
676 char *var=rVarStr(r);
677 char *ord=rOrdStr(r);
678 char *res=(char *)omAlloc(strlen(ch)+strlen(var)+strlen(ord)+9);
679 sprintf(res,"(%s),(%s),(%s)",ch,var,ord);
680 omFree((ADDRESS)ch);
681 omFree((ADDRESS)var);
682 omFree((ADDRESS)ord);
683 return res;
684 }
685 else
686 return omStrDup("undefined");
687}
char * rCharStr(const ring r)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
Definition: ring.cc:645
char * rOrdStr(ring r)
Definition: ring.cc:520
char * rVarStr(ring r)
Definition: ring.cc:621

◆ rSum()

int rSum ( ring  r1,
ring  r2,
ring &  sum 
)

Definition at line 1344 of file ring.cc.

1345{
1346 if ((r1==NULL)||(r2==NULL)
1347 ||(r1->cf==NULL)||(r2->cf==NULL))
1348 return -1;
1349 if (r1==r2)
1350 {
1351 sum=r1;
1352 rIncRefCnt(r1);
1353 return 0;
1354 }
1355 return rSumInternal(r1,r2,sum,TRUE,FALSE);
1356}
int rSumInternal(ring r1, ring r2, ring &sum, BOOLEAN vartest, BOOLEAN dp_dp)
returns -1 for not compatible, 1 for compatible (and sum) dp_dp:0: block ordering,...
Definition: ring.cc:747
static ring rIncRefCnt(ring r)
Definition: ring.h:843

◆ rSumInternal()

int rSumInternal ( ring  r1,
ring  r2,
ring &  sum,
BOOLEAN  vartest,
BOOLEAN  dp_dp 
)

returns -1 for not compatible, 1 for compatible (and sum) dp_dp:0: block ordering, 1: dp,dp, 2: aa(...),dp vartest: check for name conflicts

Definition at line 747 of file ring.cc.

748{
749
750 ip_sring tmpR;
751 memset(&tmpR,0,sizeof(tmpR));
752 /* check coeff. field =====================================================*/
753
754 if (r1->cf==r2->cf)
755 {
756 tmpR.cf=nCopyCoeff(r1->cf);
757 }
758 else /* different type */
759 {
760 if (getCoeffType(r1->cf)==n_Zp)
761 {
762 if (getCoeffType(r2->cf)==n_Q)
763 {
764 tmpR.cf=nCopyCoeff(r1->cf);
765 }
766 else if (nCoeff_is_Extension(r2->cf) && rChar(r2) == rChar(r1))
767 {
768 /*AlgExtInfo extParam;
769 extParam.r = r2->cf->extRing;
770 extParam.i = r2->cf->extRing->qideal;*/
771 tmpR.cf=nCopyCoeff(r2->cf);
772 }
773 else
774 {
775 WerrorS("Z/p+...");
776 return -1;
777 }
778 }
779 else if ((getCoeffType(r1->cf)==n_Zn)||(getCoeffType(r1->cf)==n_Znm))
780 {
781 if (getCoeffType(r2->cf)==n_Q)
782 {
783 tmpR.cf=nCopyCoeff(r1->cf);
784 }
785 else if (nCoeff_is_Extension(r2->cf)
786 && (mpz_cmp(r1->cf->modNumber,r2->cf->extRing->cf->modNumber)==0))
787 { // covers transext.cc and algext.cc
788 tmpR.cf=nCopyCoeff(r2->cf);
789 }
790 else
791 {
792 WerrorS("Z/n+...");
793 return -1;
794 }
795 }
796 else if (getCoeffType(r1->cf)==n_R)
797 {
798 WerrorS("R+..");
799 return -1;
800 }
801 else if (getCoeffType(r1->cf)==n_Q)
802 {
803 if (getCoeffType(r2->cf)==n_Zp)
804 {
805 tmpR.cf=nCopyCoeff(r2->cf);
806 }
807 else if (nCoeff_is_Extension(r2->cf))
808 {
809 tmpR.cf=nCopyCoeff(r2->cf);
810 }
811 else
812 {
813 WerrorS("Q+...");
814 return -1;
815 }
816 }
817 else if (nCoeff_is_Extension(r1->cf))
818 {
819 if (r1->cf->extRing->cf==r2->cf)
820 {
821 tmpR.cf=nCopyCoeff(r1->cf);
822 }
823 else if (getCoeffType(r1->cf->extRing->cf)==n_Zp && getCoeffType(r2->cf)==n_Q) //r2->cf == n_Zp should have been handled above
824 {
825 tmpR.cf=nCopyCoeff(r1->cf);
826 }
827 else
828 {
829 WerrorS ("coeff sum of two extension fields not implemented");
830 return -1;
831 }
832 }
833 else
834 {
835 WerrorS("coeff sum not yet implemented");
836 return -1;
837 }
838 }
839 /* variable names ========================================================*/
840 int i,j,k;
841 int l=r1->N+r2->N;
842 char **names=(char **)omAlloc0(l*sizeof(char *));
843 k=0;
844
845 // collect all varnames from r1, except those which are parameters
846 // of r2, or those which are the empty string
847 for (i=0;i<r1->N;i++)
848 {
849 BOOLEAN b=TRUE;
850
851 if (*(r1->names[i]) == '\0')
852 b = FALSE;
853 else if ((rParameter(r2)!=NULL) && (strlen(r1->names[i])==1))
854 {
855 if (vartest)
856 {
857 for(j=0;j<rPar(r2);j++)
858 {
859 if (strcmp(r1->names[i],rParameter(r2)[j])==0)
860 {
861 b=FALSE;
862 break;
863 }
864 }
865 }
866 }
867
868 if (b)
869 {
870 //Print("name : %d: %s\n",k,r1->names[i]);
871 names[k]=omStrDup(r1->names[i]);
872 k++;
873 }
874 //else
875 // Print("no name (par1) %s\n",r1->names[i]);
876 }
877 // Add variables from r2, except those which are parameters of r1
878 // those which are empty strings, and those which equal a var of r1
879 for(i=0;i<r2->N;i++)
880 {
881 BOOLEAN b=TRUE;
882
883 if (*(r2->names[i]) == '\0')
884 b = FALSE;
885 else if ((rParameter(r1)!=NULL) && (strlen(r2->names[i])==1))
886 {
887 if (vartest)
888 {
889 for(j=0;j<rPar(r1);j++)
890 {
891 if (strcmp(r2->names[i],rParameter(r1)[j])==0)
892 {
893 b=FALSE;
894 break;
895 }
896 }
897 }
898 }
899
900 if (b)
901 {
902 if (vartest)
903 {
904 for(j=0;j<r1->N;j++)
905 {
906 if (strcmp(r1->names[j],r2->names[i])==0)
907 {
908 b=FALSE;
909 break;
910 }
911 }
912 }
913 if (b)
914 {
915 //Print("name : %d : %s\n",k,r2->names[i]);
916 names[k]=omStrDup(r2->names[i]);
917 k++;
918 }
919 //else
920 // Print("no name (var): %s\n",r2->names[i]);
921 }
922 //else
923 // Print("no name (par): %s\n",r2->names[i]);
924 }
925 // check whether we found any vars at all
926 if (k == 0)
927 {
928 names[k]=omStrDup("");
929 k=1;
930 }
931 tmpR.N=k;
932 tmpR.names=names;
933 /* ordering *======================================================== */
934 tmpR.OrdSgn=0;
935 if ((dp_dp==2)
936 && (r1->OrdSgn==1)
937 && (r2->OrdSgn==1)
938#ifdef HAVE_PLURAL
939 && !rIsPluralRing(r1) && !rIsPluralRing(r2)
940#endif
941 )
942 {
943 tmpR.order=(rRingOrder_t*)omAlloc0(4*sizeof(rRingOrder_t));
944 tmpR.block0=(int*)omAlloc0(4*sizeof(int));
945 tmpR.block1=(int*)omAlloc0(4*sizeof(int));
946 tmpR.wvhdl=(int**) omAlloc0(4*sizeof(int**));
947 // ----
948 tmpR.block0[0] = 1;
949 tmpR.block1[0] = rVar(r1)+rVar(r2);
950 tmpR.order[0] = ringorder_aa;
951 tmpR.wvhdl[0]=(int*)omAlloc0((rVar(r1)+rVar(r2) + 1)*sizeof(int));
952 for(int i=0;i<rVar(r1);i++) tmpR.wvhdl[0][i]=1;
953 // ----
954 tmpR.block0[1] = 1;
955 tmpR.block1[1] = rVar(r1)+rVar(r2);
956 tmpR.order[1] = ringorder_dp;
957 // ----
958 tmpR.order[2] = ringorder_C;
959 }
960 else if (dp_dp
961#ifdef HAVE_PLURAL
962 && !rIsPluralRing(r1) && !rIsPluralRing(r2)
963#endif
964 )
965 {
966 tmpR.order=(rRingOrder_t*)omAlloc(4*sizeof(rRingOrder_t));
967 tmpR.block0=(int*)omAlloc0(4*sizeof(int));
968 tmpR.block1=(int*)omAlloc0(4*sizeof(int));
969 tmpR.wvhdl=(int**)omAlloc0(4*sizeof(int *));
970 tmpR.order[0]=ringorder_dp;
971 tmpR.block0[0]=1;
972 tmpR.block1[0]=rVar(r1);
973 if (r2->OrdSgn==1)
974 {
975 if ((r2->block0[0]==1)
976 && (r2->block1[0]==rVar(r2))
977 && ((r2->order[0]==ringorder_wp)
978 || (r2->order[0]==ringorder_Wp)
979 || (r2->order[0]==ringorder_Dp))
980 )
981 {
982 tmpR.order[1]=r2->order[0];
983 if (r2->wvhdl[0]!=NULL)
984 tmpR.wvhdl[1]=(int *)omMemDup(r2->wvhdl[0]);
985 }
986 else
987 tmpR.order[1]=ringorder_dp;
988 }
989 else
990 {
991 tmpR.order[1]=ringorder_ds;
992 tmpR.OrdSgn=-1;
993 }
994 tmpR.block0[1]=rVar(r1)+1;
995 tmpR.block1[1]=rVar(r1)+rVar(r2);
996 tmpR.order[2]=ringorder_C;
997 tmpR.order[3]=(rRingOrder_t)0;
998 }
999 else
1000 {
1001 if ((r1->order[0]==ringorder_unspec)
1002 && (r2->order[0]==ringorder_unspec))
1003 {
1004 tmpR.order=(rRingOrder_t*)omAlloc(3*sizeof(rRingOrder_t));
1005 tmpR.block0=(int*)omAlloc(3*sizeof(int));
1006 tmpR.block1=(int*)omAlloc(3*sizeof(int));
1007 tmpR.wvhdl=(int**)omAlloc0(3*sizeof(int *));
1008 tmpR.order[0]=ringorder_unspec;
1009 tmpR.order[1]=ringorder_C;
1010 tmpR.order[2]=(rRingOrder_t)0;
1011 tmpR.block0[0]=1;
1012 tmpR.block1[0]=tmpR.N;
1013 }
1014 else if (l==k) /* r3=r1+r2 */
1015 {
1016 int b;
1017 ring rb;
1018 if (r1->order[0]==ringorder_unspec)
1019 {
1020 /* extend order of r2 to r3 */
1021 b=rBlocks(r2);
1022 rb=r2;
1023 tmpR.OrdSgn=r2->OrdSgn;
1024 }
1025 else if (r2->order[0]==ringorder_unspec)
1026 {
1027 /* extend order of r1 to r3 */
1028 b=rBlocks(r1);
1029 rb=r1;
1030 tmpR.OrdSgn=r1->OrdSgn;
1031 }
1032 else
1033 {
1034 b=rBlocks(r1)+rBlocks(r2)-2; /* for only one order C, only one 0 */
1035 rb=NULL;
1036 }
1037 tmpR.order=(rRingOrder_t*)omAlloc0(b*sizeof(rRingOrder_t));
1038 tmpR.block0=(int*)omAlloc0(b*sizeof(int));
1039 tmpR.block1=(int*)omAlloc0(b*sizeof(int));
1040 tmpR.wvhdl=(int**)omAlloc0(b*sizeof(int *));
1041 /* weights not implemented yet ...*/
1042 if (rb!=NULL)
1043 {
1044 for (i=0;i<b;i++)
1045 {
1046 tmpR.order[i]=rb->order[i];
1047 tmpR.block0[i]=rb->block0[i];
1048 tmpR.block1[i]=rb->block1[i];
1049 if (rb->wvhdl[i]!=NULL)
1050 WarnS("rSum: weights not implemented");
1051 }
1052 tmpR.block0[0]=1;
1053 }
1054 else /* ring sum for complete rings */
1055 {
1056 for (i=0;r1->order[i]!=0;i++)
1057 {
1058 tmpR.order[i]=r1->order[i];
1059 tmpR.block0[i]=r1->block0[i];
1060 tmpR.block1[i]=r1->block1[i];
1061 if (r1->wvhdl[i]!=NULL)
1062 tmpR.wvhdl[i] = (int*) omMemDup(r1->wvhdl[i]);
1063 }
1064 j=i;
1065 i--;
1066 if ((r1->order[i]==ringorder_c)
1067 ||(r1->order[i]==ringorder_C))
1068 {
1069 j--;
1070 tmpR.order[b-2]=r1->order[i];
1071 }
1072 for (i=0;r2->order[i]!=0;i++)
1073 {
1074 if ((r2->order[i]!=ringorder_c)
1075 &&(r2->order[i]!=ringorder_C))
1076 {
1077 tmpR.order[j]=r2->order[i];
1078 tmpR.block0[j]=r2->block0[i]+rVar(r1);
1079 tmpR.block1[j]=r2->block1[i]+rVar(r1);
1080 if (r2->wvhdl[i]!=NULL)
1081 {
1082 tmpR.wvhdl[j] = (int*) omMemDup(r2->wvhdl[i]);
1083 }
1084 j++;
1085 }
1086 }
1087 if((r1->OrdSgn==-1)||(r2->OrdSgn==-1))
1088 tmpR.OrdSgn=-1;
1089 }
1090 }
1091 else if ((k==rVar(r1)) && (k==rVar(r2))) /* r1 and r2 are "quite"
1092 the same ring */
1093 /* copy r1, because we have the variables from r1 */
1094 {
1095 int b=rBlocks(r1);
1096
1097 tmpR.order=(rRingOrder_t*)omAlloc0(b*sizeof(rRingOrder_t));
1098 tmpR.block0=(int*)omAlloc0(b*sizeof(int));
1099 tmpR.block1=(int*)omAlloc0(b*sizeof(int));
1100 tmpR.wvhdl=(int**)omAlloc0(b*sizeof(int *));
1101 /* weights not implemented yet ...*/
1102 for (i=0;i<b;i++)
1103 {
1104 tmpR.order[i]=r1->order[i];
1105 tmpR.block0[i]=r1->block0[i];
1106 tmpR.block1[i]=r1->block1[i];
1107 if (r1->wvhdl[i]!=NULL)
1108 {
1109 tmpR.wvhdl[i] = (int*) omMemDup(r1->wvhdl[i]);
1110 }
1111 }
1112 tmpR.OrdSgn=r1->OrdSgn;
1113 }
1114 else
1115 {
1116 for(i=0;i<k;i++) omFree((ADDRESS)tmpR.names[i]);
1117 omFreeSize((ADDRESS)names,tmpR.N*sizeof(char *));
1118 Werror("variables must not overlap (# of vars: %d,%d -> %d)",rVar(r1),rVar(r2),k);
1119 return -1;
1120 }
1121 }
1122 tmpR.bitmask=si_max(r1->bitmask,r2->bitmask);
1123 sum=(ring)omAllocBin(sip_sring_bin);
1124 memcpy(sum,&tmpR,sizeof(ip_sring));
1125 rComplete(sum);
1126
1127//#ifdef RDEBUG
1128// rDebugPrint(sum);
1129//#endif
1130
1131
1132
1133#ifdef HAVE_PLURAL
1134 if(1)
1135 {
1136// ring old_ring = currRing;
1137
1138 BOOLEAN R1_is_nc = rIsPluralRing(r1);
1139 BOOLEAN R2_is_nc = rIsPluralRing(r2);
1140
1141 if ( (R1_is_nc) || (R2_is_nc))
1142 {
1143 ring R1 = nc_rCreateNCcomm_rCopy(r1);
1144 assume( rIsPluralRing(R1) );
1145
1146#if 0
1147#ifdef RDEBUG
1148 rWrite(R1);
1149 rDebugPrint(R1);
1150#endif
1151#endif
1152 ring R2 = nc_rCreateNCcomm_rCopy(r2);
1153#if 0
1154#ifdef RDEBUG
1155 rWrite(R2);
1156 rDebugPrint(R2);
1157#endif
1158#endif
1159
1160// rChangeCurrRing(sum); // ?
1161
1162 // Projections from R_i into Sum:
1163 /* multiplication matrices business: */
1164 /* find permutations of vars and pars */
1165 int *perm1 = (int *)omAlloc0((rVar(R1)+1)*sizeof(int));
1166 int *par_perm1 = NULL;
1167 if (rPar(R1)!=0) par_perm1=(int *)omAlloc0((rPar(R1)+1)*sizeof(int));
1168
1169 int *perm2 = (int *)omAlloc0((rVar(R2)+1)*sizeof(int));
1170 int *par_perm2 = NULL;
1171 if (rPar(R2)!=0) par_perm2=(int *)omAlloc0((rPar(R2)+1)*sizeof(int));
1172
1173 maFindPerm(R1->names, rVar(R1), rParameter(R1), rPar(R1),
1174 sum->names, rVar(sum), rParameter(sum), rPar(sum),
1175 perm1, par_perm1, sum->cf->type);
1176
1177 maFindPerm(R2->names, rVar(R2), rParameter(R2), rPar(R2),
1178 sum->names, rVar(sum), rParameter(sum), rPar(sum),
1179 perm2, par_perm2, sum->cf->type);
1180
1181
1182 matrix C1 = R1->GetNC()->C, C2 = R2->GetNC()->C;
1183 matrix D1 = R1->GetNC()->D, D2 = R2->GetNC()->D;
1184
1185 // !!!! BUG? C1 and C2 might live in different baserings!!!
1186
1187 int l = rVar(R1) + rVar(R2);
1188
1189 matrix C = mpNew(l,l);
1190 matrix D = mpNew(l,l);
1191
1192 for (i = 1; i <= rVar(R1); i++)
1193 for (j= rVar(R1)+1; j <= l; j++)
1194 MATELEM(C,i,j) = p_One(sum); // in 'sum'
1195
1196 id_Test((ideal)C, sum);
1197
1198 nMapFunc nMap1 = n_SetMap(R1->cf,sum->cf); /* can change something global: not usable
1199 after the next nSetMap call :( */
1200 // Create blocked C and D matrices:
1201 for (i=1; i<= rVar(R1); i++)
1202 for (j=i+1; j<=rVar(R1); j++)
1203 {
1204 assume(MATELEM(C1,i,j) != NULL);
1205 MATELEM(C,i,j) = p_PermPoly(MATELEM(C1,i,j), perm1, R1, sum, nMap1, par_perm1, rPar(R1)); // need ADD + CMP ops.
1206
1207 if (MATELEM(D1,i,j) != NULL)
1208 MATELEM(D,i,j) = p_PermPoly(MATELEM(D1,i,j), perm1, R1, sum, nMap1, par_perm1, rPar(R1));
1209 }
1210
1211 id_Test((ideal)C, sum);
1212 id_Test((ideal)D, sum);
1213
1214
1215 nMapFunc nMap2 = n_SetMap(R2->cf,sum->cf); /* can change something global: not usable
1216 after the next nSetMap call :( */
1217 for (i=1; i<= rVar(R2); i++)
1218 for (j=i+1; j<=rVar(R2); j++)
1219 {
1220 assume(MATELEM(C2,i,j) != NULL);
1221 MATELEM(C,rVar(R1)+i,rVar(R1)+j) = p_PermPoly(MATELEM(C2,i,j),perm2,R2,sum, nMap2,par_perm2,rPar(R2));
1222
1223 if (MATELEM(D2,i,j) != NULL)
1224 MATELEM(D,rVar(R1)+i,rVar(R1)+j) = p_PermPoly(MATELEM(D2,i,j),perm2,R2,sum, nMap2,par_perm2,rPar(R2));
1225 }
1226
1227 id_Test((ideal)C, sum);
1228 id_Test((ideal)D, sum);
1229
1230 // Now sum is non-commutative with blocked structure constants!
1231 if (nc_CallPlural(C, D, NULL, NULL, sum, false, false, true, sum))
1232 WarnS("Error initializing non-commutative multiplication!");
1233
1234 /* delete R1, R2*/
1235
1236#if 0
1237#ifdef RDEBUG
1238 rWrite(sum);
1239 rDebugPrint(sum);
1240
1241 Print("\nRefs: R1: %d, R2: %d\n", R1->GetNC()->ref, R2->GetNC()->ref);
1242
1243#endif
1244#endif
1245
1246
1247 rDelete(R1);
1248 rDelete(R2);
1249
1250 /* delete perm arrays */
1251 if (perm1!=NULL) omFree((ADDRESS)perm1);
1252 if (perm2!=NULL) omFree((ADDRESS)perm2);
1253 if (par_perm1!=NULL) omFree((ADDRESS)par_perm1);
1254 if (par_perm2!=NULL) omFree((ADDRESS)par_perm2);
1255
1256// rChangeCurrRing(old_ring);
1257 }
1258
1259 }
1260#endif
1261
1262 ideal Q=NULL;
1263 ideal Q1=NULL, Q2=NULL;
1264 if (r1->qideal!=NULL)
1265 {
1266// rChangeCurrRing(sum);
1267// if (r2->qideal!=NULL)
1268// {
1269// WerrorS("todo: qring+qring");
1270// return -1;
1271// }
1272// else
1273// {}
1274 /* these were defined in the Plural Part above... */
1275 int *perm1 = (int *)omAlloc0((rVar(r1)+1)*sizeof(int));
1276 int *par_perm1 = NULL;
1277 if (rPar(r1)!=0) par_perm1=(int *)omAlloc0((rPar(r1)+1)*sizeof(int));
1278 maFindPerm(r1->names, rVar(r1), rParameter(r1), rPar(r1),
1279 sum->names, rVar(sum), rParameter(sum), rPar(sum),
1280 perm1, par_perm1, sum->cf->type);
1281 nMapFunc nMap1 = n_SetMap(r1->cf,sum->cf);
1282 Q1 = idInit(IDELEMS(r1->qideal),1);
1283
1284 for (int for_i=0;for_i<IDELEMS(r1->qideal);for_i++)
1285 Q1->m[for_i] = p_PermPoly(
1286 r1->qideal->m[for_i], perm1,
1287 r1, sum,
1288 nMap1,
1289 par_perm1, rPar(r1));
1290
1291 omFree((ADDRESS)perm1);
1292 }
1293
1294 if (r2->qideal!=NULL)
1295 {
1296 //if (currRing!=sum)
1297 // rChangeCurrRing(sum);
1298 int *perm2 = (int *)omAlloc0((rVar(r2)+1)*sizeof(int));
1299 int *par_perm2 = NULL;
1300 if (rPar(r2)!=0) par_perm2=(int *)omAlloc0((rPar(r2)+1)*sizeof(int));
1301 maFindPerm(r2->names, rVar(r2), rParameter(r2), rPar(r2),
1302 sum->names, rVar(sum), rParameter(sum), rPar(sum),
1303 perm2, par_perm2, sum->cf->type);
1304 nMapFunc nMap2 = n_SetMap(r2->cf,sum->cf);
1305 Q2 = idInit(IDELEMS(r2->qideal),1);
1306
1307 for (int for_i=0;for_i<IDELEMS(r2->qideal);for_i++)
1308 Q2->m[for_i] = p_PermPoly(
1309 r2->qideal->m[for_i], perm2,
1310 r2, sum,
1311 nMap2,
1312 par_perm2, rPar(r2));
1313
1314 omFree((ADDRESS)perm2);
1315 }
1316 if (Q1!=NULL)
1317 {
1318 if ( Q2!=NULL)
1319 Q = id_SimpleAdd(Q1,Q2,sum);
1320 else
1321 Q=id_Copy(Q1,sum);
1322 }
1323 else
1324 {
1325 if ( Q2!=NULL)
1326 Q = id_Copy(Q2,sum);
1327 else
1328 Q=NULL;
1329 }
1330 sum->qideal = Q;
1331
1332#ifdef HAVE_PLURAL
1333 if( rIsPluralRing(sum) )
1334 nc_SetupQuotient( sum );
1335#endif
1336 return 1;
1337}
static int si_max(const int a, const int b)
Definition: auxiliary.h:124
@ n_R
single prescision (6,6) real numbers
Definition: coeffs.h:31
@ n_Znm
only used if HAVE_RINGS is defined
Definition: coeffs.h:45
@ n_Zn
only used if HAVE_RINGS is defined
Definition: coeffs.h:44
STATIC_VAR jList * Q
Definition: janet.cc:30
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:163
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
poly p_One(const ring r)
Definition: p_polys.cc:1309
int rChar(ring r)
Definition: ring.cc:711
ring nc_rCreateNCcomm_rCopy(ring r)
Definition: ring.cc:717
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
ideal id_SimpleAdd(ideal h1, ideal h2, const ring R)
concat the lists h1 and h2 without zeros
Definition: ring.h:248
n_Procs_s * cf
Definition: ring.h:368
int * block0
Definition: ring.h:254
short N
Definition: ring.h:303
int * block1
Definition: ring.h:255
rRingOrder_t * order
Definition: ring.h:253
int ** wvhdl
Definition: ring.h:257
unsigned long bitmask
Definition: ring.h:350
char ** names
Definition: ring.h:258
short OrdSgn
Definition: ring.h:305

◆ rTypeOfMatrixOrder()

int rTypeOfMatrixOrder ( const intvec order)

Definition at line 185 of file ring.cc.

186{
187 int i=0,j,typ=1;
188 int sz = (int)sqrt((double)(order->length()-2));
189 if ((sz*sz)!=(order->length()-2))
190 {
191 WerrorS("Matrix order is not a square matrix");
192 typ=0;
193 }
194 while ((i<sz) && (typ==1))
195 {
196 j=0;
197 while ((j<sz) && ((*order)[j*sz+i+2]==0)) j++;
198 if (j>=sz)
199 {
200 typ = 0;
201 WerrorS("Matrix order not complete");
202 }
203 else if ((*order)[j*sz+i+2]<0)
204 typ = -1;
205 else
206 i++;
207 }
208 return typ;
209}
gmp_float sqrt(const gmp_float &a)
Definition: mpr_complex.cc:327

◆ rUnComplete()

void rUnComplete ( ring  r)

Definition at line 3910 of file ring.cc.

3911{
3912 if (r == NULL) return;
3913 if (r->VarOffset != NULL)
3914 {
3915 if (r->OrdSize!=0 && r->typ != NULL)
3916 {
3917 for(int i = 0; i < r->OrdSize; i++)
3918 if( r->typ[i].ord_typ == ro_is) // Search for suffixes! (prefix have the same VarOffset)
3919 {
3920 id_Delete(&r->typ[i].data.is.F, r);
3921
3922 if( r->typ[i].data.is.pVarOffset != NULL )
3923 {
3924 omFreeSize((ADDRESS)r->typ[i].data.is.pVarOffset, (r->N +1)*sizeof(int));
3925 }
3926 }
3927 else if (r->typ[i].ord_typ == ro_syz)
3928 {
3929 if(r->typ[i].data.syz.limit > 0)
3930 omFreeSize(r->typ[i].data.syz.syz_index, ((r->typ[i].data.syz.limit) +1)*sizeof(int));
3931 }
3932 else if (r->typ[i].ord_typ == ro_syzcomp)
3933 {
3934 assume( r->typ[i].data.syzcomp.ShiftedComponents == NULL );
3935 assume( r->typ[i].data.syzcomp.Components == NULL );
3936// WarnS( "rUnComplete : ord_typ == ro_syzcomp was unhandled!!! Possibly memory leak!!!" );
3937#ifndef SING_NDEBUG
3938// assume(0);
3939#endif
3940 }
3941
3942 omFreeSize((ADDRESS)r->typ,r->OrdSize*sizeof(sro_ord)); r->typ = NULL;
3943 }
3944
3945 if (r->PolyBin != NULL)
3946 omUnGetSpecBin(&(r->PolyBin));
3947
3948 omFreeSize((ADDRESS)r->VarOffset, (r->N +1)*sizeof(int));
3949 r->VarOffset=NULL;
3950
3951 if (r->ordsgn != NULL && r->CmpL_Size != 0)
3952 {
3953 omFreeSize((ADDRESS)r->ordsgn,r->ExpL_Size*sizeof(long));
3954 r->ordsgn=NULL;
3955 }
3956 if (r->p_Procs != NULL)
3957 {
3958 omFreeSize(r->p_Procs, sizeof(p_Procs_s));
3959 r->p_Procs=NULL;
3960 }
3961 omfreeSize(r->VarL_Offset, r->VarL_Size*sizeof(int));
3962 r->VarL_Offset=NULL;
3963 }
3964 if (r->NegWeightL_Offset!=NULL)
3965 {
3966 omFreeSize(r->NegWeightL_Offset, r->NegWeightL_Size*sizeof(int));
3967 r->NegWeightL_Offset=NULL;
3968 }
3969}
#define omfreeSize(addr, size)
Definition: omAllocDecl.h:236
#define omUnGetSpecBin(bin_ptr)
Definition: omBin.h:14

◆ rVar()

static short rVar ( const ring  r)
inlinestatic

#define rVar(r) (r->N)

Definition at line 593 of file ring.h.

594{
595 assume(r != NULL);
596 return r->N;
597}

◆ rVarStr()

char * rVarStr ( ring  r)

Definition at line 621 of file ring.cc.

622{
623 if ((r==NULL)||(r->names==NULL)) return omStrDup("");
624 int i;
625 int l=2;
626 char *s;
627
628 for (i=0; i<r->N; i++)
629 {
630 l+=strlen(r->names[i])+1;
631 }
632 s=(char *)omAlloc((long)l);
633 s[0]='\0';
634 for (i=0; i<r->N-1; i++)
635 {
636 strcat(s,r->names[i]);
637 strcat(s,",");
638 }
639 strcat(s,r->names[i]);
640 return s;
641}

◆ rWrite()

void rWrite ( ring  r,
BOOLEAN  details = FALSE 
)

Definition at line 226 of file ring.cc.

227{
228 if ((r==NULL)||(r->order==NULL))
229 return; /*to avoid printing after errors....*/
230
231 assume(r != NULL);
232 const coeffs C = r->cf;
233 assume(C != NULL);
234
235 int nblocks=rBlocks(r);
236
237 // omCheckAddrSize(r,sizeof(ip_sring));
238 omCheckAddrSize(r->order,nblocks*sizeof(int));
239 omCheckAddrSize(r->block0,nblocks*sizeof(int));
240 omCheckAddrSize(r->block1,nblocks*sizeof(int));
241 omCheckAddrSize(r->wvhdl,nblocks*sizeof(int *));
242 omCheckAddrSize(r->names,r->N*sizeof(char *));
243
244 nblocks--;
245
246
247 //Print("ref:%d, C->ref:%d\n",r->ref,C->ref);
248 PrintS("// coefficients: ");
249 if( nCoeff_is_algExt(C) )
250 {
251 // NOTE: the following (non-thread-safe!) UGLYNESS
252 // (changing naRing->ShortOut for a while) is due to Hans!
253 // Just think of other ring using the VERY SAME naRing and possible
254 // side-effects...
255 ring R = C->extRing;
256 const BOOLEAN bSaveShortOut = rShortOut(R); R->ShortOut = rShortOut(r) & rCanShortOut(R);
257
258 n_CoeffWrite(C, details); // for correct printing of minpoly... WHAT AN UGLYNESS!!!
259
260 R->ShortOut = bSaveShortOut;
261 }
262 else
263 n_CoeffWrite(C, details);
264 PrintLn();
265// {
266// PrintS("// characteristic : ");
267//
268// char const * const * const params = rParameter(r);
269//
270// if (params!=NULL)
271// {
272// Print ("// %d parameter : ",rPar(r));
273//
274// char const * const * sp= params;
275// int nop=0;
276// while (nop<rPar(r))
277// {
278// PrintS(*sp);
279// PrintS(" ");
280// sp++; nop++;
281// }
282// PrintS("\n// minpoly : ");
283// if ( rField_is_long_C(r) )
284// {
285// // i^2+1:
286// Print("(%s^2+1)\n", params[0]);
287// }
288// else if (rMinpolyIsNULL(r))
289// {
290// PrintS("0\n");
291// }
292// else
293// {
294// StringSetS(""); n_Write(r->cf->minpoly, r); PrintS(StringEndS("\n")); // NOTE/TODO: use StringAppendS("\n"); omFree(s);
295// }
296// //if (r->qideal!=NULL)
297// //{
298// // iiWriteMatrix((matrix)r->qideal,"// minpolys",1,r,0);
299// // PrintLn();
300// //}
301// }
302// }
303 Print("// number of vars : %d",r->N);
304
305 //for (nblocks=0; r->order[nblocks]; nblocks++);
306 nblocks=rBlocks(r)-1;
307
308 for (int l=0, nlen=0 ; l<nblocks; l++)
309 {
310 int i;
311 Print("\n// block %3d : ",l+1);
312
313 Print("ordering %s", rSimpleOrdStr(r->order[l]));
314
315
316 if (r->order[l] == ringorder_IS)
317 {
318 assume( r->block0[l] == r->block1[l] );
319 const int s = r->block0[l];
320 assume( (-2 < s) && (s < 2) );
321 Print("(%d)", s); // 0 => prefix! +/-1 => suffix!
322 continue;
323 }
324 else if (r->order[l]==ringorder_s)
325 {
326 assume( l == 0 );
327 Print(" syz_comp: %d",r->block0[l]);
328 continue;
329 }
330 else if (
331 ( (r->order[l] >= ringorder_lp)
332 ||(r->order[l] == ringorder_M)
333 ||(r->order[l] == ringorder_a)
334 ||(r->order[l] == ringorder_am)
335 ||(r->order[l] == ringorder_a64)
336 ||(r->order[l] == ringorder_aa) ) && (r->order[l] < ringorder_IS) )
337 {
338 PrintS("\n// : names ");
339 for (i = r->block0[l]-1; i<r->block1[l]; i++)
340 {
341 nlen = strlen(r->names[i]);
342 Print(" %s",r->names[i]);
343 }
344 }
345
346 if (r->wvhdl[l]!=NULL)
347 {
348 #ifndef SING_NDEBUG
349 if((r->order[l] != ringorder_wp)
350 &&(r->order[l] != ringorder_Wp)
351 &&(r->order[l] != ringorder_ws)
352 &&(r->order[l] != ringorder_Ws)
353 &&(r->order[l] != ringorder_a)
354 &&(r->order[l] != ringorder_am)
355 &&(r->order[l] != ringorder_M))
356 {
357 Warn("should not have wvhdl entry at pos. %d",l);
358 }
359 #endif
360 for (int j= 0;
361 j<(r->block1[l]-r->block0[l]+1)*(r->block1[l]-r->block0[l]+1);
362 j+=i)
363 {
364 PrintS("\n// : weights ");
365 for (i = 0; i<=r->block1[l]-r->block0[l]; i++)
366 {
367 if (r->order[l] == ringorder_a64)
368 {
369 int64 *w=(int64 *)r->wvhdl[l];
370 #if SIZEOF_LONG == 4
371 Print("%*lld " ,nlen,w[i+j]);
372 #else
373 Print(" %*ld" ,nlen,w[i+j]);
374 #endif
375 }
376 else
377 Print(" %*d" ,nlen,r->wvhdl[l][i+j]);
378 }
379 if (r->order[l]!=ringorder_M) break;
380 }
381 if (r->order[l]==ringorder_am)
382 {
383 int m=r->wvhdl[l][i];
384 Print("\n// : %d module weights ",m);
385 m+=i;i++;
386 for(;i<=m;i++) Print(" %*d" ,nlen,r->wvhdl[l][i]);
387 }
388 }
389 }
390#ifdef HAVE_PLURAL
391 if(rIsPluralRing(r))
392 {
393 PrintS("\n// noncommutative relations:");
394 if( details )
395 {
396 poly pl=NULL;
397 int nl;
398 int i,j;
399 for (i = 1; i<r->N; i++)
400 {
401 for (j = i+1; j<=r->N; j++)
402 {
403 nl = n_IsOne(p_GetCoeff(MATELEM(r->GetNC()->C,i,j),r), r->cf);
404 if ( (MATELEM(r->GetNC()->D,i,j)!=NULL) || (!nl) )
405 {
406 Print("\n// %s%s=",r->names[j-1],r->names[i-1]);
407 pl = MATELEM(r->GetNC()->MT[UPMATELEM(i,j,r->N)],1,1);
408 p_Write0(pl, r, r);
409 }
410 }
411 }
412 } else
413 PrintS(" ...");
414
415#if MYTEST /*Singularg should not differ from Singular except in error case*/
416 Print("\n// noncommutative type:%d", (int)ncRingType(r));
417 Print("\n// is skew constant:%d",r->GetNC()->IsSkewConstant);
418 if( rIsSCA(r) )
419 {
420 Print("\n// alternating variables: [%d, %d]", scaFirstAltVar(r), scaLastAltVar(r));
421 const ideal Q = SCAQuotient(r); // resides within r!
422 PrintS("\n// quotient of sca by ideal");
423
424 if (Q!=NULL)
425 {
426 iiWriteMatrix((matrix)Q,"scaQ",1,r,0);
427 }
428 else
429 PrintS(" (NULL)");
430 }
431#endif
432 }
433 if (rIsLPRing(r))
434 {
435 Print("\n// letterplace ring (block size %d, ncgen count %d)",r->isLPring, r->LPncGenCount);
436 }
437#endif
438 if (r->qideal!=NULL)
439 {
440 PrintS("\n// quotient ring from ideal");
441 if( details )
442 {
443 PrintLn();
444 iiWriteMatrix((matrix)r->qideal,"_",1,r,0);
445 } else PrintS(" ...");
446 }
447}
static FORCE_INLINE void n_CoeffWrite(const coeffs r, BOOLEAN details=TRUE)
output the coeff description
Definition: coeffs.h:719
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:468
#define UPMATELEM(i, j, nVar)
Definition: nc.h:36
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition: matpol.cc:834
#define p_GetCoeff(p, r)
Definition: monomials.h:50
void p_Write0(poly p, ring lmRing, ring tailRing)
Definition: polys0.cc:332
static BOOLEAN rShortOut(const ring r)
Definition: ring.h:582
static BOOLEAN rCanShortOut(const ring r)
Definition: ring.h:587
ideal SCAQuotient(const ring r)
Definition: sca.h:10

Variable Documentation

◆ sip_sring_bin

EXTERN_VAR omBin sip_sring_bin

Definition at line 834 of file ring.h.