My Project
Loading...
Searching...
No Matches
ring.h File Reference
#include "misc/auxiliary.h"
#include "coeffs/coeffs.h"
#include "misc/intvec.h"
#include "misc/int64vec.h"
#include "coeffs/bigintmat.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 ringorder_rp   ringorder_ip
 
#define ringorder_rs   ringorder_is
 
#define rField_is_Ring(R)
 
#define rTest(r)
 

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
 
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 bigintmat *, 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_ip , ringorder_Dp ,
  ringorder_wp , ringorder_Wp , ringorder_Ip , ringorder_ls ,
  ringorder_ds , ringorder_Ds , ringorder_ws , ringorder_Ws ,
  ringorder_am , ringorder_L , ringorder_aa , ringorder_is ,
  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!
 
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.
 
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
 
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
 
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
 
void rUnComplete (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.
 
static n_coeffType rFieldType (const ring r)
 the type of the coefficient filed of r (n_Zp, n_Q, etc)
 
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
 
void p_SetGlobals (const ring r, BOOLEAN complete=TRUE)
 set all properties of a new ring - also called by rComplete
 
static int rBlocks (const 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)
 
static int rPar (const ring r)
 (r->cf->P)
 
static char const ** rParameter (const ring r)
 (r->cf->parameter)
 
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!
 
int n_IsParam (number m, const ring r)
 if m == var(i)/1 => return i,
 
static int rInternalChar (const ring r)
 
static BOOLEAN rMinpolyIsNULL (const ring r)
 Tests whether '(r->cf->minpoly) == NULL'.
 
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_Dp_C (const ring r)
 
ring rAssure_Wp_C (const ring r, intvec *w)
 
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
 
ring rAssure_SyzComp_CompLastBlock (const ring r)
 makes sure that c/C ordering is last ordering and SyzIndex is first
 
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
 
BOOLEAN rHasSimpleOrder (const ring r)
 
BOOLEAN rHas_c_Ordering (const ring r)
 
BOOLEAN rHasBlockOrder (const ring r)
 
BOOLEAN rHasSimpleLexOrder (const ring r)
 returns TRUE, if simple lp or ls ordering
 
static BOOLEAN rHasGlobalOrdering (const ring r)
 
static BOOLEAN rHasLocalOrMixedOrdering (const ring r)
 
static BOOLEAN rHasMixedOrdering (const ring r)
 
BOOLEAN rOrd_is_Totaldegree_Ordering (const ring r)
 
BOOLEAN rOrd_is_dp (const ring r)
 
BOOLEAN rOrd_is_ds (const ring r)
 
BOOLEAN rOrd_is_Ds (const ring r)
 
BOOLEAN rOrd_SetCompRequiresSetm (const ring r)
 return TRUE if p_SetComp requires p_Setm
 
rOrderType_t rGetOrderType (ring r)
 
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
 
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 alright!
 
int rGetISPos (const int p, const ring r)
 return the position of the p^th IS block order block in r->typ[]...
 
BOOLEAN rCheckIV (const intvec *iv)
 
int rTypeOfMatrixOrder (const intvec *order)
 
void rDelete (ring r)
 unconditionally deletes fields in r
 
ring rPlusVar (const ring r, char *v, int left)
 K[x],"y" -> K[x,y] resp. K[y,x].
 
ring rMinusVar (const ring r, char *v)
 undo rPlusVar
 
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 119 of file ring.h.

Data Fields
short end
short place
short start

◆ sro_wp

struct sro_wp

Definition at line 128 of file ring.h.

Data Fields
short end
short place
short start
int * weights

◆ sro_am

struct sro_am

Definition at line 138 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 153 of file ring.h.

Data Fields
short end
short place
short start
int64 * weights64

◆ sro_cp

struct sro_cp

Definition at line 163 of file ring.h.

Data Fields
short end
short place
short start

◆ sro_syzcomp

struct sro_syzcomp

Definition at line 172 of file ring.h.

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

◆ sro_syz

struct sro_syz

Definition at line 184 of file ring.h.

Data Fields
int curr_index
int limit
short place
int * syz_index

◆ sro_ISTemp

struct sro_ISTemp

Definition at line 200 of file ring.h.

Data Fields
int * pVarOffset
short start
int suffixpos

◆ sro_IS

struct sro_IS

Definition at line 210 of file ring.h.

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

◆ sro_ord

struct sro_ord

Definition at line 224 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 228 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)
Value:
CanonicalForm cf
Definition cfModGcd.cc:4091
static FORCE_INLINE BOOLEAN nCoeff_is_Ring(const coeffs r)
Definition coeffs.h:730
#define R
Definition sirandom.c:27

Definition at line 491 of file ring.h.

◆ ringorder_rp

#define ringorder_rp   ringorder_ip

Definition at line 100 of file ring.h.

◆ ringorder_rs

#define ringorder_rs   ringorder_is

Definition at line 101 of file ring.h.

◆ rTest

#define rTest ( r)
Value:
rDBTest(r, __FILE__, __LINE__)
BOOLEAN rDBTest(ring r, const char *fn, const int l)
Definition ring.cc:2097

Definition at line 794 of file ring.h.

Typedef Documentation

◆ BBA_Proc

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

Definition at line 250 of file ring.h.

◆ idhdl

typedef idrec* idhdl

Definition at line 22 of file ring.h.

◆ kBucket_pt

typedef kBucket* kBucket_pt

Definition at line 26 of file ring.h.

◆ kStrategy

Definition at line 247 of file ring.h.

◆ NF_Proc

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

Definition at line 249 of file ring.h.

◆ p_Procs_s

typedef struct p_Procs_s p_Procs_s

Definition at line 24 of file ring.h.

◆ p_SetmProc

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

Definition at line 40 of file ring.h.

◆ pFDegProc

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

Definition at line 39 of file ring.h.

◆ pLDegProc

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

Definition at line 38 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 45 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 51 of file ring.h.

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

◆ 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 103 of file ring.h.

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

◆ 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_ip 
ringorder_Dp 
ringorder_wp 
ringorder_Wp 
ringorder_Ip 
ringorder_ls 

degree, ip

ringorder_ds 
ringorder_Ds 
ringorder_ws 
ringorder_Ws 
ringorder_am 
ringorder_L 
ringorder_aa 

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

ringorder_is 

opposite of ls

ringorder_IS 

Induced (Schreyer) ordering.

ringorder_unspec 

Definition at line 68 of file ring.h.

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

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

5922{
5923 assume(r != NULL);
5924 const coeffs C = r->cf;
5925 assume(C != NULL);
5926
5928
5929 const n_coeffType _filed_type = getCoeffType(C);
5930
5931 if(( _filed_type == n_algExt )||( _filed_type == n_polyExt ))
5932 return naIsParam(m, C);
5933
5934 if( _filed_type == n_transExt )
5935 return ntIsParam(m, C);
5936
5937 Werror("n_IsParam: IsParam is not to be used for (coeff_type = %d)",getCoeffType(C));
5938
5939 return 0;
5940}
int naIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
Definition algext.cc:1104
int m
Definition cfEzgcd.cc:128
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition coeffs.h:839
n_coeffType
Definition coeffs.h:27
@ n_polyExt
used to represent polys as coefficients
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:429
#define assume(x)
Definition mod2.h:389
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:2308

◆ 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 658 of file ring.h.

659{
660 assume(r != NULL);
661 const coeffs C = r->cf;
662 assume(C != NULL);
663 return n_Param(iParameter, C);
664// const n_coeffType _filed_type = getCoeffType(C);
665//
666// if ( iParameter <= 0 || iParameter > rPar(r) )
667// // Wrong parameter
668// return NULL;
669//
670// if( _filed_type == n_algExt )
671// return naParameter(iParameter, C);
672//
673// if( _filed_type == n_transExt )
674// return ntParameter(iParameter, C);
675//
676// if (_filed_type == n_GF)// if (nCoeff_is_GF(C))
677// {
678// number nfPar (int i, const coeffs);
679// return nfPar(iParameter, C);
680// }
681//
682// if (_filed_type == n_long_C) // if (nCoeff_is_long_C(C))
683// {
684// number ngcPar(int i, const coeffs r);
685// return ngcPar(iParameter, C);
686// }
687//
688// return NULL;
689}
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:658

◆ p_DebugPrint()

void p_DebugPrint ( poly p,
const ring r )

Definition at line 4419 of file ring.cc.

4420{
4421 int i,j;
4422 p_Write(p,r);
4423 j=2;
4424 while(p!=NULL)
4425 {
4426 Print("\nexp[0..%d]\n",r->ExpL_Size-1);
4427 for(i=0;i<r->ExpL_Size;i++)
4428 Print("%ld ",p->exp[i]);
4429 PrintLn();
4430 Print("v0:%ld ",p_GetComp(p, r));
4431 for(i=1;i<=r->N;i++) Print(" v%d:%ld",i,p_GetExp(p,i, r));
4432 PrintLn();
4433 pIter(p);
4434 j--;
4435 if (j==0) { PrintS("...\n"); break; }
4436 }
4437}
int i
Definition cfEzgcd.cc:132
int p
Definition cfModGcd.cc:4086
#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:471
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 3493 of file ring.cc.

3494{
3495 r->pLexOrder=r->LexOrder;
3496 if (complete)
3497 {
3498 si_opt_1 &= ~ TEST_RINGDEP_OPTS;
3499 si_opt_1 |= r->options;
3500 }
3501}
VAR unsigned si_opt_1
Definition options.c:5

◆ r_IsRingVar()

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

Definition at line 213 of file ring.cc.

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

◆ rAssure_C_dp()

ring rAssure_C_dp ( const ring r)

Definition at line 5129 of file ring.cc.

5130{
5132}
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
Definition ring.cc:4896

◆ rAssure_c_dp()

ring rAssure_c_dp ( const ring r)

Definition at line 5134 of file ring.cc.

5135{
5137}

◆ rAssure_CompLastBlock()

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

makes sure that c/C ordering is last ordering

Definition at line 4786 of file ring.cc.

4787{
4788 int last_block = rBlocks(r) - 2;
4789 if (r->order[last_block] != ringorder_c &&
4790 r->order[last_block] != ringorder_C)
4791 {
4792 int c_pos = 0;
4793 int i;
4794
4795 for (i=0; i< last_block; i++)
4796 {
4797 if (r->order[i] == ringorder_c || r->order[i] == ringorder_C)
4798 {
4799 c_pos = i;
4800 break;
4801 }
4802 }
4803 if (c_pos != -1)
4804 {
4805 ring new_r = rCopy0(r, FALSE, TRUE);
4806 for (i=c_pos+1; i<=last_block; i++)
4807 {
4808 new_r->order[i-1] = new_r->order[i];
4809 new_r->block0[i-1] = new_r->block0[i];
4810 new_r->block1[i-1] = new_r->block1[i];
4811 new_r->wvhdl[i-1] = new_r->wvhdl[i];
4812 }
4813 new_r->order[last_block] = r->order[c_pos];
4814 new_r->block0[last_block] = r->block0[c_pos];
4815 new_r->block1[last_block] = r->block1[c_pos];
4816 new_r->wvhdl[last_block] = r->wvhdl[c_pos];
4817 if (complete)
4818 {
4819 rComplete(new_r, 1);
4820
4821#ifdef HAVE_PLURAL
4822 if (rIsPluralRing(r))
4823 {
4824 if ( nc_rComplete(r, new_r, false) ) // no qideal!
4825 {
4826#ifndef SING_NDEBUG
4827 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4828#endif
4829 }
4830 }
4831 assume(rIsPluralRing(r) == rIsPluralRing(new_r));
4832#endif
4833 }
4834 return new_r;
4835 }
4836 }
4837 return r;
4838}
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
#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:3526
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition ring.cc:5833
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1426
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
static int rBlocks(const ring r)
Definition ring.h:574

◆ rAssure_Dp_C()

ring rAssure_Dp_C ( const ring r)

Definition at line 5124 of file ring.cc.

5125{
5127}

◆ rAssure_dp_C()

ring rAssure_dp_C ( const ring r)

Definition at line 5119 of file ring.cc.

5120{
5122}

◆ rAssure_dp_S()

ring rAssure_dp_S ( const ring r)

Definition at line 5114 of file ring.cc.

5115{
5117}

◆ rAssure_HasComp()

ring rAssure_HasComp ( const ring r)

Definition at line 4717 of file ring.cc.

4718{
4719 int last_block;
4720 int i=0;
4721 do
4722 {
4723 if (r->order[i] == ringorder_c ||
4724 r->order[i] == ringorder_C) return r;
4725 if (r->order[i] == 0)
4726 break;
4727 i++;
4728 } while (1);
4729 //WarnS("re-creating ring with comps");
4730 last_block=i-1;
4731
4732 ring new_r = rCopy0(r, FALSE, FALSE);
4733 i+=2;
4734 new_r->wvhdl=(int **)omAlloc0(i * sizeof(int *));
4735 new_r->order = (rRingOrder_t *) omAlloc0(i * sizeof(rRingOrder_t));
4736 new_r->block0 = (int *) omAlloc0(i * sizeof(int));
4737 new_r->block1 = (int *) omAlloc0(i * sizeof(int));
4738 memcpy(new_r->order,r->order,(i-1) * sizeof(rRingOrder_t));
4739 memcpy(new_r->block0,r->block0,(i-1) * sizeof(int));
4740 memcpy(new_r->block1,r->block1,(i-1) * sizeof(int));
4741 for (int j=0; j<=last_block; j++)
4742 {
4743 if (r->wvhdl[j]!=NULL)
4744 {
4745 #ifdef HAVE_OMALLOC
4746 new_r->wvhdl[j] = (int*) omMemDup(r->wvhdl[j]);
4747 #else
4748 {
4749 int l=r->block1[j]-r->block0[j]+1;
4750 if (r->order[j]==ringorder_a64) l*=2;
4751 else if (r->order[j]==ringorder_M) l=l*l;
4752 else if (r->order[j]==ringorder_am)
4753 {
4754 l+=r->wvhdl[j][r->block1[j]-r->block0[j]+1]+1;
4755 }
4756 new_r->wvhdl[j]=(int*)omalloc(l*sizeof(int));
4757 memcpy(new_r->wvhdl[j],r->wvhdl[j],l*sizeof(int));
4758 }
4759 #endif
4760 }
4761 }
4762 last_block++;
4763 new_r->order[last_block]=ringorder_C;
4764 //new_r->block0[last_block]=0;
4765 //new_r->block1[last_block]=0;
4766 //new_r->wvhdl[last_block]=NULL;
4767
4768 rComplete(new_r, 1);
4769
4770#ifdef HAVE_PLURAL
4771 if (rIsPluralRing(r))
4772 {
4773 if ( nc_rComplete(r, new_r, false) ) // no qideal!
4774 {
4775#ifndef SING_NDEBUG
4776 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4777#endif
4778 }
4779 }
4780 assume(rIsPluralRing(r) == rIsPluralRing(new_r));
4781#endif
4782
4783 return new_r;
4784}
int l
Definition cfEzgcd.cc:100
#define omalloc(size)
#define omAlloc0(size)
#define omMemDup(s)

◆ rAssure_InducedSchreyerOrdering()

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

Definition at line 4989 of file ring.cc.

4990{ // TODO: ???? Add leading Syz-comp ordering here...????
4991
4992#if MYTEST
4993 Print("rAssure_InducedSchreyerOrdering(r, complete = %d, sgn = %d): r: \n", complete, sgn);
4994 rWrite(r);
4995#ifdef RDEBUG
4996 rDebugPrint(r);
4997#endif
4998 PrintLn();
4999#endif
5000 assume((sgn == 1) || (sgn == -1));
5001
5002 ring res=rCopy0(r, FALSE, FALSE); // No qideal & ordering copy.
5003
5004 int n = rBlocks(r); // Including trailing zero!
5005
5006 // Create 2 more blocks for prefix/suffix:
5007 res->order=(rRingOrder_t *)omAlloc0((n+2)*sizeof(rRingOrder_t)); // 0 .. n+1
5008 res->block0=(int *)omAlloc0((n+2)*sizeof(int));
5009 res->block1=(int *)omAlloc0((n+2)*sizeof(int));
5010 int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
5011
5012 // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
5013 // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
5014
5015 // new 1st block
5016 int j = 0;
5017 res->order[j] = ringorder_IS; // Prefix
5018 res->block0[j] = res->block1[j] = 0;
5019 // wvhdl[j] = NULL;
5020 j++;
5021
5022 for(int i = 0; (i <= n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
5023 {
5024 res->order [j] = r->order [i];
5025 res->block0[j] = r->block0[i];
5026 res->block1[j] = r->block1[i];
5027
5028 if (r->wvhdl[i] != NULL)
5029 {
5030 #ifdef HAVE_OMALLOC
5031 wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
5032 #else
5033 {
5034 int l=(r->block1[i]-r->block0[i]+1);
5035 if (r->order[i]==ringorder_a64) l*=2;
5036 else if (r->order[i]==ringorder_M) l=l*l;
5037 else if (r->order[i]==ringorder_am)
5038 {
5039 l+=r->wvhdl[i][r->block1[i]-r->block0[i]+1]+1;
5040 }
5041 wvhdl[j]=(int*)omalloc(l*sizeof(int));
5042 memcpy(wvhdl[j],r->wvhdl[i],l*sizeof(int));
5043 }
5044 #endif
5045 } // else wvhdl[j] = NULL;
5046 }
5047
5048 // new last block
5049 res->order [j] = ringorder_IS; // Suffix
5050 res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
5051 // wvhdl[j] = NULL;
5052 j++;
5053
5054 // res->order [j] = 0; // The End!
5055 res->wvhdl = wvhdl;
5056
5057 // j == the last zero block now!
5058 assume(j == (n+1));
5059 assume(res->order[0]==ringorder_IS);
5060 assume(res->order[j-1]==ringorder_IS);
5061 assume(res->order[j]==0);
5062
5063
5064 if (complete)
5065 {
5066 rComplete(res, 1);
5067
5068#ifdef HAVE_PLURAL
5069 if (rIsPluralRing(r))
5070 {
5071 if ( nc_rComplete(r, res, false) ) // no qideal!
5072 {
5073#ifndef SING_NDEBUG
5074 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
5075#endif
5076 }
5077 }
5079#endif
5080
5081
5082#ifdef HAVE_PLURAL
5083 ring old_ring = r;
5084#endif
5085
5086 if (r->qideal!=NULL)
5087 {
5088 res->qideal= idrCopyR_NoSort(r->qideal, r, res);
5089
5090 assume(id_RankFreeModule(res->qideal, res) == 0);
5091
5092#ifdef HAVE_PLURAL
5093 if( rIsPluralRing(res) )
5094 if( nc_SetupQuotient(res, r, true) )
5095 {
5096// WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
5097 }
5098
5099#endif
5100 assume(id_RankFreeModule(res->qideal, res) == 0);
5101 }
5102
5103#ifdef HAVE_PLURAL
5104 assume((res->qideal==NULL) == (old_ring->qideal==NULL));
5105 assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
5106 assume(rIsSCA(res) == rIsSCA(old_ring));
5107 assume(ncRingType(res) == ncRingType(old_ring));
5108#endif
5109 }
5110
5111 return res;
5112}
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)
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:205
void rWrite(ring r, BOOLEAN details)
Definition ring.cc:227
void rDebugPrint(const ring r)
Definition ring.cc:4214
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 4527 of file ring.cc.

4528{
4529 if ( r->order[0] == ringorder_s ) return r;
4530
4531 if ( r->order[0] == ringorder_IS )
4532 {
4533#ifndef SING_NDEBUG
4534 WarnS("rAssure_SyzComp: input ring has an IS-ordering!");
4535#endif
4536// return r;
4537 }
4538 ring res=rCopy0(r, FALSE, FALSE);
4539 int i=rBlocks(r);
4540 int j;
4541
4542 res->order=(rRingOrder_t *)omAlloc((i+1)*sizeof(rRingOrder_t));
4543 res->block0=(int *)omAlloc0((i+1)*sizeof(int));
4544 res->block1=(int *)omAlloc0((i+1)*sizeof(int));
4545 int ** wvhdl =(int **)omAlloc0((i+1)*sizeof(int**));
4546 for(j=i;j>0;j--)
4547 {
4548 res->order[j]=r->order[j-1];
4549 res->block0[j]=r->block0[j-1];
4550 res->block1[j]=r->block1[j-1];
4551 if (r->wvhdl[j-1] != NULL)
4552 {
4553 #ifdef HAVE_OMALLOC
4554 wvhdl[j] = (int*) omMemDup(r->wvhdl[j-1]);
4555 #else
4556 {
4557 int l=r->block1[j-1]-r->block0[j-1]+1;
4558 if (r->order[j-1]==ringorder_a64) l*=2;
4559 else if (r->order[j-1]==ringorder_M) l=l*l;
4560 else if (r->order[j-1]==ringorder_am)
4561 {
4562 l+=r->wvhdl[j-1][r->block1[j-1]-r->block0[j-1]+1]+1;
4563 }
4564 wvhdl[j]=(int*)omalloc(l*sizeof(int));
4565 memcpy(wvhdl[j],r->wvhdl[j-1],l*sizeof(int));
4566 }
4567 #endif
4568 }
4569 }
4570 res->order[0]=ringorder_s;
4571
4572 res->wvhdl = wvhdl;
4573
4574 if (complete)
4575 {
4576 rComplete(res, 1);
4577#ifdef HAVE_PLURAL
4578 if (rIsPluralRing(r))
4579 {
4580 if ( nc_rComplete(r, res, false) ) // no qideal!
4581 {
4582#ifndef SING_NDEBUG
4583 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4584#endif
4585 }
4586 }
4588#endif
4589
4590#ifdef HAVE_PLURAL
4591 ring old_ring = r;
4592#endif
4593 if (r->qideal!=NULL)
4594 {
4595 res->qideal= idrCopyR_NoSort(r->qideal, r, res);
4596 assume(id_RankFreeModule(res->qideal, res) == 0);
4597#ifdef HAVE_PLURAL
4598 if( rIsPluralRing(res) )
4599 {
4600 if( nc_SetupQuotient(res, r, true) )
4601 {
4602// WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
4603 }
4604 assume(id_RankFreeModule(res->qideal, res) == 0);
4605 }
4606#endif
4607 }
4608
4609#ifdef HAVE_PLURAL
4610 assume((res->qideal==NULL) == (old_ring->qideal==NULL));
4611 assume(rIsPluralRing(res) == rIsPluralRing(old_ring));
4612 assume(rIsSCA(res) == rIsSCA(old_ring));
4613 assume(ncRingType(res) == ncRingType(old_ring));
4614#endif
4615 }
4616 return res;
4617}
#define omAlloc(size)

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

4842{
4843 rTest(r);
4844
4845 ring new_r_1 = rAssure_CompLastBlock(r, FALSE); // due to this FALSE - no completion!
4846 ring new_r = rAssure_SyzComp(new_r_1, FALSE); // new_r_1 is used only here!!!
4847
4848 if (new_r == r)
4849 return r;
4850
4851 ring old_r = r;
4852 if (new_r_1 != new_r && new_r_1 != old_r) rDelete(new_r_1);
4853
4854 rComplete(new_r, TRUE);
4855#ifdef HAVE_PLURAL
4856 if (rIsPluralRing(old_r))
4857 {
4858 if ( nc_rComplete(old_r, new_r, false) ) // no qideal!
4859 {
4860# ifndef SING_NDEBUG
4861 WarnS("error in nc_rComplete"); // cleanup? rDelete(res); return r; // just go on...?
4862# endif
4863 }
4864 }
4865#endif
4866
4867///? rChangeCurrRing(new_r);
4868 if (old_r->qideal != NULL)
4869 {
4870 new_r->qideal = idrCopyR(old_r->qideal, old_r, new_r);
4871 }
4872
4873#ifdef HAVE_PLURAL
4874 if( rIsPluralRing(old_r) )
4875 if( nc_SetupQuotient(new_r, old_r, true) )
4876 {
4877#ifndef SING_NDEBUG
4878 WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
4879#endif
4880 }
4881#endif
4882
4883#ifdef HAVE_PLURAL
4884 assume((new_r->qideal==NULL) == (old_r->qideal==NULL));
4885 assume(rIsPluralRing(new_r) == rIsPluralRing(old_r));
4886 assume(rIsSCA(new_r) == rIsSCA(old_r));
4887 assume(ncRingType(new_r) == ncRingType(old_r));
4888#endif
4889
4890 rTest(new_r);
4891 rTest(old_r);
4892 return new_r;
4893}
ideal idrCopyR(ideal id, ring src_r, ring dest_r)
Definition prCopy.cc:192
ring rAssure_SyzComp(const ring r, BOOLEAN complete)
Definition ring.cc:4527
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:454
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
Definition ring.cc:4786
#define rTest(r)
Definition ring.h:794

◆ rAssure_SyzOrder()

ring rAssure_SyzOrder ( const ring r,
BOOLEAN complete )

Definition at line 4522 of file ring.cc.

4523{
4524 if ( r->order[0] == ringorder_c ) return r;
4525 return rAssure_SyzComp(r,complete);
4526}

◆ rAssure_TDeg()

ring rAssure_TDeg ( const ring r,
int & pos )

Definition at line 4619 of file ring.cc.

4620{
4621 if (r->N==1) // special: dp(1)==lp(1)== no entry in typ
4622 {
4623 pos=r->VarL_LowIndex;
4624 return r;
4625 }
4626 if (r->typ!=NULL)
4627 {
4628 for(int i=r->OrdSize-1;i>=0;i--)
4629 {
4630 if ((r->typ[i].ord_typ==ro_dp)
4631 && (r->typ[i].data.dp.start==1)
4632 && (r->typ[i].data.dp.end==r->N))
4633 {
4634 pos=r->typ[i].data.dp.place;
4635 //printf("no change, pos=%d\n",pos);
4636 return r;
4637 }
4638 }
4639 }
4640
4641#ifdef HAVE_PLURAL
4642 nc_struct* save=r->GetNC();
4643 r->GetNC()=NULL;
4644#endif
4645 ring res=rCopy(r);
4646 if (res->qideal!=NULL)
4647 {
4648 id_Delete(&res->qideal,r);
4649 }
4650
4651 int j;
4652
4653 res->ExpL_Size=r->ExpL_Size+1; // one word more in each monom
4654 res->PolyBin=omGetSpecBin(POLYSIZE + (res->ExpL_Size)*sizeof(long));
4655 omFree((ADDRESS)res->ordsgn);
4656 res->ordsgn=(long *)omAlloc0(res->ExpL_Size*sizeof(long));
4657 for(j=0;j<r->CmpL_Size;j++)
4658 {
4659 res->ordsgn[j] = r->ordsgn[j];
4660 }
4661 res->OrdSize=r->OrdSize+1; // one block more for pSetm
4662 if (r->typ!=NULL)
4663 omFree((ADDRESS)res->typ);
4664 res->typ=(sro_ord*)omAlloc0(res->OrdSize*sizeof(sro_ord));
4665 if (r->typ!=NULL)
4666 memcpy(res->typ,r->typ,r->OrdSize*sizeof(sro_ord));
4667 // the additional block for pSetm: total degree at the last word
4668 // but not included in the compare part
4669 res->typ[res->OrdSize-1].ord_typ=ro_dp;
4670 res->typ[res->OrdSize-1].data.dp.start=1;
4671 res->typ[res->OrdSize-1].data.dp.end=res->N;
4672 res->typ[res->OrdSize-1].data.dp.place=res->ExpL_Size-1;
4673 pos=res->ExpL_Size-1;
4674 //res->pOrdIndex=pos; //NO: think of a(1,0),dp !
4675 extern void p_Setm_General(poly p, ring r);
4676 res->p_Setm=p_Setm_General;
4677 // ----------------------------
4678 omFree((ADDRESS)res->p_Procs);
4679 res->p_Procs = (p_Procs_s*)omAlloc(sizeof(p_Procs_s));
4680
4681 p_ProcsSet(res, res->p_Procs);
4682#ifdef HAVE_PLURAL
4683 r->GetNC()=save;
4684 if (rIsPluralRing(r))
4685 {
4686 if ( nc_rComplete(r, res, false) ) // no qideal!
4687 {
4688#ifndef SING_NDEBUG
4689 WarnS("error in nc_rComplete");
4690#endif
4691 // just go on..
4692 }
4693 }
4694#endif
4695 if (r->qideal!=NULL)
4696 {
4697 res->qideal=idrCopyR_NoSort(r->qideal,r, res);
4698#ifdef HAVE_PLURAL
4699 if (rIsPluralRing(res))
4700 {
4701// nc_SetupQuotient(res, currRing);
4702 nc_SetupQuotient(res, r); // ?
4703 }
4704 assume((res->qideal==NULL) == (r->qideal==NULL));
4705#endif
4706 }
4707
4708#ifdef HAVE_PLURAL
4710 assume(rIsSCA(res) == rIsSCA(r));
4712#endif
4713
4714 return res;
4715}
void * ADDRESS
Definition auxiliary.h:120
#define POLYSIZE
Definition monomials.h:233
#define omFree(addr)
#define omGetSpecBin(size)
Definition omBin.h:11
void p_ProcsSet(ring r, p_Procs_s *p_Procs)
void p_Setm_General(poly p, const ring r)
Definition p_polys.cc:158
ring rCopy(ring r)
Definition ring.cc:1736
struct p_Procs_s p_Procs_s
Definition ring.h:24
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
Definition nc.h:68

◆ rAssure_Wp_C()

ring rAssure_Wp_C ( const ring r,
intvec * w )

Definition at line 4942 of file ring.cc.

4943{
4944 int r_blocks = rBlocks(r);
4945
4946 if ((r_blocks == 3) &&
4947 (r->order[0] == ringorder_Wp) &&
4948 (r->order[1] == ringorder_C) &&
4949 (r->order[2] == 0))
4950 {
4951 BOOLEAN ok=TRUE;
4952 for(int i=0;i<r->N;i++)
4953 {
4954 if ((*w)[i]!=r->wvhdl[0][i]) { ok=FALSE;break;}
4955 }
4956 if (ok) return r;
4957 }
4958 ring res = rCopy0(r, FALSE, FALSE);
4959 res->order = (rRingOrder_t*)omAlloc0(3*sizeof(rRingOrder_t));
4960 res->block0 = (int*)omAlloc0(3*sizeof(int));
4961 res->block1 = (int*)omAlloc0(3*sizeof(int));
4962 res->wvhdl = (int**)omAlloc0(3*sizeof(int*));
4963 res->order[0] = ringorder_Wp;
4964 res->order[1] = ringorder_C;
4965 res->block0[1] = 1;
4966 res->block1[1] = r->N;
4967 res->wvhdl[0]=(int*)omAlloc(r->N*sizeof(int));
4968 for(int i=0;i<r->N;i++)
4969 {
4970 r->wvhdl[0][i]=(*w)[i];
4971 }
4972 rComplete(res, 1);
4973 if (r->qideal!=NULL) res->qideal= idrCopyR_NoSort(r->qideal, r, res);
4974#ifdef HAVE_PLURAL
4975 if (rIsPluralRing(r))
4976 {
4977 if ( nc_rComplete(r, res, false) ) // no qideal!
4978 {
4979#ifndef SING_NDEBUG
4980 WarnS("error in nc_rComplete");
4981#endif
4982 }
4983 }
4984#endif
4985// rChangeCurrRing(res);
4986 return res;
4987}
int BOOLEAN
Definition auxiliary.h:88
const CanonicalForm & w
Definition facAbsFact.cc:51

◆ rBlocks()

static int rBlocks ( const ring r)
inlinestatic

Definition at line 574 of file ring.h.

575{
576 assume(r != NULL);
577 int i=0;
578 while (r->order[i]!=0) i++;
579 return i+1;
580}

◆ rCanShortOut()

static BOOLEAN rCanShortOut ( const ring r)
inlinestatic

Definition at line 592 of file ring.h.

593{
594 assume(r != NULL); return (r->CanShortOut);
595}

◆ rChangeSComps()

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

Definition at line 4497 of file ring.cc.

4498{
4499#ifdef PDEBUG
4500 rDBChangeSComps(currComponents, currShiftedComponents, length, r);
4501#else
4502 rNChangeSComps(currComponents, currShiftedComponents, r);
4503#endif
4504}
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
static void rNChangeSComps(int *currComponents, long *currShiftedComponents, ring r)
Definition ring.cc:4459
static void rDBChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition ring.cc:4475
EXTERN_VAR long * currShiftedComponents
Definition syz.h:118

◆ rChar()

int rChar ( ring r)

Definition at line 718 of file ring.cc.

718{ 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 652 of file ring.cc.

652{ 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:956

◆ rCheckIV()

BOOLEAN rCheckIV ( const intvec * iv)

Definition at line 176 of file ring.cc.

177{
178 if ((iv->length()!=2)&&(iv->length()!=3))
179 {
180 WerrorS("weights only for orderings wp,ws,Wp,Ws,a,M");
181 return TRUE;
182 }
183 return FALSE;
184}
int length() const
Definition intvec.h:95
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 3526 of file ring.cc.

3527{
3528 if (r->VarOffset!=NULL && force == 0) return FALSE;
3529 rSetOutParams(r);
3530 int n=rBlocks(r)-1;
3531 int i;
3532 int bits;
3533 r->bitmask=rGetExpSize(r->wanted_maxExp,bits,r->N);
3534 r->BitsPerExp = bits;
3535 r->ExpPerLong = BIT_SIZEOF_LONG / bits;
3536 r->divmask=rGetDivMask(bits);
3537
3538 // will be used for ordsgn:
3539 long *tmp_ordsgn=(long *)omAlloc0(3*(n+r->N)*sizeof(long));
3540 // will be used for VarOffset:
3541 int *v=(int *)omAlloc((r->N+1)*sizeof(int));
3542 for(i=r->N; i>=0 ; i--)
3543 {
3544 v[i]=-1;
3545 }
3546 sro_ord *tmp_typ=(sro_ord *)omAlloc0(3*(n+r->N)*sizeof(sro_ord));
3547 int typ_i=0;
3548 int prev_ordsgn=0;
3549
3550 // fill in v, tmp_typ, tmp_ordsgn, determine typ_i (== ordSize)
3551 int j=0;
3552 int j_bits=BITS_PER_LONG;
3553
3554 BOOLEAN need_to_add_comp=FALSE; // Only for ringorder_s and ringorder_S!
3555
3556 for(i=0;i<n;i++)
3557 {
3558 tmp_typ[typ_i].order_index=i;
3559 switch (r->order[i])
3560 {
3561 case ringorder_a:
3562 case ringorder_aa:
3563 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3564 r->wvhdl[i]);
3565 typ_i++;
3566 break;
3567
3568 case ringorder_am:
3569 rO_WMDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3570 r->wvhdl[i]);
3571 typ_i++;
3572 break;
3573
3574 case ringorder_a64:
3575 rO_WDegree64(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3576 tmp_typ[typ_i], (int64 *)(r->wvhdl[i]));
3577 typ_i++;
3578 break;
3579
3580 case ringorder_c:
3581 rO_Align(j, j_bits);
3582 rO_LexVars_neg(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3583 r->ComponentOrder=1;
3584 break;
3585
3586 case ringorder_C:
3587 rO_Align(j, j_bits);
3588 rO_LexVars(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3589 r->ComponentOrder=-1;
3590 break;
3591
3592 case ringorder_M:
3593 {
3594 int k,l;
3595 k=r->block1[i]-r->block0[i]+1; // number of vars
3596 for(l=0;l<k;l++)
3597 {
3598 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3599 tmp_typ[typ_i],
3600 r->wvhdl[i]+(r->block1[i]-r->block0[i]+1)*l);
3601 typ_i++;
3602 }
3603 break;
3604 }
3605
3606 case ringorder_lp:
3607 rO_LexVars(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3608 tmp_ordsgn,v,bits, -1);
3609 break;
3610
3611 case ringorder_ls:
3612 rO_LexVars_neg(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3613 tmp_ordsgn,v, bits, -1);
3614 break;
3615
3616 case ringorder_is:
3617 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3618 tmp_ordsgn,v, bits, -1);
3619 break;
3620
3621 case ringorder_ip:
3622 rO_LexVars(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3623 tmp_ordsgn,v, bits, -1);
3624 break;
3625
3626 case ringorder_dp:
3627 if (r->block0[i]==r->block1[i])
3628 {
3629 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3630 tmp_ordsgn,v, bits, -1);
3631 }
3632 else
3633 {
3634 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3635 tmp_typ[typ_i]);
3636 typ_i++;
3637 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i]+1,
3638 prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3639 }
3640 break;
3641
3642 case ringorder_Dp:
3643 if (r->block0[i]==r->block1[i])
3644 {
3645 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3646 tmp_ordsgn,v, bits, -1);
3647 }
3648 else
3649 {
3650 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3651 tmp_typ[typ_i]);
3652 typ_i++;
3653 rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3654 tmp_ordsgn,v, bits, r->block1[i]);
3655 }
3656 break;
3657
3658 case ringorder_Ip:
3659 if (r->block0[i]==r->block1[i])
3660 {
3661 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3662 tmp_ordsgn,v, bits, -1);
3663 }
3664 else
3665 {
3666 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3667 tmp_typ[typ_i]);
3668 typ_i++;
3669 rO_LexVars(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3670 tmp_ordsgn,v, bits, -1);
3671 }
3672 break;
3673
3674 case ringorder_ds:
3675 if (r->block0[i]==r->block1[i])
3676 {
3677 rO_LexVars_neg(j, j_bits,r->block0[i],r->block1[i],prev_ordsgn,
3678 tmp_ordsgn,v,bits, -1);
3679 }
3680 else
3681 {
3682 rO_TDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3683 tmp_typ[typ_i]);
3684 typ_i++;
3685 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i]+1,
3686 prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3687 }
3688 break;
3689
3690 case ringorder_Ds:
3691 if (r->block0[i]==r->block1[i])
3692 {
3693 rO_LexVars_neg(j, j_bits, r->block0[i],r->block0[i],prev_ordsgn,
3694 tmp_ordsgn,v, bits, -1);
3695 }
3696 else
3697 {
3698 rO_TDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3699 tmp_typ[typ_i]);
3700 typ_i++;
3701 rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3702 tmp_ordsgn,v, bits, r->block1[i]);
3703 }
3704 break;
3705
3706 case ringorder_wp:
3707 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3708 tmp_typ[typ_i], r->wvhdl[i]);
3709 typ_i++;
3710 { // check for weights <=0
3711 int jj;
3712 BOOLEAN have_bad_weights=FALSE;
3713 for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3714 {
3715 if (r->wvhdl[i][jj]<=0) have_bad_weights=TRUE;
3716 }
3717 if (have_bad_weights)
3718 {
3719 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3720 tmp_typ[typ_i]);
3721 typ_i++;
3722 }
3723 }
3724 if (r->block1[i]!=r->block0[i])
3725 {
3726 rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3727 tmp_ordsgn, v,bits, r->block0[i]);
3728 }
3729 break;
3730
3731 case ringorder_Wp:
3732 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3733 tmp_typ[typ_i], r->wvhdl[i]);
3734 typ_i++;
3735 { // check for weights <=0
3736 int jj;
3737 BOOLEAN have_bad_weights=FALSE;
3738 for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3739 {
3740 if (r->wvhdl[i][jj]<=0) have_bad_weights=TRUE;
3741 }
3742 if (have_bad_weights)
3743 {
3744 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3745 tmp_typ[typ_i]);
3746 typ_i++;
3747 }
3748 }
3749 if (r->block1[i]!=r->block0[i])
3750 {
3751 rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3752 tmp_ordsgn,v, bits, r->block1[i]);
3753 }
3754 break;
3755
3756 case ringorder_ws:
3757 rO_WDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3758 tmp_typ[typ_i], r->wvhdl[i]);
3759 typ_i++;
3760 if (r->block1[i]!=r->block0[i])
3761 {
3762 rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3763 tmp_ordsgn, v,bits, r->block0[i]);
3764 }
3765 break;
3766
3767 case ringorder_Ws:
3768 rO_WDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3769 tmp_typ[typ_i], r->wvhdl[i]);
3770 typ_i++;
3771 if (r->block1[i]!=r->block0[i])
3772 {
3773 rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3774 tmp_ordsgn,v, bits, r->block1[i]);
3775 }
3776 break;
3777
3778 case ringorder_S:
3779 assume(typ_i == 1); // For LaScala3 only: on the 2nd place ([1])!
3780 // TODO: for K[x]: it is 0...?!
3781 rO_Syzcomp(j, j_bits,prev_ordsgn, tmp_ordsgn,tmp_typ[typ_i]);
3782 need_to_add_comp=TRUE;
3783 r->ComponentOrder=-1;
3784 typ_i++;
3785 break;
3786
3787 case ringorder_s:
3788 assume(typ_i == 0 && j == 0);
3789 rO_Syz(j, j_bits, prev_ordsgn, r->block0[i], tmp_ordsgn, tmp_typ[typ_i]); // set syz-limit?
3790 need_to_add_comp=TRUE;
3791 r->ComponentOrder=-1;
3792 typ_i++;
3793 break;
3794
3795 case ringorder_IS:
3796 {
3797
3798 assume( r->block0[i] == r->block1[i] );
3799 const int s = r->block0[i];
3800 assume( -2 < s && s < 2);
3801
3802 if(s == 0) // Prefix IS
3803 rO_ISPrefix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ[typ_i++]); // What about prev_ordsgn?
3804 else // s = +1 or -1 // Note: typ_i might be incremented here inside!
3805 {
3806 rO_ISSuffix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ, typ_i, s); // Suffix.
3807 need_to_add_comp=FALSE;
3808 }
3809
3810 break;
3811 }
3812 case ringorder_unspec:
3813 case ringorder_no:
3814 default:
3815 dReportError("undef. ringorder used\n");
3816 break;
3817 }
3818 }
3819 rCheckOrdSgn(r,n-1);
3820
3821 int j0=j; // save j
3822 int j_bits0=j_bits; // save jbits
3823 rO_Align(j,j_bits);
3824 r->CmpL_Size = j;
3825
3826 j_bits=j_bits0; j=j0;
3827
3828 // fill in some empty slots with variables not already covered
3829 // v0 is special, is therefore normally already covered
3830 // now we do have rings without comp...
3831 if((need_to_add_comp) && (v[0]== -1))
3832 {
3833 if (prev_ordsgn==1)
3834 {
3835 rO_Align(j, j_bits);
3836 rO_LexVars(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3837 }
3838 else
3839 {
3840 rO_Align(j, j_bits);
3841 rO_LexVars_neg(j, j_bits, 0,0, prev_ordsgn,tmp_ordsgn,v,BITS_PER_LONG, -1);
3842 }
3843 }
3844 // the variables
3845 for(i=1 ; i<=r->N ; i++)
3846 {
3847 if(v[i]==(-1))
3848 {
3849 if (prev_ordsgn==1)
3850 {
3851 rO_LexVars(j, j_bits, i,i, prev_ordsgn,tmp_ordsgn,v,bits, -1);
3852 }
3853 else
3854 {
3855 rO_LexVars_neg(j,j_bits,i,i, prev_ordsgn,tmp_ordsgn,v,bits, -1);
3856 }
3857 }
3858 }
3859
3860 rO_Align(j,j_bits);
3861 // ----------------------------
3862 // finished with constructing the monomial, computing sizes:
3863
3864 r->ExpL_Size=j;
3865 r->PolyBin = omGetSpecBin(POLYSIZE + (r->ExpL_Size)*sizeof(long));
3866 assume(r->PolyBin != NULL);
3867
3868 // ----------------------------
3869 // indices and ordsgn vector for comparison
3870 //
3871 // r->pCompHighIndex already set
3872 r->ordsgn=(long *)omAlloc0(r->ExpL_Size*sizeof(long));
3873
3874 for(j=0;j<r->CmpL_Size;j++)
3875 {
3876 r->ordsgn[j] = tmp_ordsgn[j];
3877 }
3878
3879 omFreeSize((ADDRESS)tmp_ordsgn,(3*(n+r->N)*sizeof(long)));
3880
3881 // ----------------------------
3882 // description of orderings for setm:
3883 //
3884 r->OrdSize=typ_i;
3885 if (typ_i==0) r->typ=NULL;
3886 else
3887 {
3888 r->typ=(sro_ord*)omAlloc(typ_i*sizeof(sro_ord));
3889 memcpy(r->typ,tmp_typ,typ_i*sizeof(sro_ord));
3890 }
3891 omFreeSize((ADDRESS)tmp_typ,(3*(n+r->N)*sizeof(sro_ord)));
3892
3893 // ----------------------------
3894 // indices for (first copy of ) variable entries in exp.e vector (VarOffset):
3895 r->VarOffset=v;
3896
3897 // ----------------------------
3898 // other indices
3899 r->pCompIndex=(r->VarOffset[0] & 0xffff); //r->VarOffset[0];
3900 i=0; // position
3901 j=0; // index in r->typ
3902 if (i==r->pCompIndex) i++; // IS???
3903 while ((j < r->OrdSize)
3904 && ((r->typ[j].ord_typ==ro_syzcomp) ||
3905 (r->typ[j].ord_typ==ro_syz) || (r->typ[j].ord_typ==ro_isTemp) || (r->typ[j].ord_typ==ro_is) ||
3906 (r->order[r->typ[j].order_index] == ringorder_aa)))
3907 {
3908 i++; j++;
3909 }
3910
3911 if (i==r->pCompIndex) i++;
3912 r->pOrdIndex=i;
3913
3914 // ----------------------------
3915 rSetDegStuff(r); // OrdSgn etc already set
3916 rSetOption(r);
3917 // ----------------------------
3918 // r->p_Setm
3919 r->p_Setm = p_GetSetmProc(r);
3920
3921 // ----------------------------
3922 // set VarL_*
3923 rSetVarL(r);
3924
3925 // ----------------------------
3926 // right-adjust VarOffset
3928
3929 // ----------------------------
3930 // set NegWeightL*
3931 rSetNegWeight(r);
3932
3933 // ----------------------------
3934 // p_Procs: call AFTER NegWeightL
3935 r->p_Procs = (p_Procs_s*)omAlloc(sizeof(p_Procs_s));
3936 p_ProcsSet(r, r->p_Procs);
3937
3938 // use totaldegree on crazy orderings:
3939 if ((r->pFDeg==p_WTotaldegree) && rOrd_is_MixedDegree_Ordering(r))
3940 r->pFDeg = p_Totaldegree;
3941 return FALSE;
3942}
long int64
Definition auxiliary.h:68
#define BIT_SIZEOF_LONG
Definition auxiliary.h:80
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:44
#define omFreeSize(addr, size)
long p_WTotaldegree(poly p, const ring r)
Definition p_polys.cc:612
p_SetmProc p_GetSetmProc(const ring r)
Definition p_polys.cc:559
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1523
static void rSetNegWeight(ring r)
Definition ring.cc:3424
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:2538
static void rSetOption(ring r)
Definition ring.cc:3461
#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:2348
static void rSetVarL(ring r)
set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex
Definition ring.cc:4119
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:2398
BOOLEAN rOrd_is_MixedDegree_Ordering(ring r)
Definition ring.cc:3504
static void rSetOutParams(ring r)
Definition ring.cc:3140
static void rSetDegStuff(ring r)
Definition ring.cc:3254
static void rO_WDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition ring.cc:2372
static void rO_Syzcomp(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
Definition ring.cc:2474
static void rO_TDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
Definition ring.cc:2258
static void rO_WMDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition ring.cc:2326
static void rO_Syz(int &place, int &bitplace, int &prev_ord, int syz_comp, long *o, sro_ord &ord_struct)
Definition ring.cc:2489
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
Definition ring.cc:2629
static void rCheckOrdSgn(ring r, int i)
Definition ring.cc:3944
static unsigned long rGetDivMask(int bits)
get r->divmask depending on bits per exponent
Definition ring.cc:4200
static void rRightAdjustVarOffset(ring r)
right-adjust r->VarOffset
Definition ring.cc:4174
static void rO_ISPrefix(int &place, int &bitplace, int &prev_ord, long *o, int N, int *v, sro_ord &ord_struct)
Definition ring.cc:2515
static void rO_Align(int &place, int &bitplace)
Definition ring.cc:2247
static void rO_TDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
Definition ring.cc:2272
static void rO_WDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition ring.cc:2286
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:2435
int order_index
Definition ring.h:227

◆ rCopy()

ring rCopy ( ring r)

Definition at line 1736 of file ring.cc.

1737{
1738 if (r == NULL) return NULL;
1739 ring res=rCopy0(r,FALSE,TRUE);
1740 rComplete(res, 1); // res is purely commutative so far
1741 if (r->qideal!=NULL) res->qideal=idrCopyR_NoSort(r->qideal, r, res);
1742
1743#ifdef HAVE_PLURAL
1744 if (rIsPluralRing(r))
1745 if( nc_rCopy(res, r, true) ) {}
1746#endif
1747
1748 return res;
1749}
bool nc_rCopy(ring res, const ring r, bool bSetupQuotient)

◆ rCopy0()

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

Definition at line 1426 of file ring.cc.

1427{
1428 if (r == NULL) return NULL;
1429 int i,j;
1430 ring res=(ring)omAlloc0Bin(sip_sring_bin);
1431 //memset: res->idroot=NULL; /* local objects */
1432 //ideal minideal;
1433 res->options=r->options; /* ring dependent options */
1434
1435 //memset: res->ordsgn=NULL;
1436 //memset: res->typ=NULL;
1437 //memset: res->VarOffset=NULL;
1438 //memset: res->firstwv=NULL;
1439
1440 //struct omBin PolyBin; /* Bin from where monoms are allocated */
1441 //memset: res->PolyBin=NULL; // rComplete
1442 res->cf=nCopyCoeff(r->cf); /* coeffs */
1443
1444 //memset: res->ref=0; /* reference counter to the ring */
1445
1446 res->N=rVar(r); /* number of vars */
1447
1448 res->firstBlockEnds=r->firstBlockEnds;
1449#ifdef HAVE_PLURAL
1450 res->real_var_start=r->real_var_start;
1451 res->real_var_end=r->real_var_end;
1452#endif
1453
1454#ifdef HAVE_SHIFTBBA
1455 res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
1456 res->LPncGenCount=r->LPncGenCount;
1457#endif
1458
1459 res->VectorOut=r->VectorOut;
1460 res->ShortOut=r->ShortOut;
1461 res->CanShortOut=r->CanShortOut;
1462
1463 //memset: res->ExpL_Size=0;
1464 //memset: res->CmpL_Size=0;
1465 //memset: res->VarL_Size=0;
1466 //memset: res->pCompIndex=0;
1467 //memset: res->pOrdIndex=0;
1468 //memset: res->OrdSize=0;
1469 //memset: res->VarL_LowIndex=0;
1470 //memset: res->NegWeightL_Size=0;
1471 //memset: res->NegWeightL_Offset=NULL;
1472 //memset: res->VarL_Offset=NULL;
1473
1474 // the following are set by rComplete unless predefined
1475 // therefore, we copy these values: maybe they are non-standard
1476 /* mask for getting single exponents */
1477 res->bitmask=r->bitmask;
1478 res->divmask=r->divmask;
1479 res->BitsPerExp = r->BitsPerExp;
1480 res->ExpPerLong = r->ExpPerLong;
1481
1482 //memset: res->p_Procs=NULL;
1483 //memset: res->pFDeg=NULL;
1484 //memset: res->pLDeg=NULL;
1485 //memset: res->pFDegOrig=NULL;
1486 //memset: res->pLDegOrig=NULL;
1487 //memset: res->p_Setm=NULL;
1488 //memset: res->cf=NULL;
1489
1490/*
1491 if (r->extRing!=NULL)
1492 r->extRing->ref++;
1493
1494 res->extRing=r->extRing;
1495 //memset: res->qideal=NULL;
1496*/
1497
1498
1499 if (copy_ordering == TRUE)
1500 {
1501 res->LexOrder=r->LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks
1502 res->MixedOrder=r->MixedOrder; // TRUE for mixed (global/local) ordering, FALSE otherwise,
1503 i=rBlocks(r);
1504 res->wvhdl = (int **)omAlloc(i * sizeof(int *));
1505 res->order = (rRingOrder_t *) omAlloc(i * sizeof(rRingOrder_t));
1506 res->block0 = (int *) omAlloc(i * sizeof(int));
1507 res->block1 = (int *) omAlloc(i * sizeof(int));
1508 for (j=0; j<i; j++)
1509 {
1510 if (r->wvhdl[j]!=NULL)
1511 {
1512 #ifdef HAVE_OMALLOC
1513 res->wvhdl[j] = (int*) omMemDup(r->wvhdl[j]);
1514 #else
1515 {
1516 int l=r->block1[j]-r->block0[j]+1;
1517 if (r->order[j]==ringorder_a64) l*=2;
1518 else if (r->order[j]==ringorder_M) l=l*l;
1519 else if (r->order[j]==ringorder_am)
1520 {
1521 l+=r->wvhdl[j][r->block1[j]-r->block0[j]+1]+1;
1522 }
1523 res->wvhdl[j]=(int*)omalloc(l*sizeof(int));
1524 memcpy(res->wvhdl[j],r->wvhdl[j],l*sizeof(int));
1525 }
1526 #endif
1527 }
1528 else
1529 res->wvhdl[j]=NULL;
1530 }
1531 memcpy(res->order,r->order,i * sizeof(rRingOrder_t));
1532 memcpy(res->block0,r->block0,i * sizeof(int));
1533 memcpy(res->block1,r->block1,i * sizeof(int));
1534 }
1535 //memset: else
1536 //memset: {
1537 //memset: res->wvhdl = NULL;
1538 //memset: res->order = NULL;
1539 //memset: res->block0 = NULL;
1540 //memset: res->block1 = NULL;
1541 //memset: }
1542
1543 res->names = (char **)omAlloc0(rVar(r) * sizeof(char *));
1544 for (i=0; i<rVar(res); i++)
1545 {
1546 res->names[i] = omStrDup(r->names[i]);
1547 }
1548 if (r->qideal!=NULL)
1549 {
1550 if (copy_qideal)
1551 {
1552 assume(copy_ordering);
1553 rComplete(res);
1554 res->qideal= idrCopyR_NoSort(r->qideal, r, res);
1556 }
1557 //memset: else res->qideal = NULL;
1558 }
1559 //memset: else res->qideal = NULL;
1560 //memset: res->GetNC() = NULL; // copy is purely commutative!!!
1561 return res;
1562}
static FORCE_INLINE coeffs nCopyCoeff(const coeffs r)
"copy" coeffs, i.e. increment ref
Definition coeffs.h:437
#define omStrDup(s)
#define omAlloc0Bin(bin)
VAR omBin sip_sring_bin
Definition ring.cc:43
void rUnComplete(ring r)
Definition ring.cc:4057
static short rVar(const ring r)
#define rVar(r) (r->N)
Definition ring.h:598

◆ rCopy0AndAddA()

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

Definition at line 1569 of file ring.cc.

1570{
1571 if (r == NULL) return NULL;
1572 int i,j;
1573 ring res=(ring)omAlloc0Bin(sip_sring_bin);
1574 //memcpy(res,r,sizeof(ip_sring));
1575 //memset: res->idroot=NULL; /* local objects */
1576 //ideal minideal;
1577 res->options=r->options; /* ring dependent options */
1578
1579 //memset: res->ordsgn=NULL;
1580 //memset: res->typ=NULL;
1581 //memset: res->VarOffset=NULL;
1582 //memset: res->firstwv=NULL;
1583
1584 //struct omBin PolyBin; /* Bin from where monoms are allocated */
1585 //memset: res->PolyBin=NULL; // rComplete
1586 res->cf=nCopyCoeff(r->cf); /* coeffs */
1587
1588 //memset: res->ref=0; /* reference counter to the ring */
1589
1590 res->N=rVar(r); /* number of vars */
1591
1592 res->firstBlockEnds=r->firstBlockEnds;
1593#ifdef HAVE_PLURAL
1594 res->real_var_start=r->real_var_start;
1595 res->real_var_end=r->real_var_end;
1596#endif
1597
1598#ifdef HAVE_SHIFTBBA
1599 res->isLPring=r->isLPring; /* 0 for non-letterplace rings, otherwise the number of LP blocks, at least 1, known also as lV */
1600 res->LPncGenCount=r->LPncGenCount;
1601#endif
1602
1603 res->VectorOut=r->VectorOut;
1604 res->ShortOut=r->ShortOut;
1605 res->CanShortOut=r->CanShortOut;
1606 res->LexOrder=r->LexOrder; // TRUE if the monomial ordering has polynomial and power series blocks
1607 res->MixedOrder=r->MixedOrder; // TRUE for mixed (global/local) ordering, FALSE otherwise,
1608
1609 //memset: res->ExpL_Size=0;
1610 //memset: res->CmpL_Size=0;
1611 //memset: res->VarL_Size=0;
1612 //memset: res->pCompIndex=0;
1613 //memset: res->pOrdIndex=0;
1614 //memset: res->OrdSize=0;
1615 //memset: res->VarL_LowIndex=0;
1616 //memset: res->NegWeightL_Size=0;
1617 //memset: res->NegWeightL_Offset=NULL;
1618 //memset: res->VarL_Offset=NULL;
1619
1620 // the following are set by rComplete unless predefined
1621 // therefore, we copy these values: maybe they are non-standard
1622 /* mask for getting single exponents */
1623 res->bitmask=r->bitmask;
1624 res->divmask=r->divmask;
1625 res->BitsPerExp = r->BitsPerExp;
1626 res->ExpPerLong = r->ExpPerLong;
1627
1628 //memset: res->p_Procs=NULL;
1629 //memset: res->pFDeg=NULL;
1630 //memset: res->pLDeg=NULL;
1631 //memset: res->pFDegOrig=NULL;
1632 //memset: res->pLDegOrig=NULL;
1633 //memset: res->p_Setm=NULL;
1634 //memset: res->cf=NULL;
1635
1636/*
1637 if (r->extRing!=NULL)
1638 r->extRing->ref++;
1639
1640 res->extRing=r->extRing;
1641 //memset: res->qideal=NULL;
1642*/
1643
1644
1645 if (copy_ordering == TRUE)
1646 {
1647 i=rBlocks(r)+1; // DIFF to rCopy0
1648 res->wvhdl = (int **)omAlloc(i * sizeof(int *));
1649 res->order = (rRingOrder_t *) omAlloc(i * sizeof(rRingOrder_t));
1650 res->block0 = (int *) omAlloc(i * sizeof(int));
1651 res->block1 = (int *) omAlloc(i * sizeof(int));
1652 for (j=0; j<i-1; j++)
1653 {
1654 if (r->wvhdl[j]!=NULL)
1655 {
1656 #ifdef HAVE_OMALLOC
1657 res->wvhdl[j+1] = (int*) omMemDup(r->wvhdl[j]); //DIFF
1658 #else
1659 {
1660 int l=r->block1[j]-r->block0[j]+1;
1661 if (r->order[j]==ringorder_a64) l*=2;
1662 else if (r->order[j]==ringorder_M) l=l*l;
1663 else if (r->order[j]==ringorder_am)
1664 {
1665 l+=r->wvhdl[j][r->block1[j]-r->block0[j]+1]+1;
1666 }
1667 res->wvhdl[j+1]=(int*)omalloc(l*sizeof(int));
1668 memcpy(res->wvhdl[j+1],r->wvhdl[j],l*sizeof(int));
1669 }
1670 #endif
1671 }
1672 else
1673 res->wvhdl[j+1]=NULL; //DIFF
1674 }
1675 memcpy(&(res->order[1]),r->order,(i-1) * sizeof(rRingOrder_t)); //DIFF
1676 memcpy(&(res->block0[1]),r->block0,(i-1) * sizeof(int)); //DIFF
1677 memcpy(&(res->block1[1]),r->block1,(i-1) * sizeof(int)); //DIFF
1678 }
1679 //memset: else
1680 //memset: {
1681 //memset: res->wvhdl = NULL;
1682 //memset: res->order = NULL;
1683 //memset: res->block0 = NULL;
1684 //memset: res->block1 = NULL;
1685 //memset: }
1686
1687 //the added A
1688 res->order[0]=ringorder_a64;
1689 int length=wv64->rows();
1690 int64 *A=(int64 *)omAlloc(length*sizeof(int64));
1691 for(j=length-1;j>=0;j--)
1692 {
1693 A[j]=(*wv64)[j];
1694 }
1695 res->wvhdl[0]=(int *)A;
1696 res->block0[0]=1;
1697 res->block1[0]=length;
1698 //
1699
1700 res->names = (char **)omAlloc0(rVar(r) * sizeof(char *));
1701 for (i=0; i<rVar(res); i++)
1702 {
1703 res->names[i] = omStrDup(r->names[i]);
1704 }
1705 if (r->qideal!=NULL)
1706 {
1707 if (copy_qideal)
1708 {
1709 #ifndef SING_NDEBUG
1710 if (!copy_ordering)
1711 WerrorS("internal error: rCopy0(Q,TRUE,FALSE)");
1712 else
1713 #endif
1714 {
1715 #ifndef SING_NDEBUG
1716 WarnS("internal bad stuff: rCopy0(Q,TRUE,TRUE)");
1717 #endif
1718 rComplete(res);
1719 res->qideal= idrCopyR_NoSort(r->qideal, r, res);
1721 }
1722 }
1723 //memset: else res->qideal = NULL;
1724 }
1725 //memset: else res->qideal = NULL;
1726 //memset: res->GetNC() = NULL; // copy is purely commutative!!!
1727 return res;
1728}
int rows() const
Definition int64vec.h:66
#define A
Definition sirandom.c:24

◆ rDBTest()

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

Definition at line 2097 of file ring.cc.

2098{
2099 int i,j;
2100
2101 if (r == NULL)
2102 {
2103 dReportError("Null ring in %s:%d", fn, l);
2104 return FALSE;
2105 }
2106
2107
2108 if (r->N == 0) return TRUE;
2109
2110 if ((r->OrdSgn!=1) && (r->OrdSgn!= -1))
2111 {
2112 dReportError("missing OrdSgn in %s:%d", fn, l);
2113 return FALSE;
2114 }
2115
2116// omCheckAddrSize(r,sizeof(ip_sring));
2117#if OM_CHECK > 0
2118 i=rBlocks(r);
2119 omCheckAddrSize(r->order,i*sizeof(int));
2120 omCheckAddrSize(r->block0,i*sizeof(int));
2121 omCheckAddrSize(r->block1,i*sizeof(int));
2122 for(int j=0;j<=i;j++)
2123 {
2124 if((r->order[j]<0)||(r->order[j]>ringorder_unspec))
2125 dError("wrong order in r->order");
2126 }
2127 if (r->wvhdl!=NULL)
2128 {
2129 omCheckAddrSize(r->wvhdl,i*sizeof(int *));
2130 for (j=0;j<i; j++)
2131 {
2132 if (r->wvhdl[j] != NULL) omCheckAddr(r->wvhdl[j]);
2133 }
2134 }
2135#endif
2136 if (r->VarOffset == NULL)
2137 {
2138 dReportError("Null ring VarOffset -- no rComplete (?) in n %s:%d", fn, l);
2139 return FALSE;
2140 }
2141 omCheckAddrSize(r->VarOffset,(r->N+1)*sizeof(int));
2142
2143 if ((r->OrdSize==0)!=(r->typ==NULL))
2144 {
2145 dReportError("mismatch OrdSize and typ-pointer in %s:%d");
2146 return FALSE;
2147 }
2148 omcheckAddrSize(r->typ,r->OrdSize*sizeof(*(r->typ)));
2149 omCheckAddrSize(r->VarOffset,(r->N+1)*sizeof(*(r->VarOffset)));
2150 // test assumptions:
2151 for(i=0;i<=r->N;i++) // for all variables (i = 0..N)
2152 {
2153 if(r->typ!=NULL)
2154 {
2155 for(j=0;j<r->OrdSize;j++) // for all ordering blocks (j =0..OrdSize-1)
2156 {
2157 if(r->typ[j].ord_typ == ro_isTemp)
2158 {
2159 const int p = r->typ[j].data.isTemp.suffixpos;
2160
2161 if(p <= j)
2162 dReportError("ordrec prefix %d is unmatched",j);
2163
2164 assume( p < r->OrdSize );
2165
2166 if(r->typ[p].ord_typ != ro_is)
2167 dReportError("ordrec prefix %d is unmatched (suffix: %d is wrong!!!)",j, p);
2168
2169 // Skip all intermediate blocks for undone variables:
2170 if(r->typ[j].data.isTemp.pVarOffset[i] != -1) // Check i^th variable
2171 {
2172 j = p - 1; // SKIP ALL INTERNAL BLOCKS...???
2173 continue; // To make for check OrdSize bound...
2174 }
2175 }
2176 else if (r->typ[j].ord_typ == ro_is)
2177 {
2178 // Skip all intermediate blocks for undone variables:
2179 if(r->typ[j].data.is.pVarOffset[i] != -1)
2180 {
2181 // TODO???
2182 }
2183
2184 }
2185 else
2186 {
2187 if (r->typ[j].ord_typ==ro_cp)
2188 {
2189 if(((short)r->VarOffset[i]) == r->typ[j].data.cp.place)
2190 dReportError("ordrec %d conflicts with var %d",j,i);
2191 }
2192 else
2193 if ((r->typ[j].ord_typ!=ro_syzcomp)
2194 && (r->VarOffset[i] == r->typ[j].data.dp.place))
2195 dReportError("ordrec %d conflicts with var %d",j,i);
2196 }
2197 }
2198 }
2199 int tmp;
2200 tmp=r->VarOffset[i] & 0xffffff;
2201 #if SIZEOF_LONG == 8
2202 if ((r->VarOffset[i] >> 24) >63)
2203 #else
2204 if ((r->VarOffset[i] >> 24) >31)
2205 #endif
2206 dReportError("bit_start out of range:%d",r->VarOffset[i] >> 24);
2207 if (i > 0 && ((tmp<0) ||(tmp>r->ExpL_Size-1)))
2208 {
2209 dReportError("varoffset out of range for var %d: %d",i,tmp);
2210 }
2211 }
2212 if(r->typ!=NULL)
2213 {
2214 for(j=0;j<r->OrdSize;j++)
2215 {
2216 if ((r->typ[j].ord_typ==ro_dp)
2217 || (r->typ[j].ord_typ==ro_wp)
2218 || (r->typ[j].ord_typ==ro_wp_neg))
2219 {
2220 if (r->typ[j].data.dp.start > r->typ[j].data.dp.end)
2221 dReportError("in ordrec %d: start(%d) > end(%d)",j,
2222 r->typ[j].data.dp.start, r->typ[j].data.dp.end);
2223 if ((r->typ[j].data.dp.start < 1)
2224 || (r->typ[j].data.dp.end > r->N))
2225 dReportError("in ordrec %d: start(%d)<1 or end(%d)>vars(%d)",j,
2226 r->typ[j].data.dp.start, r->typ[j].data.dp.end,r->N);
2227 }
2228 }
2229 }
2230
2231 assume(r != NULL);
2232 assume(r->cf != NULL);
2233
2234 if (nCoeff_is_algExt(r->cf))
2235 {
2236 assume(r->cf->extRing != NULL);
2237 assume(r->cf->extRing->qideal != NULL);
2238 omCheckAddr(r->cf->extRing->qideal->m[0]);
2239 }
2240
2241 //assume(r->cf!=NULL);
2242
2243 return TRUE;
2244}
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition coeffs.h:903
#define omCheckAddr(addr)
#define omCheckAddrSize(addr, size)
#define omcheckAddrSize(addr, size)

◆ rDebugPrint()

void rDebugPrint ( const ring r)

Definition at line 4214 of file ring.cc.

4215{
4216 if (r==NULL)
4217 {
4218 PrintS("NULL ?\n");
4219 return;
4220 }
4221 // corresponds to ro_typ from ring.h:
4222 const char *TYP[]={"ro_dp","ro_wp","ro_am","ro_wp64","ro_wp_neg","ro_cp",
4223 "ro_syzcomp", "ro_syz", "ro_isTemp", "ro_is", "ro_none"};
4224 int i,j;
4225
4226 Print("ExpL_Size:%d ",r->ExpL_Size);
4227 Print("CmpL_Size:%d ",r->CmpL_Size);
4228 Print("VarL_Size:%d\n",r->VarL_Size);
4229 Print("bitmask=0x%lx (expbound=%ld) \n",r->bitmask, r->bitmask);
4230 Print("divmask=%lx\n", r->divmask);
4231 Print("BitsPerExp=%d ExpPerLong=%d at L[%d]\n", r->BitsPerExp, r->ExpPerLong, r->VarL_Offset[0]);
4232
4233 Print("VarL_LowIndex: %d\n", r->VarL_LowIndex);
4234 PrintS("VarL_Offset:\n");
4235 if (r->VarL_Offset==NULL) PrintS(" NULL");
4236 else
4237 for(j = 0; j < r->VarL_Size; j++)
4238 Print(" VarL_Offset[%d]: %d ", j, r->VarL_Offset[j]);
4239 PrintLn();
4240
4241
4242 PrintS("VarOffset:\n");
4243 if (r->VarOffset==NULL) PrintS(" NULL\n");
4244 else
4245 for(j=0;j<=r->N;j++)
4246 Print(" v%d at e-pos %d, bit %d\n",
4247 j,r->VarOffset[j] & 0xffffff, r->VarOffset[j] >>24);
4248 PrintS("ordsgn:\n");
4249 for(j=0;j<r->CmpL_Size;j++)
4250 Print(" ordsgn %ld at pos %d\n",r->ordsgn[j],j);
4251 Print("OrdSgn:%d\n",r->OrdSgn);
4252 PrintS("ordrec:\n");
4253 for(j=0;j<r->OrdSize;j++)
4254 {
4255 Print(" typ %s", TYP[r->typ[j].ord_typ]);
4256 if (r->typ[j].ord_typ==ro_syz)
4257 {
4258 const short place = r->typ[j].data.syz.place;
4259 const int limit = r->typ[j].data.syz.limit;
4260 const int curr_index = r->typ[j].data.syz.curr_index;
4261 const int* syz_index = r->typ[j].data.syz.syz_index;
4262
4263 Print(" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
4264
4265 if( syz_index == NULL )
4266 PrintS("(NULL)");
4267 else
4268 {
4269 PrintS("{");
4270 for( i=0; i <= limit; i++ )
4271 Print("%d ", syz_index[i]);
4272 PrintS("}");
4273 }
4274
4275 }
4276 else if (r->typ[j].ord_typ==ro_isTemp)
4277 {
4278 Print(" start (level) %d, suffixpos: %d, VO: ",r->typ[j].data.isTemp.start, r->typ[j].data.isTemp.suffixpos);
4279
4280 }
4281 else if (r->typ[j].ord_typ==ro_is)
4282 {
4283 Print(" start %d, end: %d: ",r->typ[j].data.is.start, r->typ[j].data.is.end);
4284
4285// 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]);
4286
4287 Print(" limit %d",r->typ[j].data.is.limit);
4288#ifndef SING_NDEBUG
4289 //PrintS(" F: ");idShow(r->typ[j].data.is.F, r, r, 1);
4290#endif
4291
4292 PrintLn();
4293 }
4294 else if (r->typ[j].ord_typ==ro_am)
4295 {
4296 Print(" place %d",r->typ[j].data.am.place);
4297 Print(" start %d",r->typ[j].data.am.start);
4298 Print(" end %d",r->typ[j].data.am.end);
4299 Print(" len_gen %d",r->typ[j].data.am.len_gen);
4300 PrintS(" w:");
4301 int l=0;
4302 for(l=r->typ[j].data.am.start;l<=r->typ[j].data.am.end;l++)
4303 Print(" %d",r->typ[j].data.am.weights[l-r->typ[j].data.am.start]);
4304 l=r->typ[j].data.am.end+1;
4305 int ll=r->typ[j].data.am.weights[l-r->typ[j].data.am.start];
4306 PrintS(" m:");
4307 for(int lll=l+1;lll<l+ll+1;lll++)
4308 Print(" %d",r->typ[j].data.am.weights[lll-r->typ[j].data.am.start]);
4309 }
4310 else
4311 {
4312 Print(" place %d",r->typ[j].data.dp.place);
4313
4314 if (r->typ[j].ord_typ!=ro_syzcomp && r->typ[j].ord_typ!=ro_syz)
4315 {
4316 Print(" start %d",r->typ[j].data.dp.start);
4317 Print(" end %d",r->typ[j].data.dp.end);
4318 if ((r->typ[j].ord_typ==ro_wp)
4319 || (r->typ[j].ord_typ==ro_wp_neg))
4320 {
4321 PrintS(" w:");
4322 for(int l=r->typ[j].data.wp.start;l<=r->typ[j].data.wp.end;l++)
4323 Print(" %d",r->typ[j].data.wp.weights[l-r->typ[j].data.wp.start]);
4324 }
4325 else if (r->typ[j].ord_typ==ro_wp64)
4326 {
4327 PrintS(" w64:");
4328 int l;
4329 for(l=r->typ[j].data.wp64.start;l<=r->typ[j].data.wp64.end;l++)
4330 Print(" %ld",(long)(r->typ[j].data.wp64.weights64+l-r->typ[j].data.wp64.start));
4331 }
4332 }
4333 }
4334 PrintLn();
4335 }
4336 Print("pOrdIndex:%d pCompIndex:%d\n", r->pOrdIndex, r->pCompIndex);
4337 Print("OrdSize:%d\n",r->OrdSize);
4338 PrintS("--------------------\n");
4339 for(j=0;j<r->ExpL_Size;j++)
4340 {
4341 Print("L[%d]: ",j);
4342 if (j< r->CmpL_Size)
4343 Print("ordsgn %ld ", r->ordsgn[j]);
4344 else
4345 PrintS("no comp ");
4346 i=1;
4347 for(;i<=r->N;i++)
4348 {
4349 if( (r->VarOffset[i] & 0xffffff) == j )
4350 { Print("v%d at e[%d], bit %d; ", i,r->VarOffset[i] & 0xffffff,
4351 r->VarOffset[i] >>24 ); }
4352 }
4353 if( r->pCompIndex==j ) PrintS("v0; ");
4354 for(i=0;i<r->OrdSize;i++)
4355 {
4356 if (r->typ[i].data.dp.place == j)
4357 {
4358 Print("ordrec:%s (start:%d, end:%d) ",TYP[r->typ[i].ord_typ],
4359 r->typ[i].data.dp.start, r->typ[i].data.dp.end);
4360 }
4361 }
4362
4363 if (j==r->pOrdIndex)
4364 PrintS("pOrdIndex\n");
4365 else
4366 PrintLn();
4367 }
4368 Print("LexOrder:%d, MixedOrder:%d\n",r->LexOrder, r->MixedOrder);
4369
4370 Print("NegWeightL_Size: %d, NegWeightL_Offset: ", r->NegWeightL_Size);
4371 if (r->NegWeightL_Offset==NULL) PrintS(" NULL");
4372 else
4373 for(j = 0; j < r->NegWeightL_Size; j++)
4374 Print(" [%d]: %d ", j, r->NegWeightL_Offset[j]);
4375 PrintLn();
4376
4377 // p_Procs stuff
4378 p_Procs_s proc_names;
4379 const char* field;
4380 const char* length;
4381 const char* ord;
4382 p_Debug_GetProcNames(r, &proc_names); // changes p_Procs!!!
4383 p_Debug_GetSpecNames(r, field, length, ord);
4384
4385 Print("p_Spec : %s, %s, %s\n", field, length, ord);
4386 PrintS("p_Procs :\n");
4387 for (i=0; i<(int) (sizeof(p_Procs_s)/sizeof(void*)); i++)
4388 {
4389 Print(" %s,\n", ((char**) &proc_names)[i]);
4390 }
4391
4392 {
4393 PrintLn();
4394 PrintS("pFDeg : ");
4395#define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
4399 pFDeg_CASE(p_Deg); else
4400#undef pFDeg_CASE
4401 Print("(%p)", r->pFDeg); // default case
4402
4403 PrintLn();
4404 Print("pLDeg : (%p)", r->pLDeg);
4405 PrintLn();
4406 }
4407 PrintS("pSetm:");
4408 void p_Setm_Dummy(poly p, const ring r);
4409 void p_Setm_TotalDegree(poly p, const ring r);
4410 void p_Setm_WFirstTotalDegree(poly p, const ring r);
4411 void p_Setm_General(poly p, const ring r);
4412 if (r->p_Setm==p_Setm_General) PrintS("p_Setm_General\n");
4413 else if (r->p_Setm==p_Setm_Dummy) PrintS("p_Setm_Dummy\n");
4414 else if (r->p_Setm==p_Setm_TotalDegree) PrintS("p_Setm_Totaldegree\n");
4415 else if (r->p_Setm==p_Setm_WFirstTotalDegree) PrintS("p_Setm_WFirstTotalDegree\n");
4416 else Print("%p\n",r->p_Setm);
4417}
void p_Debug_GetProcNames(const ring r, p_Procs_s *p_Procs)
void p_Debug_GetSpecNames(const ring r, const char *&field, const char *&length, const char *&ord)
void p_Setm_WFirstTotalDegree(poly p, const ring r)
Definition p_polys.cc:553
long p_WFirstTotalDegree(poly p, const ring r)
Definition p_polys.cc:595
void p_Setm_Dummy(poly p, const ring r)
Definition p_polys.cc:540
void p_Setm_TotalDegree(poly p, const ring r)
Definition p_polys.cc:546
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586
#define pFDeg_CASE(A)

◆ rDecRefCnt()

static void rDecRefCnt ( ring r)
inlinestatic

Definition at line 850 of file ring.h.

850{ r->ref--; }

◆ rDefault() [1/4]

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

Definition at line 139 of file ring.cc.

140{
141 assume( cf != NULL);
142 /*order: o=lp,0*/
143 rRingOrder_t *order = (rRingOrder_t *) omAlloc(2* sizeof(rRingOrder_t));
144 int *block0 = (int *)omAlloc0(2 * sizeof(int));
145 int *block1 = (int *)omAlloc0(2 * sizeof(int));
146 /* ringorder o=lp for the first block: var 1..N */
147 order[0] = o;
148 block0[0] = 1;
149 block1[0] = N;
150 /* the last block: everything is 0 */
151 order[1] = (rRingOrder_t)0;
152
153 return rDefault(cf,N,n,2,order,block0,block1);
154}
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:103

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

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

◆ rDefault() [3/4]

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

Definition at line 156 of file ring.cc.

157{
158 coeffs cf;
159 if (ch==0) cf=nInitChar(n_Q,NULL);
160 else cf=nInitChar(n_Zp,(void*)(long)ch);
161 assume( cf != NULL);
162 return rDefault(cf,N,n);
163}
@ 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:406

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

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

◆ rDelete()

void rDelete ( ring r)

unconditionally deletes fields in r

Definition at line 454 of file ring.cc.

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

◆ rEnvelope()

ring rEnvelope ( ring r)

Definition at line 5819 of file ring.cc.

5822{
5823 ring Ropp = rOpposite(R);
5824 ring Renv = NULL;
5825 int stat = rSum(R, Ropp, Renv); /* takes care of qideals */
5826 if ( stat <=0 )
5827 WarnS("Error in rEnvelope at rSum");
5828 rTest(Renv);
5829 return Renv;
5830}
int rSum(ring r1, ring r2, ring &sum)
Definition ring.cc:1407
ring rOpposite(ring src)
Definition ring.cc:5425

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

1752{
1753 if (r1 == r2) return TRUE;
1754 if (r1 == NULL || r2 == NULL) return FALSE;
1755 if (r1->cf!=r2->cf) return FALSE;
1756 if (rVar(r1)!=rVar(r2)) return FALSE;
1757 if (r1->bitmask!=r2->bitmask) return FALSE;
1758 #ifdef HAVE_SHIFTBBA
1759 if (r1->isLPring!=r2->isLPring) return FALSE;
1760 if (r1->LPncGenCount!=r2->LPncGenCount) return FALSE;
1761 #endif
1762
1763 if( !rSamePolyRep(r1, r2) )
1764 return FALSE;
1765
1766 int i/*, j*/;
1767
1768 for (i=0; i<rVar(r1); i++)
1769 {
1770 if ((r1->names[i] != NULL) && (r2->names[i] != NULL))
1771 {
1772 if (strcmp(r1->names[i], r2->names[i])) return FALSE;
1773 }
1774 else if ((r1->names[i] != NULL) ^ (r2->names[i] != NULL))
1775 {
1776 return FALSE;
1777 }
1778 }
1779
1780 if (qr)
1781 {
1782 if (r1->qideal != NULL)
1783 {
1784 ideal id1 = r1->qideal, id2 = r2->qideal;
1785 int i, n;
1786 poly *m1, *m2;
1787
1788 if (id2 == NULL) return FALSE;
1789 if ((n = IDELEMS(id1)) != IDELEMS(id2)) return FALSE;
1790
1791 {
1792 m1 = id1->m;
1793 m2 = id2->m;
1794 for (i=0; i<n; i++)
1795 if (! p_EqualPolys(m1[i],m2[i], r1, r2)) return FALSE;
1796 }
1797 }
1798 else if (r2->qideal != NULL) return FALSE;
1799 }
1800
1801 return TRUE;
1802}
Definition qr.h:46
BOOLEAN p_EqualPolys(poly p1, poly p2, const ring r)
Definition p_polys.cc:4621
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:1804
#define IDELEMS(i)

◆ 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 558 of file ring.h.

559{ 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 is empty operation.
Definition coeffs.h:899

◆ rField_has_simple_inverse()

static BOOLEAN rField_has_simple_inverse ( const ring r)
inlinestatic

Definition at line 554 of file ring.h.

555{ 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:895

◆ rField_has_Units()

static BOOLEAN rField_has_Units ( const ring r)
inlinestatic

Definition at line 496 of file ring.h.

497{ 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:790

◆ rField_is_Domain()

static BOOLEAN rField_is_Domain ( const ring r)
inlinestatic

Definition at line 493 of file ring.h.

494{ 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:734

◆ rField_is_GF() [1/2]

static BOOLEAN rField_is_GF ( const ring r)
inlinestatic

Definition at line 527 of file ring.h.

528{ 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:832

◆ rField_is_GF() [2/2]

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

Definition at line 530 of file ring.h.

531{ 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 551 of file ring.h.

552{ 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:887

◆ rField_is_long_R()

static BOOLEAN rField_is_long_R ( const ring r)
inlinestatic

Definition at line 548 of file ring.h.

549{ 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:884

◆ rField_is_numeric()

static BOOLEAN rField_is_numeric ( const ring r)
inlinestatic

Definition at line 521 of file ring.h.

522{ 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:825

◆ rField_is_Q()

static BOOLEAN rField_is_Q ( const ring r)
inlinestatic

Definition at line 512 of file ring.h.

513{ 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:799

◆ rField_is_Q_a()

static BOOLEAN rField_is_Q_a ( const ring r)
inlinestatic

Definition at line 545 of file ring.h.

546{ 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:878

◆ rField_is_R()

static BOOLEAN rField_is_R ( const ring r)
inlinestatic

Definition at line 524 of file ring.h.

525{ 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:829

◆ rField_is_Ring_2toM()

static BOOLEAN rField_is_Ring_2toM ( const ring r)
inlinestatic

Definition at line 485 of file ring.h.

486{ 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 488 of file ring.h.

489{ 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 515 of file ring.h.

516{ 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:809

◆ rField_is_Zn()

static BOOLEAN rField_is_Zn ( const ring r)
inlinestatic

Definition at line 518 of file ring.h.

519{ 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:819

◆ rField_is_Zp() [1/2]

static BOOLEAN rField_is_Zp ( const ring r)
inlinestatic

Definition at line 506 of file ring.h.

507{ 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 509 of file ring.h.

510{ 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 535 of file ring.h.

536{ 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:852

◆ rField_is_Zp_a() [2/2]

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

Definition at line 540 of file ring.h.

541{ 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 562 of file ring.h.

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

◆ rGetCurrSyzLimit()

static int rGetCurrSyzLimit ( const ring r)
inlinestatic

Definition at line 729 of file ring.h.

730{ 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:726

◆ rGetExpSize()

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

Definition at line 2722 of file ring.cc.

2723{
2724 bitmask =rGetExpSize(bitmask, bits);
2725 int vars_per_long=BIT_SIZEOF_LONG/bits;
2726 int bits1;
2727 loop
2728 {
2729 if (bits == BIT_SIZEOF_LONG-1)
2730 {
2731 bits = BIT_SIZEOF_LONG - 1;
2732 return LONG_MAX;
2733 }
2734 unsigned long bitmask1 =rGetExpSize(bitmask+1, bits1);
2735 int vars_per_long1=BIT_SIZEOF_LONG/bits1;
2736 if ((((N+vars_per_long-1)/vars_per_long) ==
2737 ((N+vars_per_long1-1)/vars_per_long1)))
2738 {
2739 vars_per_long=vars_per_long1;
2740 bits=bits1;
2741 bitmask=bitmask1;
2742 }
2743 else
2744 {
2745 return bitmask; /* and bits */
2746 }
2747 }
2748}
#define loop
Definition structs.h:71

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

5145{
5146 // Put the reference set F into the ring -ordering -recor
5147#if MYTEST
5148 Print("rIsIS(p: %d)\nF:", p);
5149 PrintLn();
5150#endif
5151
5152 if (r->typ==NULL)
5153 {
5154// dReportError("'rIsIS:' Error: wrong ring! (typ == NULL)");
5155 return -1;
5156 }
5157
5158 int j = p; // Which IS record to use...
5159 for( int pos = 0; pos < r->OrdSize; pos++ )
5160 if( r->typ[pos].ord_typ == ro_is)
5161 if( j-- == 0 )
5162 return pos;
5163
5164 return -1;
5165}

◆ rGetMaxSyzComp()

int rGetMaxSyzComp ( int i,
const ring r )

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

Definition at line 5302 of file ring.cc.

5303{
5304 if ((r->typ!=NULL) && (r->typ[0].ord_typ==ro_syz) &&
5305 r->typ[0].data.syz.limit > 0 && i > 0)
5306 {
5307 assume(i <= r->typ[0].data.syz.limit);
5308 int j;
5309 for (j=0; j<r->typ[0].data.syz.limit; j++)
5310 {
5311 if (r->typ[0].data.syz.syz_index[j] == i &&
5312 r->typ[0].data.syz.syz_index[j+1] != i)
5313 {
5314 assume(r->typ[0].data.syz.syz_index[j+1] == i+1);
5315 return j;
5316 }
5317 }
5318 return r->typ[0].data.syz.limit;
5319 }
5320 else
5321 {
5322 #ifndef SING_NDEBUG
5323 WarnS("rGetMaxSyzComp: order c");
5324 #endif
5325 return 0;
5326 }
5327}

◆ rGetOrderType()

rOrderType_t rGetOrderType ( ring r)

Definition at line 1845 of file ring.cc.

1846{
1847 // check for simple ordering
1848 if (rHasSimpleOrder(r))
1849 {
1850 if ((r->order[1] == ringorder_c)
1851 || (r->order[1] == ringorder_C))
1852 {
1853 switch(r->order[0])
1854 {
1855 case ringorder_dp:
1856 case ringorder_wp:
1857 case ringorder_ds:
1858 case ringorder_ws:
1859 case ringorder_ls:
1860 case ringorder_unspec:
1861 if (r->order[1] == ringorder_C
1862 || r->order[0] == ringorder_unspec)
1863 return rOrderType_ExpComp;
1864 return rOrderType_Exp;
1865
1866 default:
1867 assume(r->order[0] == ringorder_lp ||
1868 r->order[0] == ringorder_rs ||
1869 r->order[0] == ringorder_Dp ||
1870 r->order[0] == ringorder_Wp ||
1871 r->order[0] == ringorder_Ds ||
1872 r->order[0] == ringorder_Ws);
1873
1874 if (r->order[1] == ringorder_c) return rOrderType_ExpComp;
1875 return rOrderType_Exp;
1876 }
1877 }
1878 else
1879 {
1880 assume((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C));
1881 return rOrderType_CompExp;
1882 }
1883 }
1884 else
1885 return rOrderType_General;
1886}
BOOLEAN rHasSimpleOrder(const ring r)
Definition ring.cc:1892
#define ringorder_rs
Definition ring.h:101

◆ rGetSComps()

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

Definition at line 4506 of file ring.cc.

4507{
4508#ifdef PDEBUG
4509 rDBGetSComps(currComponents, currShiftedComponents, length, r);
4510#else
4511 rNGetSComps(currComponents, currShiftedComponents, r);
4512#endif
4513}
static void rNGetSComps(int **currComponents, long **currShiftedComponents, ring r)
Definition ring.cc:4467
static void rDBGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
Definition ring.cc:4485

◆ rGetVar()

poly rGetVar ( const int varIndex,
const ring r )

Definition at line 5911 of file ring.cc.

5912{
5913 poly p = p_ISet(1, r);
5914 p_SetExp(p, varIndex, 1, r);
5915 p_Setm(p, r);
5916 return p;
5917}
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1298
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:490
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235

◆ rGetWeightVec()

int64 * rGetWeightVec ( const ring r)

Definition at line 5366 of file ring.cc.

5367{
5368 assume(r!=NULL);
5369 assume(r->OrdSize>0);
5370 int i=0;
5371 while((r->typ[i].ord_typ!=ro_wp64) && (r->typ[i].ord_typ>0)) i++;
5372 if (r->typ[i].ord_typ!=ro_wp64) return NULL; /* should not happen*/
5373 return r->typ[i].data.wp64.weights64;
5374}

◆ rHas_c_Ordering()

BOOLEAN rHas_c_Ordering ( const ring r)

Definition at line 1888 of file ring.cc.

1889{
1890 return (r->order[0] == ringorder_c);
1891}

◆ rHasBlockOrder()

BOOLEAN rHasBlockOrder ( const ring r)

Definition at line 1923 of file ring.cc.

1924{
1925 if (r->order[0] == ringorder_s) return FALSE;
1926 int s=0;
1927 if ((r->order[0] == ringorder_c)
1928 || (r->order[0] == ringorder_C)) s=1;
1929
1930 if ((r->block0[s]!=1)||(r->block1[s]!=r->N))
1931 return TRUE;
1932 if ((r->order[s] == ringorder_lp)
1933 || (r->order[s] == ringorder_rp)
1934 || (r->order[s] == ringorder_ls)
1935 || (r->order[s] == ringorder_rs))
1936 return TRUE;
1937 if(r->order[s] == ringorder_a)
1938 {
1939 for(int i=0;i<r->N;i++) // we have: block0[s]=1, block1[s]=N
1940 {
1941 if(r->wvhdl[s][i]==0) return TRUE;
1942 }
1943 }
1944 return FALSE;
1945}
#define ringorder_rp
Definition ring.h:100

◆ rHasGlobalOrdering()

static BOOLEAN rHasGlobalOrdering ( const ring r)
inlinestatic

Definition at line 768 of file ring.h.

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

◆ rHasLocalOrMixedOrdering()

static BOOLEAN rHasLocalOrMixedOrdering ( const ring r)
inlinestatic

Definition at line 769 of file ring.h.

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

◆ rHasMixedOrdering()

static BOOLEAN rHasMixedOrdering ( const ring r)
inlinestatic

Definition at line 770 of file ring.h.

770{ return (r->MixedOrder); }

◆ rHasSimpleLexOrder()

BOOLEAN rHasSimpleLexOrder ( const ring r)

returns TRUE, if simple lp or ls ordering

Definition at line 1948 of file ring.cc.

1949{
1950 return rHasSimpleOrder(r) &&
1951 (r->order[0] == ringorder_ls ||
1952 r->order[0] == ringorder_lp ||
1953 r->order[1] == ringorder_ls ||
1954 r->order[1] == ringorder_lp);
1955}

◆ rHasSimpleOrder()

BOOLEAN rHasSimpleOrder ( const ring r)

Definition at line 1892 of file ring.cc.

1893{
1894 if (r->order[0] == ringorder_unspec) return TRUE;
1895 int blocks = rBlocks(r) - 1;
1896 assume(blocks >= 1);
1897 if (blocks == 1) return TRUE;
1898
1899 int s = 0;
1900 while( (s < blocks) && (r->order[s] == ringorder_IS) && (r->order[blocks-1] == ringorder_IS) )
1901 {
1902 s++;
1903 blocks--;
1904 }
1905
1906 if ((blocks - s) > 2) return FALSE;
1907
1908 assume( blocks == s + 2 );
1909
1910 if (
1911 (r->order[s] != ringorder_c)
1912 && (r->order[s] != ringorder_C)
1913 && (r->order[s+1] != ringorder_c)
1914 && (r->order[s+1] != ringorder_C)
1915 )
1916 return FALSE;
1917 if ((r->order[s+1] == ringorder_M)
1918 || (r->order[s] == ringorder_M))
1919 return FALSE;
1920 return TRUE;
1921}

◆ rIncRefCnt()

static ring rIncRefCnt ( ring r)
inlinestatic

Definition at line 849 of file ring.h.

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

◆ rInternalChar()

static int rInternalChar ( const ring r)
inlinestatic

Definition at line 695 of file ring.h.

696{
697 assume(r != NULL);
698 const coeffs C = r->cf;
699 assume(C != NULL);
700 return C->ch;
701}

◆ rIsLPRing()

static BOOLEAN rIsLPRing ( const ring r)
inlinestatic

Definition at line 417 of file ring.h.

418{
419 assume(r != NULL);
420#ifdef HAVE_SHIFTBBA
421 return (r->isLPring!=0);
422#else
423 return FALSE;
424#endif
425}

◆ rIsNCRing()

static BOOLEAN rIsNCRing ( const ring r)
inlinestatic

Definition at line 427 of file ring.h.

428{
429 assume(r != NULL);
430 return rIsPluralRing(r) || rIsLPRing(r);
431}
static BOOLEAN rIsLPRing(const ring r)
Definition ring.h:417

◆ rIsPluralRing()

static BOOLEAN rIsPluralRing ( const ring r)
inlinestatic

we must always have this test!

Definition at line 406 of file ring.h.

407{
408 assume(r != NULL);
409#ifdef HAVE_PLURAL
410 nc_struct *n;
411 return ((n=r->GetNC()) != NULL) /*&& (n->type != nc_error)*/;
412#else
413 return FALSE;
414#endif
415}

◆ rIsRatGRing()

static BOOLEAN rIsRatGRing ( const ring r)
inlinestatic

Definition at line 433 of file ring.h.

434{
435 assume(r != NULL);
436#ifdef HAVE_PLURAL
437 /* nc_struct *n; */
438 return (r != NULL) /* && ((n=r->GetNC()) != NULL) */
439 && (r->real_var_start>1);
440#else
441 return FALSE;
442#endif
443}

◆ rIsSyzIndexRing()

static BOOLEAN rIsSyzIndexRing ( const ring r)
inlinestatic

Definition at line 726 of file ring.h.

727{ 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 3129 of file ring.cc.

3130{
3131 rUnComplete(r);
3132 omFree(r->order);
3133 omFree(r->block0);
3134 omFree(r->block1);
3135 omFree(r->wvhdl[0]);
3136 omFree(r->wvhdl);
3138}

◆ rKillModifiedRing()

void rKillModifiedRing ( ring r)

Definition at line 3118 of file ring.cc.

3119{
3120 r->qideal=NULL;r->idroot=NULL; // was taken from original
3121 rUnComplete(r);
3122 omFree(r->order);
3123 omFree(r->block0);
3124 omFree(r->block1);
3125 omFree(r->wvhdl);
3127}

◆ rMinpolyIsNULL()

static BOOLEAN rMinpolyIsNULL ( const ring r)
inlinestatic

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

Definition at line 705 of file ring.h.

706{
707 assume(r != NULL);
708 const coeffs C = r->cf;
709 assume(C != NULL);
710
711 const BOOLEAN ret = nCoeff_is_algExt(C); // || nCoeff_is_GF(C) || nCoeff_is_long_C(C);
712
713 if( ret )
714 {
715 assume( (C->extRing) != NULL );
716 BOOLEAN idIs0 (ideal h);
717 assume((!((C->extRing)->qideal==NULL)) && (!idIs0((C->extRing)->qideal)));
718 }
719
720 // TODO: this leads to test fails (due to rDecompose?)
721 return !ret;
722}
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 6024 of file ring.cc.

6025{
6026 if (r->order[2]!=0)
6027 {
6028 WerrorS("only for rings with an ordering of one block");
6029 return NULL;
6030 }
6031 int p;
6032 if((r->order[0]==ringorder_C)
6033 ||(r->order[0]==ringorder_c))
6034 p=1;
6035 else
6036 p=0;
6037 if((r->order[p]!=ringorder_dp)
6038 && (r->order[p]!=ringorder_Dp)
6039 && (r->order[p]!=ringorder_lp)
6040 && (r->order[p]!=ringorder_rp)
6041 && (r->order[p]!=ringorder_ds)
6042 && (r->order[p]!=ringorder_Ds)
6043 && (r->order[p]!=ringorder_ls))
6044 {
6045 WerrorS("ordering must be dp,Dp,lp,rp,ds,Ds or ls");
6046 return NULL;
6047 }
6048 ring R=rCopy0(r);
6049 int i=R->N-1;
6050 while(i>=0)
6051 {
6052 if (strcmp(R->names[i],v)==0)
6053 {
6054 R->N--;
6055 omFree(R->names[i]);
6056 for(int j=i;j<R->N;j++) R->names[j]=R->names[j+1];
6057 R->names=(char**)omReallocSize(R->names,r->N*sizeof(char_ptr),R->N*sizeof(char_ptr));
6058 }
6059 i--;
6060 }
6061 R->block1[p]=R->N;
6062 rComplete(R,1);
6063 return R;
6064}
#define omReallocSize(addr, o_size, size)
char * char_ptr
Definition structs.h:49

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

2760{
2761 assume (r != NULL );
2762 assume (exp_limit > 1);
2763 BOOLEAN omitted_degree = FALSE;
2764
2765 int bits;
2766 exp_limit=rGetExpSize(exp_limit, bits, r->N);
2767 BOOLEAN need_other_ring = (exp_limit != r->bitmask);
2768
2769 int iNeedInducedOrderingSetup = 0; ///< How many induced ordering block do we have?
2770
2771 int nblocks=rBlocks(r);
2772 rRingOrder_t *order=(rRingOrder_t*)omAlloc0((nblocks+1)*sizeof(rRingOrder_t));
2773 int *block0=(int*)omAlloc0((nblocks+1)*sizeof(int));
2774 int *block1=(int*)omAlloc0((nblocks+1)*sizeof(int));
2775 int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int *));
2776
2777 int i=0;
2778 int j=0; /* i index in r, j index in res */
2779
2780 for( rRingOrder_t r_ord=r->order[i]; (r_ord != (rRingOrder_t)0) && (i < nblocks); j++, r_ord=r->order[++i])
2781 {
2782 BOOLEAN copy_block_index=TRUE;
2783
2784 if (r->block0[i]==r->block1[i])
2785 {
2786 switch(r_ord)
2787 {
2788 case ringorder_wp:
2789 case ringorder_dp:
2790 case ringorder_Wp:
2791 case ringorder_Dp:
2792 r_ord=ringorder_lp;
2793 break;
2794 case ringorder_Ws:
2795 case ringorder_Ds:
2796 case ringorder_ws:
2797 case ringorder_ds:
2798 r_ord=ringorder_ls;
2799 break;
2800 default:
2801 break;
2802 }
2803 }
2804 switch(r_ord)
2805 {
2806 case ringorder_S:
2807 {
2808#ifndef SING_NDEBUG
2809 Warn("Error: unhandled ordering in rModifyRing: ringorder_S = [%d]", r_ord);
2810#endif
2811 order[j]=r_ord; /*r->order[i];*/
2812 break;
2813 }
2814 case ringorder_C:
2815 case ringorder_c:
2816 if (!try_omit_comp)
2817 {
2818 order[j]=r_ord; /*r->order[i]*/;
2819 }
2820 else
2821 {
2822 j--;
2823 need_other_ring=TRUE;
2824 try_omit_comp=FALSE;
2825 copy_block_index=FALSE;
2826 }
2827 break;
2828 case ringorder_wp:
2829 case ringorder_dp:
2830 case ringorder_ws:
2831 case ringorder_ds:
2832 if(!omit_degree)
2833 {
2834 order[j]=r_ord; /*r->order[i]*/;
2835 }
2836 else
2837 {
2838 order[j]=ringorder_rs;
2839 need_other_ring=TRUE;
2840 omit_degree=FALSE;
2841 omitted_degree = TRUE;
2842 }
2843 break;
2844 case ringorder_Wp:
2845 case ringorder_Dp:
2846 case ringorder_Ws:
2847 case ringorder_Ds:
2848 if(!omit_degree)
2849 {
2850 order[j]=r_ord; /*r->order[i];*/
2851 }
2852 else
2853 {
2854 order[j]=ringorder_lp;
2855 need_other_ring=TRUE;
2856 omit_degree=FALSE;
2857 omitted_degree = TRUE;
2858 }
2859 break;
2860 case ringorder_IS:
2861 {
2862 if (try_omit_comp)
2863 {
2864 // tried, but cannot omit component due to the ordering block [%d]: %d (ringorder_IS)", i, r_ord
2865 try_omit_comp = FALSE;
2866 }
2867 order[j]=r_ord; /*r->order[i];*/
2868 iNeedInducedOrderingSetup++;
2869 break;
2870 }
2871 case ringorder_s:
2872 {
2873 assume((i == 0) && (j == 0));
2874 if (try_omit_comp)
2875 {
2876 // tried, but cannot omit component due to the ordering block [%d]: %d (ringorder_s)", i, r_ord
2877 try_omit_comp = FALSE;
2878 }
2879 order[j]=r_ord; /*r->order[i];*/
2880 break;
2881 }
2882 default:
2883 order[j]=r_ord; /*r->order[i];*/
2884 break;
2885 }
2886 if (copy_block_index)
2887 {
2888 block0[j]=r->block0[i];
2889 block1[j]=r->block1[i];
2890 wvhdl[j]=r->wvhdl[i];
2891 }
2892
2893 // order[j]=ringorder_no; // done by omAlloc0
2894 }
2895 if(!need_other_ring)
2896 {
2897 omFreeSize(order,(nblocks+1)*sizeof(rRingOrder_t));
2898 omFreeSize(block0,(nblocks+1)*sizeof(int));
2899 omFreeSize(block1,(nblocks+1)*sizeof(int));
2900 omFreeSize(wvhdl,(nblocks+1)*sizeof(int *));
2901 return r;
2902 }
2903 ring res=(ring)omAllocBin(sip_sring_bin);
2904 *res = *r; // includes r->options
2905
2906#ifdef HAVE_PLURAL
2907 res->GetNC() = NULL;// to re-create it
2908#endif
2909
2910 // res->qideal, res->idroot ???
2911 res->wvhdl=wvhdl;
2912 res->order=order;
2913 res->block0=block0;
2914 res->block1=block1;
2915 res->bitmask=exp_limit;
2916 res->wanted_maxExp=r->wanted_maxExp;
2917 //int tmpref=r->cf->ref0;
2918 rComplete(res, 1);
2919 //r->cf->ref=tmpref;
2920
2921 // adjust res->pFDeg: if it was changed globally, then
2922 // it must also be changed for new ring
2923 if (r->pFDegOrig != res->pFDegOrig &&
2925 {
2926 // still might need adjustment for weighted orderings
2927 // and omit_degree
2928 res->firstwv = r->firstwv;
2929 res->firstBlockEnds = r->firstBlockEnds;
2930 res->pFDeg = res->pFDegOrig = p_WFirstTotalDegree;
2931 }
2932 if (omitted_degree)
2933 res->pLDeg = r->pLDegOrig;
2934
2935 rOptimizeLDeg(res); // also sets res->pLDegOrig
2936
2937 // set syzcomp
2938 if (res->typ != NULL)
2939 {
2940 if( res->typ[0].ord_typ == ro_syz) // "s" Always on [0] place!
2941 {
2942 res->typ[0] = r->typ[0]; // Copy struct!? + setup the same limit!
2943
2944 if (r->typ[0].data.syz.limit > 0)
2945 {
2946 res->typ[0].data.syz.syz_index
2947 = (int*) omAlloc((r->typ[0].data.syz.limit +1)*sizeof(int));
2948 memcpy(res->typ[0].data.syz.syz_index, r->typ[0].data.syz.syz_index,
2949 (r->typ[0].data.syz.limit +1)*sizeof(int));
2950 }
2951 }
2952
2953 if( iNeedInducedOrderingSetup > 0 )
2954 {
2955 for(j = 0, i = 0; (i < nblocks) && (iNeedInducedOrderingSetup > 0); i++)
2956 if( res->typ[i].ord_typ == ro_is ) // Search for suffixes!
2957 {
2958 ideal F = idrHeadR(r->typ[i].data.is.F, r, res); // Copy F from r into res!
2959 assume(
2961 F, // WILL BE COPIED!
2962 r->typ[i].data.is.limit,
2963 j++
2964 )
2965 );
2966 id_Delete(&F, res);
2967 iNeedInducedOrderingSetup--;
2968 }
2969 } // Process all induced Ordering blocks! ...
2970 }
2971 // the special case: homog (omit_degree) and 1 block rs: that is global:
2972 // it comes from dp
2973 res->OrdSgn=r->OrdSgn;
2974
2975
2976#ifdef HAVE_PLURAL
2977 if (rIsPluralRing(r))
2978 {
2979 if ( nc_rComplete(r, res, false) ) // no qideal!
2980 {
2981#ifndef SING_NDEBUG
2982 WarnS("error in nc_rComplete");
2983#endif
2984 // cleanup?
2985
2986// rDelete(res);
2987// return r;
2988
2989 // just go on..
2990 }
2991
2992 if( rIsSCA(r) )
2993 {
2995 WarnS("error in sca_Force!");
2996 }
2997 }
2998#endif
2999
3000 return res;
3001}
#define Warn
Definition emacs.cc:77
bool sca_Force(ring rGR, int b, int e)
Definition sca.cc:1159
#define omAllocBin(bin)
ideal idrHeadR(ideal id, ring r, ring dest_r)
Copy leading terms of id[i] via prHeeadR into dest_r.
Definition prCopy.cc:156
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:5176
static void rOptimizeLDeg(ring r)
Definition ring.cc:3210
BOOLEAN rOrd_is_WeightedDegree_Ordering(const ring r)
Definition ring.cc:2086
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 3052 of file ring.cc.

3053{
3054 simple=TRUE;
3055 if (!rHasSimpleOrder(r))
3056 {
3057 simple=FALSE; // sorting needed
3058 assume (r != NULL );
3059 assume (exp_limit > 1);
3060 int bits;
3061
3062 exp_limit=rGetExpSize(exp_limit, bits, r->N);
3063
3064 int nblocks=1+(ommit_comp!=0);
3065 rRingOrder_t *order=(rRingOrder_t*)omAlloc0((nblocks+1)*sizeof(rRingOrder_t));
3066 int *block0=(int*)omAlloc0((nblocks+1)*sizeof(int));
3067 int *block1=(int*)omAlloc0((nblocks+1)*sizeof(int));
3068 int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int *));
3069
3070 order[0]=ringorder_lp;
3071 block0[0]=1;
3072 block1[0]=r->N;
3073 if (!ommit_comp)
3074 {
3075 order[1]=ringorder_C;
3076 }
3077 ring res=(ring)omAlloc0Bin(sip_sring_bin);
3078 *res = *r;
3079#ifdef HAVE_PLURAL
3080 res->GetNC() = NULL;
3081#endif
3082 // res->qideal, res->idroot ???
3083 res->wvhdl=wvhdl;
3084 res->order=order;
3085 res->block0=block0;
3086 res->block1=block1;
3087 res->bitmask=exp_limit;
3088 res->wanted_maxExp=r->wanted_maxExp;
3089 //int tmpref=r->cf->ref;
3090 rComplete(res, 1);
3091 //r->cf->ref=tmpref;
3092
3093#ifdef HAVE_PLURAL
3094 if (rIsPluralRing(r))
3095 {
3096 if ( nc_rComplete(r, res, false) ) // no qideal!
3097 {
3098#ifndef SING_NDEBUG
3099 WarnS("error in nc_rComplete");
3100#endif
3101 // cleanup?
3102
3103// rDelete(res);
3104// return r;
3105
3106 // just go on..
3107 }
3108 }
3109#endif
3110
3112
3113 return res;
3114 }
3115 return rModifyRing(r, ommit_degree, ommit_comp, exp_limit);
3116}
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition ring.cc:2757

◆ rModifyRing_Wp()

ring rModifyRing_Wp ( ring r,
int * weights )

construct Wp, C ring

Definition at line 3004 of file ring.cc.

3005{
3006 ring res=(ring)omAlloc0Bin(sip_sring_bin);
3007 *res = *r;
3008#ifdef HAVE_PLURAL
3009 res->GetNC() = NULL;
3010#endif
3011
3012 /*weights: entries for 3 blocks: NULL*/
3013 res->wvhdl = (int **)omAlloc0(3 * sizeof(int *));
3014 /*order: Wp,C,0*/
3015 res->order = (rRingOrder_t *) omAlloc(3 * sizeof(rRingOrder_t *));
3016 res->block0 = (int *)omAlloc0(3 * sizeof(int *));
3017 res->block1 = (int *)omAlloc0(3 * sizeof(int *));
3018 /* ringorder Wp for the first block: var 1..r->N */
3019 res->order[0] = ringorder_Wp;
3020 res->block0[0] = 1;
3021 res->block1[0] = r->N;
3022 res->wvhdl[0] = weights;
3023 /* ringorder C for the second block: no vars */
3024 res->order[1] = ringorder_C;
3025 /* the last block: everything is 0 */
3026 res->order[2] = (rRingOrder_t)0;
3027
3028 //int tmpref=r->cf->ref;
3029 rComplete(res, 1);
3030 //r->cf->ref=tmpref;
3031#ifdef HAVE_PLURAL
3032 if (rIsPluralRing(r))
3033 {
3034 if ( nc_rComplete(r, res, false) ) // no qideal!
3035 {
3036#ifndef SING_NDEBUG
3037 WarnS("error in nc_rComplete");
3038#endif
3039 // cleanup?
3040
3041// rDelete(res);
3042// return r;
3043
3044 // just go on..
3045 }
3046 }
3047#endif
3048 return res;
3049}

◆ rOpposite()

ring rOpposite ( ring r)

Definition at line 5425 of file ring.cc.

5429{
5430 if (src == NULL) return(NULL);
5431
5432 //rChangeCurrRing(src);
5433#ifdef RDEBUG
5434 rTest(src);
5435// rWrite(src);
5436// rDebugPrint(src);
5437#endif
5438
5439 ring r = rCopy0(src,FALSE);
5440 if (src->qideal != NULL)
5441 {
5442 id_Delete(&(r->qideal), src);
5443 }
5444
5445 // change vars v1..vN -> vN..v1
5446 int i;
5447 int i2 = (rVar(r)-1)/2;
5448 for(i=i2; i>=0; i--)
5449 {
5450 // index: 0..N-1
5451 //Print("ex var names: %d <-> %d\n",i,rOppVar(r,i));
5452 // exchange names
5453 char *p;
5454 p = r->names[rVar(r)-1-i];
5455 r->names[rVar(r)-1-i] = r->names[i];
5456 r->names[i] = p;
5457 }
5458// i2=(rVar(r)+1)/2;
5459// for(int i=i2; i>0; i--)
5460// {
5461// // index: 1..N
5462// //Print("ex var places: %d <-> %d\n",i,rVar(r)+1-i);
5463// // exchange VarOffset
5464// int t;
5465// t=r->VarOffset[i];
5466// r->VarOffset[i]=r->VarOffset[rOppVar(r,i)];
5467// r->VarOffset[rOppVar(r,i)]=t;
5468// }
5469 // change names:
5470 // TODO: does this work the same way for Letterplace?
5471 for (i=rVar(r)-1; i>=0; i--)
5472 {
5473 char *p=r->names[i];
5474 if(isupper(*p)) *p = tolower(*p);
5475 else *p = toupper(*p);
5476 }
5477 // change ordering: listing
5478 // change ordering: compare
5479// for(i=0; i<r->OrdSize; i++)
5480// {
5481// int t,tt;
5482// switch(r->typ[i].ord_typ)
5483// {
5484// case ro_dp:
5485// //
5486// t=r->typ[i].data.dp.start;
5487// r->typ[i].data.dp.start=rOppVar(r,r->typ[i].data.dp.end);
5488// r->typ[i].data.dp.end=rOppVar(r,t);
5489// break;
5490// case ro_wp:
5491// case ro_wp_neg:
5492// {
5493// t=r->typ[i].data.wp.start;
5494// r->typ[i].data.wp.start=rOppVar(r,r->typ[i].data.wp.end);
5495// r->typ[i].data.wp.end=rOppVar(r,t);
5496// // invert r->typ[i].data.wp.weights
5497// rOppWeight(r->typ[i].data.wp.weights,
5498// r->typ[i].data.wp.end-r->typ[i].data.wp.start);
5499// break;
5500// }
5501// //case ro_wp64:
5502// case ro_syzcomp:
5503// case ro_syz:
5504// WerrorS("not implemented in rOpposite");
5505// // should not happen
5506// break;
5507//
5508// case ro_cp:
5509// t=r->typ[i].data.cp.start;
5510// r->typ[i].data.cp.start=rOppVar(r,r->typ[i].data.cp.end);
5511// r->typ[i].data.cp.end=rOppVar(r,t);
5512// break;
5513// case ro_none:
5514// default:
5515// Werror("unknown type in rOpposite(%d)",r->typ[i].ord_typ);
5516// break;
5517// }
5518// }
5519 // Change order/block structures (needed for rPrint, rAdd etc.)
5520
5521 int j=0;
5522 int l=rBlocks(src);
5523 if ( ! rIsLPRing(src) )
5524 {
5525 // ie Plural or commutative
5526 for(i=0; src->order[i]!=0; i++)
5527 {
5528 switch (src->order[i])
5529 {
5530 case ringorder_c: /* c-> c */
5531 case ringorder_C: /* C-> C */
5532 case ringorder_no /*=0*/: /* end-of-block */
5533 r->order[j]=src->order[i];
5534 j++; break;
5535 case ringorder_lp: /* lp -> rp */
5536 r->order[j]=ringorder_rp;
5537 r->block0[j]=rOppVar(r, src->block1[i]);
5538 r->block1[j]=rOppVar(r, src->block0[i]);
5539 j++;break;
5540 case ringorder_rp: /* rp -> lp */
5541 r->order[j]=ringorder_lp;
5542 r->block0[j]=rOppVar(r, src->block1[i]);
5543 r->block1[j]=rOppVar(r, src->block0[i]);
5544 j++;break;
5545 case ringorder_dp: /* dp -> a(1..1),ls */
5546 {
5547 l=rRealloc1(r,l,j);
5548 r->order[j]=ringorder_a;
5549 r->block0[j]=rOppVar(r, src->block1[i]);
5550 r->block1[j]=rOppVar(r, src->block0[i]);
5551 r->wvhdl[j]=(int*)omAlloc((r->block1[j]-r->block0[j]+1)*sizeof(int));
5552 for(int k=r->block0[j]; k<=r->block1[j]; k++)
5553 r->wvhdl[j][k-r->block0[j]]=1;
5554 j++;
5555 r->order[j]=ringorder_ls;
5556 r->block0[j]=rOppVar(r, src->block1[i]);
5557 r->block1[j]=rOppVar(r, src->block0[i]);
5558 j++;
5559 break;
5560 }
5561 case ringorder_Dp: /* Dp -> a(1..1),rp */
5562 {
5563 l=rRealloc1(r,l,j);
5564 r->order[j]=ringorder_a;
5565 r->block0[j]=rOppVar(r, src->block1[i]);
5566 r->block1[j]=rOppVar(r, src->block0[i]);
5567 r->wvhdl[j]=(int*)omAlloc((r->block1[j]-r->block0[j]+1)*sizeof(int));
5568 for(int k=r->block0[j]; k<=r->block1[j]; k++)
5569 r->wvhdl[j][k-r->block0[j]]=1;
5570 j++;
5571 r->order[j]=ringorder_rp;
5572 r->block0[j]=rOppVar(r, src->block1[i]);
5573 r->block1[j]=rOppVar(r, src->block0[i]);
5574 j++;
5575 break;
5576 }
5577 case ringorder_wp: /* wp -> a(...),ls */
5578 {
5579 l=rRealloc1(r,l,j);
5580 r->order[j]=ringorder_a;
5581 r->block0[j]=rOppVar(r, src->block1[i]);
5582 r->block1[j]=rOppVar(r, src->block0[i]);
5583 r->wvhdl[j]=r->wvhdl[j+1]; r->wvhdl[j+1]=NULL;
5584 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5585 j++;
5586 r->order[j]=ringorder_ls;
5587 r->block0[j]=rOppVar(r, src->block1[i]);
5588 r->block1[j]=rOppVar(r, src->block0[i]);
5589 j++;
5590 break;
5591 }
5592 case ringorder_Wp: /* Wp -> a(...),rp */
5593 {
5594 l=rRealloc1(r,l,j);
5595 r->order[j]=ringorder_a;
5596 r->block0[j]=rOppVar(r, src->block1[i]);
5597 r->block1[j]=rOppVar(r, src->block0[i]);
5598 r->wvhdl[j]=r->wvhdl[j+1]; r->wvhdl[j+1]=NULL;
5599 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5600 j++;
5601 r->order[j]=ringorder_rp;
5602 r->block0[j]=rOppVar(r, src->block1[i]);
5603 r->block1[j]=rOppVar(r, src->block0[i]);
5604 j++;
5605 break;
5606 }
5607 case ringorder_M: /* M -> M */
5608 {
5609 r->order[j]=ringorder_M;
5610 r->block0[j]=rOppVar(r, src->block1[i]);
5611 r->block1[j]=rOppVar(r, src->block0[i]);
5612 int n=r->block1[j]-r->block0[j];
5613 /* M is a (n+1)x(n+1) matrix */
5614 for (int nn=0; nn<=n; nn++)
5615 {
5616 rOppWeight(&(r->wvhdl[j][nn*(n+1)]), n /*r->block1[j]-r->block0[j]*/);
5617 }
5618 j++;
5619 break;
5620 }
5621 case ringorder_a: /* a(...),ls -> wp/dp */
5622 {
5623 r->block0[j]=rOppVar(r, src->block1[i]);
5624 r->block1[j]=rOppVar(r, src->block0[i]);
5625 rOppWeight(r->wvhdl[j], r->block1[j]-r->block0[j]);
5626 if (src->order[i+1]==ringorder_ls)
5627 {
5628 r->order[j]=ringorder_wp;
5629 i++;
5630 //l=rReallocM1(r,l,j);
5631 }
5632 else
5633 {
5634 r->order[j]=ringorder_a;
5635 }
5636 j++;
5637 break;
5638 }
5639 default:
5640 #if 0
5641 // not yet done:
5642 case ringorder_ls:
5643 case ringorder_rs:
5644 case ringorder_ds:
5645 case ringorder_Ds:
5646 case ringorder_ws:
5647 case ringorder_Ws:
5648 case ringorder_am:
5649 case ringorder_a64:
5650 // should not occur:
5651 case ringorder_S:
5652 case ringorder_IS:
5653 case ringorder_s:
5654 case ringorder_aa:
5655 case ringorder_L:
5656 case ringorder_unspec:
5657 #endif
5658 Werror("order %s not (yet) supported", rSimpleOrdStr(src->order[i]));
5659 break;
5660 }
5661 }
5662 } /* end if (!rIsLPRing(src)) */
5663 if (rIsLPRing(src))
5664 {
5665 // applies to Letterplace only
5666 // Letterplace conventions: dp<->Dp, lp<->rp
5667 // Wp(v) cannot be converted since wp(v) does not encode a monomial ordering
5668 // (a(w),<) is troublesome and thus postponed
5669 for(i=0; src->order[i]!=0; i++)
5670 {
5671 switch (src->order[i])
5672 {
5673 case ringorder_c: /* c-> c */
5674 case ringorder_C: /* C-> C */
5675 case ringorder_no /*=0*/: /* end-of-block */
5676 r->order[j]=src->order[i];
5677 j++; break;
5678 case ringorder_lp: /* lp -> rp */
5679 r->order[j]=ringorder_rp;
5680 r->block0[j]=rOppVar(r, src->block1[i]);
5681 r->block1[j]=rOppVar(r, src->block0[i]);
5682 j++;break;
5683 case ringorder_rp: /* rp -> lp */
5684 r->order[j]=ringorder_lp;
5685 r->block0[j]=rOppVar(r, src->block1[i]);
5686 r->block1[j]=rOppVar(r, src->block0[i]);
5687 j++;break;
5688 case ringorder_dp: /* dp -> Dp */
5689 {
5690 r->order[j]=ringorder_Dp;
5691 r->block0[j]=rOppVar(r, src->block1[i]);
5692 r->block1[j]=rOppVar(r, src->block0[i]);
5693 j++;break;
5694 }
5695 case ringorder_Dp: /* Dp -> dp*/
5696 {
5697 r->order[j]=ringorder_dp;
5698 r->block0[j]=rOppVar(r, src->block1[i]);
5699 r->block1[j]=rOppVar(r, src->block0[i]);
5700 j++;break;
5701 }
5702 // not clear how to do:
5703 case ringorder_wp:
5704 case ringorder_Wp:
5705 case ringorder_M:
5706 case ringorder_a:
5707 // not yet done:
5708 case ringorder_ls:
5709 case ringorder_rs:
5710 case ringorder_ds:
5711 case ringorder_Ds:
5712 case ringorder_ws:
5713 case ringorder_Ws:
5714 case ringorder_am:
5715 case ringorder_a64:
5716 case ringorder_Ip:
5717 // should not occur:
5718 case ringorder_S:
5719 case ringorder_IS:
5720 case ringorder_s:
5721 case ringorder_aa:
5722 case ringorder_L:
5723 case ringorder_unspec:
5724 Werror("order %s not (yet) supported", rSimpleOrdStr(src->order[i]));
5725 break;
5726 }
5727 }
5728 } /* end if (rIsLPRing(src)) */
5729 rComplete(r);
5730
5731 //rChangeCurrRing(r);
5732#ifdef RDEBUG
5733 rTest(r);
5734// rWrite(r);
5735// rDebugPrint(r);
5736#endif
5737
5738#ifdef HAVE_PLURAL
5739 // now, we initialize a non-comm structure on r
5740 if (rIsPluralRing(src))
5741 {
5742// assume( currRing == r);
5743
5744 int *perm = (int *)omAlloc0((rVar(r)+1)*sizeof(int));
5745 int *par_perm = NULL;
5746 nMapFunc nMap = n_SetMap(src->cf,r->cf);
5747 int ni,nj;
5748 for(i=1; i<=r->N; i++)
5749 {
5750 perm[i] = rOppVar(r,i);
5751 }
5752
5753 matrix C = mpNew(rVar(r),rVar(r));
5754 matrix D = mpNew(rVar(r),rVar(r));
5755
5756 for (i=1; i< rVar(r); i++)
5757 {
5758 for (j=i+1; j<=rVar(r); j++)
5759 {
5760 ni = r->N +1 - i;
5761 nj = r->N +1 - j; /* i<j ==> nj < ni */
5762
5763 assume(MATELEM(src->GetNC()->C,i,j) != NULL);
5764 MATELEM(C,nj,ni) = p_PermPoly(MATELEM(src->GetNC()->C,i,j),perm,src,r, nMap,par_perm,rPar(src));
5765
5766 if(MATELEM(src->GetNC()->D,i,j) != NULL)
5767 MATELEM(D,nj,ni) = p_PermPoly(MATELEM(src->GetNC()->D,i,j),perm,src,r, nMap,par_perm,rPar(src));
5768 }
5769 }
5770
5771 id_Test((ideal)C, r);
5772 id_Test((ideal)D, r);
5773
5774 if (nc_CallPlural(C, D, NULL, NULL, r, false, false, true, r)) // no qring setup!
5775 WarnS("Error initializing non-commutative multiplication!");
5776
5777#ifdef RDEBUG
5778 rTest(r);
5779// rWrite(r);
5780// rDebugPrint(r);
5781#endif
5782
5783 assume( r->GetNC()->IsSkewConstant == src->GetNC()->IsSkewConstant);
5784
5785 omFreeSize((ADDRESS)perm,(rVar(r)+1)*sizeof(int));
5786 }
5787#endif /* HAVE_PLURAL */
5788
5789 /* now oppose the qideal for qrings */
5790 if (src->qideal != NULL)
5791 {
5792#ifdef HAVE_PLURAL
5793 r->qideal = idOppose(src, src->qideal, r); // into the currRing: r
5794#else
5795 r->qideal = id_Copy(src->qideal, r); // ?
5796#endif
5797
5798#ifdef HAVE_PLURAL
5799 if( rIsPluralRing(r) )
5800 {
5802#ifdef RDEBUG
5803 rTest(r);
5804// rWrite(r);
5805// rDebugPrint(r);
5806#endif
5807 }
5808#endif
5809 }
5810#ifdef HAVE_PLURAL
5811 if( rIsPluralRing(r) )
5812 assume( ncRingType(r) == ncRingType(src) );
5813#endif
5814 rTest(r);
5815
5816 return r;
5817}
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:701
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
#define D(A)
Definition gentable.cc:128
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)
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,...
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
ip_smatrix * matrix
Definition matpol.h:43
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:4211
#define rOppVar(R, I)
Definition ring.cc:5422
const char * rSimpleOrdStr(int ord)
Definition ring.cc:78
static void rOppWeight(int *w, int l)
Definition ring.cc:5409
static int rRealloc1(ring r, int size, int pos)
Definition ring.cc:5386
static int rPar(const ring r)
(r->cf->P)
Definition ring.h:605
#define id_Test(A, lR)

◆ rOrd_is_Comp_dp()

static BOOLEAN rOrd_is_Comp_dp ( const ring r)
inlinestatic

Definition at line 784 of file ring.h.

785{
786 assume(r != NULL);
787 assume(r->cf != NULL);
788 return ((r->order[0] == ringorder_c || r->order[0] == ringorder_C) &&
789 r->order[1] == ringorder_dp &&
790 r->order[2] == 0);
791}

◆ rOrd_is_dp()

BOOLEAN rOrd_is_dp ( const ring r)

Definition at line 2055 of file ring.cc.

2056{
2057 int ord=0;
2058 if ((r->order[0]==ringorder_C)||(r->order[0]==ringorder_c)) ord=1;
2059 return ((rVar(r) > 1) &&
2060 (r->order[ord]==ringorder_dp)
2061 &&(r->block0[ord]==1)
2062 &&(r->block1[ord]==r->N));
2063}

◆ rOrd_is_Ds()

BOOLEAN rOrd_is_Ds ( const ring r)

Definition at line 2075 of file ring.cc.

2076{
2077 int ord=0;
2078 if ((r->order[0]==ringorder_C)||(r->order[0]==ringorder_c)) ord=1;
2079 return ((rVar(r) > 1) &&
2080 (r->order[ord]==ringorder_Ds)
2081 &&(r->block0[ord]==1)
2082 &&(r->block1[ord]==r->N));
2083}

◆ rOrd_is_ds()

BOOLEAN rOrd_is_ds ( const ring r)

Definition at line 2065 of file ring.cc.

2066{
2067 int ord=0;
2068 if ((r->order[0]==ringorder_C)||(r->order[0]==ringorder_c)) ord=1;
2069 return ((rVar(r) > 1) &&
2070 (r->order[ord]==ringorder_ds)
2071 &&(r->block0[ord]==1)
2072 &&(r->block1[ord]==r->N));
2073}

◆ rOrd_is_Totaldegree_Ordering()

BOOLEAN rOrd_is_Totaldegree_Ordering ( const ring r)

Definition at line 2042 of file ring.cc.

2043{
2044 // Hmm.... what about Syz orderings?
2045 return ((rVar(r) > 1) &&
2046 ((rHasSimpleOrder(r) &&
2047 ((rOrder_is_DegOrdering((rRingOrder_t)r->order[0]) ||
2048 rOrder_is_DegOrdering(( rRingOrder_t)r->order[1])))) ||
2049 ((rHasSimpleOrderAA(r) &&
2050 (rOrder_is_DegOrdering((rRingOrder_t)r->order[1]) ||
2051 ((r->order[1]!=0) &&
2052 rOrder_is_DegOrdering((rRingOrder_t)r->order[2])))))));
2053}
BOOLEAN rOrder_is_DegOrdering(const rRingOrder_t order)
Definition ring.cc:1957
BOOLEAN rHasSimpleOrderAA(ring r)
Definition ring.cc:1991

◆ rOrd_SetCompRequiresSetm()

BOOLEAN rOrd_SetCompRequiresSetm ( const ring r)

return TRUE if p_SetComp requires p_Setm

Definition at line 2022 of file ring.cc.

2023{
2024 if (r->typ != NULL)
2025 {
2026 int pos;
2027 for (pos=0;pos<r->OrdSize;pos++)
2028 {
2029 sro_ord* o=&(r->typ[pos]);
2030 if ( (o->ord_typ == ro_syzcomp)
2031 || (o->ord_typ == ro_syz)
2032 || (o->ord_typ == ro_is)
2033 || (o->ord_typ == ro_am)
2034 || (o->ord_typ == ro_isTemp))
2035 return TRUE;
2036 }
2037 }
2038 return FALSE;
2039}
ro_typ ord_typ
Definition ring.h:226

◆ rOrderName()

rRingOrder_t rOrderName ( char * ordername)

Definition at line 512 of file ring.cc.

513{
514 int order=ringorder_unspec;
515 while (order!= 0)
516 {
517 if (strcmp(ordername,rSimpleOrdStr(order))==0)
518 break;
519 order--;
520 }
521 if (order==0) Werror("wrong ring order `%s`",ordername);
522 omFree((ADDRESS)ordername);
523 return (rRingOrder_t)order;
524}

◆ rOrdStr()

char * rOrdStr ( ring r)

Definition at line 526 of file ring.cc.

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

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

◆ rParameter()

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

(r->cf->parameter)

Definition at line 631 of file ring.h.

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

◆ rParStr()

char * rParStr ( ring r)

Definition at line 654 of file ring.cc.

655{
656 if ((r==NULL)||(rParameter(r)==NULL)) return omStrDup("");
657
658 char const * const * const params = rParameter(r);
659
660 int i;
661 int l=2;
662
663 for (i=0; i<rPar(r); i++)
664 {
665 l+=strlen(params[i])+1;
666 }
667 char *s=(char *)omAlloc((long)l);
668 s[0]='\0';
669 for (i=0; i<rPar(r)-1; i++)
670 {
671 strcat(s, params[i]);
672 strcat(s,",");
673 }
674 strcat(s, params[i]);
675 return s;
676}
static char const ** rParameter(const ring r)
(r->cf->parameter)
Definition ring.h:631

◆ rPlusVar()

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

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

Definition at line 5942 of file ring.cc.

5943{
5944 if (r->order[2]!=0)
5945 {
5946 WerrorS("only for rings with an ordering of one block");
5947 return NULL;
5948 }
5949 int p;
5950 if((r->order[0]==ringorder_C)
5951 ||(r->order[0]==ringorder_c))
5952 p=1;
5953 else
5954 p=0;
5955 if((r->order[p]!=ringorder_dp)
5956 && (r->order[p]!=ringorder_Dp)
5957 && (r->order[p]!=ringorder_lp)
5958 && (r->order[p]!=ringorder_rp)
5959 && (r->order[p]!=ringorder_ds)
5960 && (r->order[p]!=ringorder_Ds)
5961 && (r->order[p]!=ringorder_ls))
5962 {
5963 WerrorS("ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5964 return NULL;
5965 }
5966 for(int i=r->N-1;i>=0;i--)
5967 {
5968 if (strcmp(r->names[i],v)==0)
5969 {
5970 Werror("duplicate variable name >>%s<<",v);
5971 return NULL;
5972 }
5973 }
5974 ring R=rCopy0(r);
5975 char **names;
5976 #ifdef HAVE_SHIFTBBA
5977 if (rIsLPRing(r))
5978 {
5979 R->isLPring=r->isLPring+1;
5980 R->N=((r->N)/r->isLPring)+r->N;
5981 names=(char**)omAlloc(R->N*sizeof(char_ptr));
5982 if (left)
5983 {
5984 for(int b=0;b<((r->N)/r->isLPring);b++)
5985 {
5986 names[b*R->isLPring]=omStrDup(v);
5987 for(int i=R->isLPring-1;i>0;i--)
5988 names[i+b*R->isLPring]=R->names[i-1+b*r->isLPring];
5989 }
5990 }
5991 else
5992 {
5993 for(int b=0;b<((r->N)/r->isLPring);b++)
5994 {
5995 names[(b+1)*R->isLPring-1]=omStrDup(v);
5996 for(int i=R->isLPring-2;i>=0;i--)
5997 names[i+b*R->isLPring]=R->names[i+b*r->isLPring];
5998 }
5999 }
6000 }
6001 else
6002 #endif
6003 {
6004 R->N++;
6005 names=(char**)omAlloc(R->N*sizeof(char_ptr));
6006 if (left)
6007 {
6008 names[0]=omStrDup(v);
6009 for(int i=R->N-1;i>0;i--) names[i]=R->names[i-1];
6010 }
6011 else
6012 {
6013 names[R->N-1]=omStrDup(v);
6014 for(int i=R->N-2;i>=0;i--) names[i]=R->names[i];
6015 }
6016 }
6017 omFreeSize(R->names,r->N*sizeof(char_ptr));
6018 R->names=names;
6019 R->block1[p]=R->N;
6020 rComplete(R);
6021 return R;
6022}
CanonicalForm b
Definition cfModGcd.cc:4111

◆ rRing_has_CompLastBlock()

BOOLEAN rRing_has_CompLastBlock ( const ring r)

Definition at line 5329 of file ring.cc.

5330{
5331 assume(r != NULL);
5332 int lb = rBlocks(r) - 2;
5333 return (r->order[lb] == ringorder_c || r->order[lb] == ringorder_C);
5334}

◆ rRing_ord_pure_Dp()

BOOLEAN rRing_ord_pure_Dp ( const ring r)

Definition at line 5346 of file ring.cc.

5347{
5348 if ((r->order[0]==ringorder_Dp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5349 return TRUE;
5350 if (((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C))
5351 && ((r->order[1]==ringorder_Dp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5352 return TRUE;
5353 return FALSE;
5354}

◆ rRing_ord_pure_dp()

BOOLEAN rRing_ord_pure_dp ( const ring r)

Definition at line 5336 of file ring.cc.

5337{
5338 if ((r->order[0]==ringorder_dp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5339 return TRUE;
5340 if (((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C))
5341 && ((r->order[1]==ringorder_dp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5342 return TRUE;
5343 return FALSE;
5344}

◆ rRing_ord_pure_lp()

BOOLEAN rRing_ord_pure_lp ( const ring r)

Definition at line 5356 of file ring.cc.

5357{
5358 if ((r->order[0]==ringorder_lp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5359 return TRUE;
5360 if (((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C))
5361 && ((r->order[1]==ringorder_lp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5362 return TRUE;
5363 return FALSE;
5364}

◆ rRingVar()

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

Definition at line 583 of file ring.h.

584{
585 assume(r != NULL); assume(r->cf != NULL); return r->names[i];
586}

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

1805{
1806 int i, j;
1807
1808 if (r1 == r2) return TRUE;
1809
1810 if (r1 == NULL || r2 == NULL) return FALSE;
1811
1812 if ((r1->cf != r2->cf)
1813 || (rVar(r1) != rVar(r2))
1814 || (r1->OrdSgn != r2->OrdSgn))
1815 return FALSE;
1816
1817 i=0;
1818 while (r1->order[i] != 0)
1819 {
1820 if (r2->order[i] == 0) return FALSE;
1821 if ((r1->order[i] != r2->order[i])
1822 || (r1->block0[i] != r2->block0[i])
1823 || (r1->block1[i] != r2->block1[i]))
1824 return FALSE;
1825 if (r1->wvhdl[i] != NULL)
1826 {
1827 if (r2->wvhdl[i] == NULL)
1828 return FALSE;
1829 for (j=0; j<r1->block1[i]-r1->block0[i]+1; j++)
1830 if (r2->wvhdl[i][j] != r1->wvhdl[i][j])
1831 return FALSE;
1832 }
1833 else if (r2->wvhdl[i] != NULL) return FALSE;
1834 i++;
1835 }
1836 if (r2->order[i] != 0) return FALSE;
1837
1838 // we do not check variable names
1839 // we do not check minpoly/minideal
1840 // we do not check qideal
1841
1842 return TRUE;
1843}

◆ 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 alright!

Definition at line 5176 of file ring.cc.

5177{
5178 // Put the reference set F into the ring -ordering -recor
5179
5180 if (r->typ==NULL)
5181 {
5182 dReportError("Error: WRONG USE of rSetISReference: wrong ring! (typ == NULL)");
5183 return FALSE;
5184 }
5185
5186
5187 int pos = rGetISPos(p, r);
5188
5189 if( pos == -1 )
5190 {
5191 dReportError("Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
5192 return FALSE;
5193 }
5194
5195#if MYTEST
5196 if( i != r->typ[pos].data.is.limit )
5197 Print("Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit, i);
5198#endif
5199
5200 const ideal FF = idrHeadR(F, r, r); // id_Copy(F, r); // ???
5201
5202
5203 if( r->typ[pos].data.is.F != NULL)
5204 {
5205#if MYTEST
5206 PrintS("Deleting old reference set F... \n"); // idShow(r->typ[pos].data.is.F, r); PrintLn();
5207#endif
5208 id_Delete(&r->typ[pos].data.is.F, r);
5209 r->typ[pos].data.is.F = NULL;
5210 }
5211
5212 assume(r->typ[pos].data.is.F == NULL);
5213
5214 r->typ[pos].data.is.F = FF; // F is owened by ring now! TODO: delete at the end!
5215
5216 r->typ[pos].data.is.limit = i; // First induced component
5217
5218#if MYTEST
5219 PrintS("New reference set FF : \n"); idShow(FF, r, r, 1); PrintLn();
5220#endif
5221
5222 return TRUE;
5223}
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:5144
void idShow(const ideal id, const ring lmRing, const ring tailRing, const int debugPrint)

◆ rSetSyzComp()

void rSetSyzComp ( int k,
const ring r )

Definition at line 5230 of file ring.cc.

5231{
5232 if(k < 0)
5233 {
5234 dReportError("rSetSyzComp with negative limit!");
5235 return;
5236 }
5237
5238 assume( k >= 0 );
5239 if (TEST_OPT_PROT) Print("{%d}", k);
5240 if ((r->typ!=NULL) && (r->typ[0].ord_typ==ro_syz))
5241 {
5242 r->block0[0]=r->block1[0] = k;
5243 if( k == r->typ[0].data.syz.limit )
5244 return; // nothing to do
5245
5246 int i;
5247 if (r->typ[0].data.syz.limit == 0)
5248 {
5249 r->typ[0].data.syz.syz_index = (int*) omAlloc0((k+1)*sizeof(int));
5250 r->typ[0].data.syz.syz_index[0] = 0;
5251 r->typ[0].data.syz.curr_index = 1;
5252 }
5253 else
5254 {
5255 r->typ[0].data.syz.syz_index = (int*)
5256 omReallocSize(r->typ[0].data.syz.syz_index,
5257 (r->typ[0].data.syz.limit+1)*sizeof(int),
5258 (k+1)*sizeof(int));
5259 }
5260 for (i=r->typ[0].data.syz.limit + 1; i<= k; i++)
5261 {
5262 r->typ[0].data.syz.syz_index[i] =
5263 r->typ[0].data.syz.curr_index;
5264 }
5265 if(k < r->typ[0].data.syz.limit) // ?
5266 {
5267#ifndef SING_NDEBUG
5268 Warn("rSetSyzComp called with smaller limit (%d) as before (%d)", k, r->typ[0].data.syz.limit);
5269#endif
5270 r->typ[0].data.syz.curr_index = 1 + r->typ[0].data.syz.syz_index[k];
5271 }
5272
5273
5274 r->typ[0].data.syz.limit = k;
5275 r->typ[0].data.syz.curr_index++;
5276 }
5277 else if(
5278 (r->typ!=NULL) &&
5279 (r->typ[0].ord_typ==ro_isTemp)
5280 )
5281 {
5282// (r->typ[currRing->typ[0].data.isTemp.suffixpos].data.is.limit == k)
5283#ifndef SING_NDEBUG
5284 Warn("rSetSyzComp(%d) in an IS ring! Be careful!", k);
5285#endif
5286 }
5287 else if (r->order[0]==ringorder_s)
5288 {
5289 r->block0[0] = r->block1[0] = k;
5290 }
5291 else if (r->order[0]!=ringorder_c)
5292 {
5293 dReportError("syzcomp in incompatible ring");
5294 }
5295#ifdef PDEBUG
5297 pDBsyzComp=k;
5298#endif
5299}
#define EXTERN_VAR
Definition globaldefs.h:6
#define TEST_OPT_PROT
Definition options.h:105
VAR int pDBsyzComp
Definition ring.cc:5226

◆ rSetWeightVec()

void rSetWeightVec ( ring r,
int64 * wv )

Definition at line 5376 of file ring.cc.

5377{
5378 assume(r!=NULL);
5379 assume(r->OrdSize>0);
5380 assume(r->typ[0].ord_typ==ro_wp64);
5381 memcpy(r->typ[0].data.wp64.weights64,wv,r->N*sizeof(int64));
5382}

◆ rShortOut()

static BOOLEAN rShortOut ( const ring r)
inlinestatic

Definition at line 587 of file ring.h.

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

◆ rSimpleOrdStr()

const char * rSimpleOrdStr ( int ord)

Definition at line 78 of file ring.cc.

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

◆ rString()

char * rString ( ring r)

Definition at line 678 of file ring.cc.

679{
680 if ((r!=NULL)&&(r->cf!=NULL))
681 {
682 char *ch=rCharStr(r);
683 char *var=rVarStr(r);
684 char *ord=rOrdStr(r);
685 char *res=(char *)omAlloc(strlen(ch)+strlen(var)+strlen(ord)+9);
686 sprintf(res,"(%s),(%s),(%s)",ch,var,ord);
687 omFree((ADDRESS)ch);
688 omFree((ADDRESS)var);
689 omFree((ADDRESS)ord);
690 return res;
691 }
692 else
693 return omStrDup("undefined");
694}
char * rCharStr(const ring r)
TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
Definition ring.cc:652
char * rOrdStr(ring r)
Definition ring.cc:526
char * rVarStr(ring r)
Definition ring.cc:628

◆ rSum()

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

Definition at line 1407 of file ring.cc.

1408{
1409 if ((r1==NULL)||(r2==NULL)
1410 ||(r1->cf==NULL)||(r2->cf==NULL))
1411 return -1;
1412 if (r1==r2)
1413 {
1414 sum=r1;
1415 rIncRefCnt(r1);
1416 return 0;
1417 }
1418 return rSumInternal(r1,r2,sum,TRUE,FALSE);
1419}
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:754
static ring rIncRefCnt(ring r)
Definition ring.h:849

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

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

◆ rTypeOfMatrixOrder()

int rTypeOfMatrixOrder ( const intvec * order)

Definition at line 186 of file ring.cc.

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

◆ rUnComplete()

void rUnComplete ( ring r)

Definition at line 4057 of file ring.cc.

4058{
4059 if (r == NULL) return;
4060 if (r->VarOffset != NULL)
4061 {
4062 if (r->OrdSize!=0 && r->typ != NULL)
4063 {
4064 for(int i = 0; i < r->OrdSize; i++)
4065 if( r->typ[i].ord_typ == ro_is) // Search for suffixes! (prefix have the same VarOffset)
4066 {
4067 id_Delete(&r->typ[i].data.is.F, r);
4068
4069 if( r->typ[i].data.is.pVarOffset != NULL )
4070 {
4071 omFreeSize((ADDRESS)r->typ[i].data.is.pVarOffset, (r->N +1)*sizeof(int));
4072 }
4073 }
4074 else if (r->typ[i].ord_typ == ro_syz)
4075 {
4076 if(r->typ[i].data.syz.limit > 0)
4077 omFreeSize(r->typ[i].data.syz.syz_index, ((r->typ[i].data.syz.limit) +1)*sizeof(int));
4078 }
4079 else if (r->typ[i].ord_typ == ro_syzcomp)
4080 {
4081 assume( r->typ[i].data.syzcomp.ShiftedComponents == NULL );
4082 assume( r->typ[i].data.syzcomp.Components == NULL );
4083// WarnS( "rUnComplete : ord_typ == ro_syzcomp was unhandled!!! Possibly memory leak!!!" );
4084#ifndef SING_NDEBUG
4085// assume(0);
4086#endif
4087 }
4088
4089 omFreeSize((ADDRESS)r->typ,r->OrdSize*sizeof(sro_ord)); r->typ = NULL;
4090 }
4091
4092 if (r->PolyBin != NULL)
4093 omUnGetSpecBin(&(r->PolyBin));
4094
4095 omFreeSize((ADDRESS)r->VarOffset, (r->N +1)*sizeof(int));
4096 r->VarOffset=NULL;
4097
4098 if (r->ordsgn != NULL && r->CmpL_Size != 0)
4099 {
4100 omFreeSize((ADDRESS)r->ordsgn,r->ExpL_Size*sizeof(long));
4101 r->ordsgn=NULL;
4102 }
4103 if (r->p_Procs != NULL)
4104 {
4105 omFreeSize(r->p_Procs, sizeof(p_Procs_s));
4106 r->p_Procs=NULL;
4107 }
4108 omfreeSize(r->VarL_Offset, r->VarL_Size*sizeof(int));
4109 r->VarL_Offset=NULL;
4110 }
4111 if (r->NegWeightL_Offset!=NULL)
4112 {
4113 omFreeSize(r->NegWeightL_Offset, r->NegWeightL_Size*sizeof(int));
4114 r->NegWeightL_Offset=NULL;
4115 }
4116}
#define omfreeSize(addr, size)
#define omUnGetSpecBin(bin_ptr)
Definition omBin.h:14

◆ rVar()

static short rVar ( const ring r)
inlinestatic

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

Definition at line 598 of file ring.h.

599{
600 assume(r != NULL);
601 return r->N;
602}

◆ rVarStr()

char * rVarStr ( ring r)

Definition at line 628 of file ring.cc.

629{
630 if ((r==NULL)||(r->names==NULL)) return omStrDup("");
631 int i;
632 int l=2;
633 char *s;
634
635 for (i=0; i<r->N; i++)
636 {
637 l+=strlen(r->names[i])+1;
638 }
639 s=(char *)omAlloc((long)l);
640 s[0]='\0';
641 for (i=0; i<r->N-1; i++)
642 {
643 strcat(s,r->names[i]);
644 strcat(s,",");
645 }
646 strcat(s,r->names[i]);
647 return s;
648}

◆ rWrite()

void rWrite ( ring r,
BOOLEAN details = FALSE )

Definition at line 227 of file ring.cc.

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

Variable Documentation

◆ sip_sring_bin

EXTERN_VAR omBin sip_sring_bin

Definition at line 840 of file ring.h.