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

Go to the source code of this file.

Data Structures

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

Macros

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

Typedefs

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

Enumerations

enum  ro_typ {
  ro_dp , ro_wp , ro_am , ro_wp64 ,
  ro_wp_neg , ro_cp , ro_syzcomp , ro_syz ,
  ro_isTemp , ro_is , ro_none
}
 
enum  rRingOrder_t {
  ringorder_no = 0 , ringorder_a , ringorder_a64 , ringorder_c ,
  ringorder_C , ringorder_M , ringorder_S , ringorder_s ,
  ringorder_lp , ringorder_dp , ringorder_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 charrSimpleOrdStr (int ord)
 
rRingOrder_t rOrderName (char *ordername)
 
charrOrdStr (ring r)
 
charrVarStr (ring r)
 
charrCharStr (ring r)
 TODO: make it a virtual method of coeffs, together with: Decompose & Compose, rParameter & rPar.
 
charrString (ring r)
 
int rChar (ring r)
 
charrParStr (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 charrRingVar (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 rHasSimpleLexOrder (const ring r)
 returns TRUE, if simple lp or ls ordering
 
BOOLEAN rHasGlobalOrdering (const ring r)
 
BOOLEAN rHasLocalOrMixedOrdering (const ring r)
 
BOOLEAN rHasMixedOrdering (const ring r)
 
BOOLEAN rOrd_is_Totaldegree_Ordering (const ring r)
 
BOOLEAN rOrd_is_dp (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 allright!
 
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 118 of file ring.h.

Data Fields
short end
short place
short start

◆ sro_wp

struct sro_wp

Definition at line 127 of file ring.h.

Data Fields
short end
short place
short start
int * weights

◆ sro_am

struct sro_am

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

Data Fields
short end
short place
short start
int64 * weights64

◆ sro_cp

struct sro_cp

Definition at line 162 of file ring.h.

Data Fields
short end
short place
short start

◆ sro_syzcomp

struct sro_syzcomp

Definition at line 171 of file ring.h.

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

◆ sro_syz

struct sro_syz

Definition at line 183 of file ring.h.

Data Fields
int curr_index
int limit
short place
int * syz_index

◆ sro_ISTemp

struct sro_ISTemp

Definition at line 199 of file ring.h.

Data Fields
int * pVarOffset
short start
int suffixpos

◆ sro_IS

struct sro_IS

Definition at line 209 of file ring.h.

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

◆ sro_ord

struct sro_ord

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

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

Macro Definition Documentation

◆ rField_is_Ring

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

Definition at line 490 of file ring.h.

◆ ringorder_rp

#define ringorder_rp   ringorder_ip

Definition at line 99 of file ring.h.

◆ ringorder_rs

#define ringorder_rs   ringorder_is

Definition at line 100 of file ring.h.

◆ rTest

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

Definition at line 791 of file ring.h.

Typedef Documentation

◆ BBA_Proc

Definition at line 249 of file ring.h.

◆ idhdl

Definition at line 21 of file ring.h.

◆ kBucket_pt

Definition at line 25 of file ring.h.

◆ kStrategy

Definition at line 246 of file ring.h.

◆ NF_Proc

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

Definition at line 248 of file ring.h.

◆ p_Procs_s

Definition at line 23 of file ring.h.

◆ p_SetmProc

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

Definition at line 39 of file ring.h.

◆ pFDegProc

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

Definition at line 38 of file ring.h.

◆ pLDegProc

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

Definition at line 37 of file ring.h.

◆ pShallowCopyDeleteProc

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

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

Definition at line 44 of file ring.h.

Enumeration Type Documentation

◆ ro_typ

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

Definition at line 50 of file ring.h.

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

◆ rOrderType_t

Enumerator
rOrderType_General 

non-simple ordering as specified by currRing

rOrderType_CompExp 

simple ordering, component has priority

rOrderType_ExpComp 

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

rOrderType_Exp 

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

rOrderType_Syz 

syzygy ordering

rOrderType_Schreyer 

Schreyer ordering.

rOrderType_Syz2dpc 

syzcomp2dpc

rOrderType_ExpNoComp 

simple ordering, differences in component are not considered

Definition at line 102 of file ring.h.

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

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

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

Function Documentation

◆ n_IsParam()

int n_IsParam ( const number  m,
const ring  r 
)

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

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

Definition at line 5861 of file ring.cc.

5862{
5863 assume(r != NULL);
5864 const coeffs C = r->cf;
5865 assume(C != NULL);
5866
5868
5870
5871 if(( _filed_type == n_algExt )||( _filed_type == n_polyExt ))
5872 return naIsParam(m, C);
5873
5874 if( _filed_type == n_transExt )
5875 return ntIsParam(m, C);
5876
5877 Werror("n_IsParam: IsParam is not to be used for (coeff_type = %d)",getCoeffType(C));
5878
5879 return 0;
5880}
int naIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
Definition algext.cc:1106
int m
Definition cfEzgcd.cc:128
static FORCE_INLINE BOOLEAN nCoeff_is_Extension(const coeffs r)
Definition coeffs.h:850
n_coeffType
Definition coeffs.h:27
@ n_polyExt
used to represent polys as coeffcients
Definition coeffs.h:34
@ n_algExt
used for all algebraic extensions, i.e., the top-most extension in an extension tower is algebraic
Definition coeffs.h:35
@ n_transExt
used for all transcendental extensions, i.e., the top-most extension in an extension tower is transce...
Definition coeffs.h:38
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:429
#define assume(x)
Definition mod2.h:387
The main handler for Singular numbers which are suitable for Singular polynomials.
#define NULL
Definition omList.c:12
void Werror(const char *fmt,...)
Definition reporter.cc:189
int ntIsParam(number m, const coeffs cf)
if m == var(i)/1 => return i,
Definition transext.cc: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 657 of file ring.h.

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

◆ p_DebugPrint()

void p_DebugPrint ( poly  p,
const ring  r 
)

Definition at line 4359 of file ring.cc.

4360{
4361 int i,j;
4362 p_Write(p,r);
4363 j=2;
4364 while(p!=NULL)
4365 {
4366 Print("\nexp[0..%d]\n",r->ExpL_Size-1);
4367 for(i=0;i<r->ExpL_Size;i++)
4368 Print("%ld ",p->exp[i]);
4369 PrintLn();
4370 Print("v0:%ld ",p_GetComp(p, r));
4371 for(i=1;i<=r->N;i++) Print(" v%d:%ld",i,p_GetExp(p,i, r));
4372 PrintLn();
4373 pIter(p);
4374 j--;
4375 if (j==0) { PrintS("...\n"); break; }
4376 }
4377}
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:469
void PrintS(const char *s)
Definition reporter.cc:284
void PrintLn()
Definition reporter.cc:310

◆ p_SetGlobals()

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

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

Definition at line 3431 of file ring.cc.

3432{
3433// // // if (r->ppNoether!=NULL) p_Delete(&r->ppNoether,r); // ???
3434
3435 r->pLexOrder=r->LexOrder;
3436 if (complete)
3437 {
3439 si_opt_1 |= r->options;
3440 }
3441}
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 5069 of file ring.cc.

5070{
5072}
static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
Definition ring.cc:4836

◆ rAssure_c_dp()

ring rAssure_c_dp ( const ring  r)

Definition at line 5074 of file ring.cc.

5075{
5077}

◆ rAssure_CompLastBlock()

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

makes sure that c/C ordering is last ordering

Definition at line 4726 of file ring.cc.

4727{
4728 int last_block = rBlocks(r) - 2;
4729 if (r->order[last_block] != ringorder_c &&
4730 r->order[last_block] != ringorder_C)
4731 {
4732 int c_pos = 0;
4733 int i;
4734
4735 for (i=0; i< last_block; i++)
4736 {
4737 if (r->order[i] == ringorder_c || r->order[i] == ringorder_C)
4738 {
4739 c_pos = i;
4740 break;
4741 }
4742 }
4743 if (c_pos != -1)
4744 {
4745 ring new_r = rCopy0(r, FALSE, TRUE);
4746 for (i=c_pos+1; i<=last_block; i++)
4747 {
4748 new_r->order[i-1] = new_r->order[i];
4749 new_r->block0[i-1] = new_r->block0[i];
4750 new_r->block1[i-1] = new_r->block1[i];
4751 new_r->wvhdl[i-1] = new_r->wvhdl[i];
4752 }
4753 new_r->order[last_block] = r->order[c_pos];
4754 new_r->block0[last_block] = r->block0[c_pos];
4755 new_r->block1[last_block] = r->block1[c_pos];
4756 new_r->wvhdl[last_block] = r->wvhdl[c_pos];
4757 if (complete)
4758 {
4759 rComplete(new_r, 1);
4760
4761#ifdef HAVE_PLURAL
4762 if (rIsPluralRing(r))
4763 {
4764 if ( nc_rComplete(r, new_r, false) ) // no qideal!
4765 {
4766#ifndef SING_NDEBUG
4767 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4768#endif
4769 }
4770 }
4772#endif
4773 }
4774 return new_r;
4775 }
4776 }
4777 return r;
4778}
#define TRUE
Definition auxiliary.h:100
#define FALSE
Definition auxiliary.h:96
#define WarnS
Definition emacs.cc:78
BOOLEAN rComplete(ring r, int force)
this needs to be called whenever a new ring is created: new fields in ring are created (like VarOffse...
Definition ring.cc:3466
BOOLEAN nc_rComplete(const ring src, ring dest, bool bSetupQuotient)
Definition ring.cc:5773
ring rCopy0(const ring r, BOOLEAN copy_qideal, BOOLEAN copy_ordering)
Definition ring.cc:1423
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:405
static int rBlocks(const ring r)
Definition ring.h:573

◆ rAssure_dp_C()

ring rAssure_dp_C ( const ring  r)

Definition at line 5059 of file ring.cc.

5060{
5062}

◆ rAssure_Dp_C()

ring rAssure_Dp_C ( const ring  r)

Definition at line 5064 of file ring.cc.

5065{
5067}

◆ rAssure_dp_S()

ring rAssure_dp_S ( const ring  r)

Definition at line 5054 of file ring.cc.

5055{
5057}

◆ rAssure_HasComp()

ring rAssure_HasComp ( const ring  r)

Definition at line 4657 of file ring.cc.

4658{
4659 int last_block;
4660 int i=0;
4661 do
4662 {
4663 if (r->order[i] == ringorder_c ||
4664 r->order[i] == ringorder_C) return r;
4665 if (r->order[i] == 0)
4666 break;
4667 i++;
4668 } while (1);
4669 //WarnS("re-creating ring with comps");
4670 last_block=i-1;
4671
4672 ring new_r = rCopy0(r, FALSE, FALSE);
4673 i+=2;
4674 new_r->wvhdl=(int **)omAlloc0(i * sizeof(int *));
4675 new_r->order = (rRingOrder_t *) omAlloc0(i * sizeof(rRingOrder_t));
4676 new_r->block0 = (int *) omAlloc0(i * sizeof(int));
4677 new_r->block1 = (int *) omAlloc0(i * sizeof(int));
4678 memcpy(new_r->order,r->order,(i-1) * sizeof(rRingOrder_t));
4679 memcpy(new_r->block0,r->block0,(i-1) * sizeof(int));
4680 memcpy(new_r->block1,r->block1,(i-1) * sizeof(int));
4681 for (int j=0; j<=last_block; j++)
4682 {
4683 if (r->wvhdl[j]!=NULL)
4684 {
4685 #ifdef HAVE_OMALLOC
4686 new_r->wvhdl[j] = (int*) omMemDup(r->wvhdl[j]);
4687 #else
4688 {
4689 int l=r->block1[j]-r->block0[j]+1;
4690 if (r->order[j]==ringorder_a64) l*=2;
4691 else if (r->order[j]==ringorder_M) l=l*l;
4692 else if (r->order[j]==ringorder_am)
4693 {
4694 l+=r->wvhdl[j][r->block1[j]-r->block0[j]+1]+1;
4695 }
4696 new_r->wvhdl[j]=(int*)omalloc(l*sizeof(int));
4697 memcpy(new_r->wvhdl[j],r->wvhdl[j],l*sizeof(int));
4698 }
4699 #endif
4700 }
4701 }
4702 last_block++;
4704 //new_r->block0[last_block]=0;
4705 //new_r->block1[last_block]=0;
4706 //new_r->wvhdl[last_block]=NULL;
4707
4708 rComplete(new_r, 1);
4709
4710#ifdef HAVE_PLURAL
4711 if (rIsPluralRing(r))
4712 {
4713 if ( nc_rComplete(r, new_r, false) ) // no qideal!
4714 {
4715#ifndef SING_NDEBUG
4716 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4717#endif
4718 }
4719 }
4721#endif
4722
4723 return new_r;
4724}
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 4929 of file ring.cc.

4930{ // TODO: ???? Add leading Syz-comp ordering here...????
4931
4932#if MYTEST
4933 Print("rAssure_InducedSchreyerOrdering(r, complete = %d, sgn = %d): r: \n", complete, sgn);
4934 rWrite(r);
4935#ifdef RDEBUG
4936 rDebugPrint(r);
4937#endif
4938 PrintLn();
4939#endif
4940 assume((sgn == 1) || (sgn == -1));
4941
4942 ring res=rCopy0(r, FALSE, FALSE); // No qideal & ordering copy.
4943
4944 int n = rBlocks(r); // Including trailing zero!
4945
4946 // Create 2 more blocks for prefix/suffix:
4947 res->order=(rRingOrder_t *)omAlloc0((n+2)*sizeof(rRingOrder_t)); // 0 .. n+1
4948 res->block0=(int *)omAlloc0((n+2)*sizeof(int));
4949 res->block1=(int *)omAlloc0((n+2)*sizeof(int));
4950 int ** wvhdl =(int **)omAlloc0((n+2)*sizeof(int**));
4951
4952 // Encapsulate all existing blocks between induced Schreyer ordering markers: prefix and suffix!
4953 // Note that prefix and suffix have the same ringorder marker and only differ in block[] parameters!
4954
4955 // new 1st block
4956 int j = 0;
4957 res->order[j] = ringorder_IS; // Prefix
4958 res->block0[j] = res->block1[j] = 0;
4959 // wvhdl[j] = NULL;
4960 j++;
4961
4962 for(int i = 0; (i <= n) && (r->order[i] != 0); i++, j++) // i = [0 .. n-1] <- non-zero old blocks
4963 {
4964 res->order [j] = r->order [i];
4965 res->block0[j] = r->block0[i];
4966 res->block1[j] = r->block1[i];
4967
4968 if (r->wvhdl[i] != NULL)
4969 {
4970 #ifdef HAVE_OMALLOC
4971 wvhdl[j] = (int*) omMemDup(r->wvhdl[i]);
4972 #else
4973 {
4974 int l=(r->block1[i]-r->block0[i]+1);
4975 if (r->order[i]==ringorder_a64) l*=2;
4976 else if (r->order[i]==ringorder_M) l=l*l;
4977 else if (r->order[i]==ringorder_am)
4978 {
4979 l+=r->wvhdl[i][r->block1[i]-r->block0[i]+1]+1;
4980 }
4981 wvhdl[j]=(int*)omalloc(l*sizeof(int));
4982 memcpy(wvhdl[j],r->wvhdl[i],l*sizeof(int));
4983 }
4984 #endif
4985 } // else wvhdl[j] = NULL;
4986 }
4987
4988 // new last block
4989 res->order [j] = ringorder_IS; // Suffix
4990 res->block0[j] = res->block1[j] = sgn; // Sign of v[o]: 1 for C, -1 for c
4991 // wvhdl[j] = NULL;
4992 j++;
4993
4994 // res->order [j] = 0; // The End!
4995 res->wvhdl = wvhdl;
4996
4997 // j == the last zero block now!
4998 assume(j == (n+1));
4999 assume(res->order[0]==ringorder_IS);
5000 assume(res->order[j-1]==ringorder_IS);
5001 assume(res->order[j]==0);
5002
5003
5004 if (complete)
5005 {
5006 rComplete(res, 1);
5007
5008#ifdef HAVE_PLURAL
5009 if (rIsPluralRing(r))
5010 {
5011 if ( nc_rComplete(r, res, false) ) // no qideal!
5012 {
5013#ifndef SING_NDEBUG
5014 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
5015#endif
5016 }
5017 }
5019#endif
5020
5021
5022#ifdef HAVE_PLURAL
5023 ring old_ring = r;
5024#endif
5025
5026 if (r->qideal!=NULL)
5027 {
5028 res->qideal= idrCopyR_NoSort(r->qideal, r, res);
5029
5030 assume(id_RankFreeModule(res->qideal, res) == 0);
5031
5032#ifdef HAVE_PLURAL
5033 if( rIsPluralRing(res) )
5034 if( nc_SetupQuotient(res, r, true) )
5035 {
5036// WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
5037 }
5038
5039#endif
5040 assume(id_RankFreeModule(res->qideal, res) == 0);
5041 }
5042
5043#ifdef HAVE_PLURAL
5044 assume((res->qideal==NULL) == (old_ring->qideal==NULL));
5048#endif
5049 }
5050
5051 return res;
5052}
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:4154
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 4467 of file ring.cc.

4468{
4469 if ( r->order[0] == ringorder_s ) return r;
4470
4471 if ( r->order[0] == ringorder_IS )
4472 {
4473#ifndef SING_NDEBUG
4474 WarnS("rAssure_SyzComp: input ring has an IS-ordering!");
4475#endif
4476// return r;
4477 }
4478 ring res=rCopy0(r, FALSE, FALSE);
4479 int i=rBlocks(r);
4480 int j;
4481
4482 res->order=(rRingOrder_t *)omAlloc((i+1)*sizeof(rRingOrder_t));
4483 res->block0=(int *)omAlloc0((i+1)*sizeof(int));
4484 res->block1=(int *)omAlloc0((i+1)*sizeof(int));
4485 int ** wvhdl =(int **)omAlloc0((i+1)*sizeof(int**));
4486 for(j=i;j>0;j--)
4487 {
4488 res->order[j]=r->order[j-1];
4489 res->block0[j]=r->block0[j-1];
4490 res->block1[j]=r->block1[j-1];
4491 if (r->wvhdl[j-1] != NULL)
4492 {
4493 #ifdef HAVE_OMALLOC
4494 wvhdl[j] = (int*) omMemDup(r->wvhdl[j-1]);
4495 #else
4496 {
4497 int l=r->block1[j-1]-r->block0[j-1]+1;
4498 if (r->order[j-1]==ringorder_a64) l*=2;
4499 else if (r->order[j-1]==ringorder_M) l=l*l;
4500 else if (r->order[j-1]==ringorder_am)
4501 {
4502 l+=r->wvhdl[j-1][r->block1[j-1]-r->block0[j-1]+1]+1;
4503 }
4504 wvhdl[j]=(int*)omalloc(l*sizeof(int));
4505 memcpy(wvhdl[j],r->wvhdl[j-1],l*sizeof(int));
4506 }
4507 #endif
4508 }
4509 }
4510 res->order[0]=ringorder_s;
4511
4512 res->wvhdl = wvhdl;
4513
4514 if (complete)
4515 {
4516 rComplete(res, 1);
4517#ifdef HAVE_PLURAL
4518 if (rIsPluralRing(r))
4519 {
4520 if ( nc_rComplete(r, res, false) ) // no qideal!
4521 {
4522#ifndef SING_NDEBUG
4523 WarnS("error in nc_rComplete"); // cleanup?// rDelete(res);// return r; // just go on..
4524#endif
4525 }
4526 }
4528#endif
4529
4530#ifdef HAVE_PLURAL
4531 ring old_ring = r;
4532#endif
4533 if (r->qideal!=NULL)
4534 {
4535 res->qideal= idrCopyR_NoSort(r->qideal, r, res);
4536 assume(id_RankFreeModule(res->qideal, res) == 0);
4537#ifdef HAVE_PLURAL
4538 if( rIsPluralRing(res) )
4539 {
4540 if( nc_SetupQuotient(res, r, true) )
4541 {
4542// WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
4543 }
4544 assume(id_RankFreeModule(res->qideal, res) == 0);
4545 }
4546#endif
4547 }
4548
4549#ifdef HAVE_PLURAL
4550 assume((res->qideal==NULL) == (old_ring->qideal==NULL));
4554#endif
4555 }
4556 return res;
4557}
#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 4781 of file ring.cc.

4782{
4783 rTest(r);
4784
4785 ring new_r_1 = rAssure_CompLastBlock(r, FALSE); // due to this FALSE - no completion!
4786 ring new_r = rAssure_SyzComp(new_r_1, FALSE); // new_r_1 is used only here!!!
4787
4788 if (new_r == r)
4789 return r;
4790
4791 ring old_r = r;
4792 if (new_r_1 != new_r && new_r_1 != old_r) rDelete(new_r_1);
4793
4795#ifdef HAVE_PLURAL
4796 if (rIsPluralRing(old_r))
4797 {
4798 if ( nc_rComplete(old_r, new_r, false) ) // no qideal!
4799 {
4800# ifndef SING_NDEBUG
4801 WarnS("error in nc_rComplete"); // cleanup? rDelete(res); return r; // just go on...?
4802# endif
4803 }
4804 }
4805#endif
4806
4807///? rChangeCurrRing(new_r);
4808 if (old_r->qideal != NULL)
4809 {
4810 new_r->qideal = idrCopyR(old_r->qideal, old_r, new_r);
4811 }
4812
4813#ifdef HAVE_PLURAL
4814 if( rIsPluralRing(old_r) )
4815 if( nc_SetupQuotient(new_r, old_r, true) )
4816 {
4817#ifndef SING_NDEBUG
4818 WarnS("error in nc_SetupQuotient"); // cleanup? rDelete(res); return r; // just go on...?
4819#endif
4820 }
4821#endif
4822
4823#ifdef HAVE_PLURAL
4824 assume((new_r->qideal==NULL) == (old_r->qideal==NULL));
4828#endif
4829
4830 rTest(new_r);
4831 rTest(old_r);
4832 return new_r;
4833}
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:4467
void rDelete(ring r)
unconditionally deletes fields in r
Definition ring.cc:452
ring rAssure_CompLastBlock(ring r, BOOLEAN complete)
makes sure that c/C ordering is last ordering
Definition ring.cc:4726
#define rTest(r)
Definition ring.h:791

◆ rAssure_SyzOrder()

ring rAssure_SyzOrder ( const ring  r,
BOOLEAN  complete 
)

Definition at line 4462 of file ring.cc.

4463{
4464 if ( r->order[0] == ringorder_c ) return r;
4465 return rAssure_SyzComp(r,complete);
4466}

◆ rAssure_TDeg()

ring rAssure_TDeg ( const ring  r,
int pos 
)

Definition at line 4559 of file ring.cc.

4560{
4561 if (r->N==1) // special: dp(1)==lp(1)== no entry in typ
4562 {
4563 pos=r->VarL_LowIndex;
4564 return r;
4565 }
4566 if (r->typ!=NULL)
4567 {
4568 for(int i=r->OrdSize-1;i>=0;i--)
4569 {
4570 if ((r->typ[i].ord_typ==ro_dp)
4571 && (r->typ[i].data.dp.start==1)
4572 && (r->typ[i].data.dp.end==r->N))
4573 {
4574 pos=r->typ[i].data.dp.place;
4575 //printf("no change, pos=%d\n",pos);
4576 return r;
4577 }
4578 }
4579 }
4580
4581#ifdef HAVE_PLURAL
4582 nc_struct* save=r->GetNC();
4583 r->GetNC()=NULL;
4584#endif
4585 ring res=rCopy(r);
4586 if (res->qideal!=NULL)
4587 {
4588 id_Delete(&res->qideal,r);
4589 }
4590
4591 int j;
4592
4593 res->ExpL_Size=r->ExpL_Size+1; // one word more in each monom
4594 res->PolyBin=omGetSpecBin(POLYSIZE + (res->ExpL_Size)*sizeof(long));
4595 omFree((ADDRESS)res->ordsgn);
4596 res->ordsgn=(long *)omAlloc0(res->ExpL_Size*sizeof(long));
4597 for(j=0;j<r->CmpL_Size;j++)
4598 {
4599 res->ordsgn[j] = r->ordsgn[j];
4600 }
4601 res->OrdSize=r->OrdSize+1; // one block more for pSetm
4602 if (r->typ!=NULL)
4603 omFree((ADDRESS)res->typ);
4604 res->typ=(sro_ord*)omAlloc0(res->OrdSize*sizeof(sro_ord));
4605 if (r->typ!=NULL)
4606 memcpy(res->typ,r->typ,r->OrdSize*sizeof(sro_ord));
4607 // the additional block for pSetm: total degree at the last word
4608 // but not included in the compare part
4609 res->typ[res->OrdSize-1].ord_typ=ro_dp;
4610 res->typ[res->OrdSize-1].data.dp.start=1;
4611 res->typ[res->OrdSize-1].data.dp.end=res->N;
4612 res->typ[res->OrdSize-1].data.dp.place=res->ExpL_Size-1;
4613 pos=res->ExpL_Size-1;
4614 //res->pOrdIndex=pos; //NO: think of a(1,0),dp !
4615 extern void p_Setm_General(poly p, ring r);
4616 res->p_Setm=p_Setm_General;
4617 // ----------------------------
4618 omFree((ADDRESS)res->p_Procs);
4619 res->p_Procs = (p_Procs_s*)omAlloc(sizeof(p_Procs_s));
4620
4621 p_ProcsSet(res, res->p_Procs);
4622#ifdef HAVE_PLURAL
4623 r->GetNC()=save;
4624 if (rIsPluralRing(r))
4625 {
4626 if ( nc_rComplete(r, res, false) ) // no qideal!
4627 {
4628#ifndef SING_NDEBUG
4629 WarnS("error in nc_rComplete");
4630#endif
4631 // just go on..
4632 }
4633 }
4634#endif
4635 if (r->qideal!=NULL)
4636 {
4637 res->qideal=idrCopyR_NoSort(r->qideal,r, res);
4638#ifdef HAVE_PLURAL
4639 if (rIsPluralRing(res))
4640 {
4641// nc_SetupQuotient(res, currRing);
4642 nc_SetupQuotient(res, r); // ?
4643 }
4644 assume((res->qideal==NULL) == (r->qideal==NULL));
4645#endif
4646 }
4647
4648#ifdef HAVE_PLURAL
4650 assume(rIsSCA(res) == rIsSCA(r));
4652#endif
4653
4654 return res;
4655}
#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:1733
struct p_Procs_s p_Procs_s
Definition ring.h:23
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 4882 of file ring.cc.

4883{
4884 int r_blocks = rBlocks(r);
4885
4886 if ((r_blocks == 3) &&
4887 (r->order[0] == ringorder_Wp) &&
4888 (r->order[1] == ringorder_C) &&
4889 (r->order[2] == 0))
4890 {
4891 BOOLEAN ok=TRUE;
4892 for(int i=0;i<r->N;i++)
4893 {
4894 if ((*w)[i]!=r->wvhdl[0][i]) { ok=FALSE;break;}
4895 }
4896 if (ok) return r;
4897 }
4898 ring res = rCopy0(r, FALSE, FALSE);
4899 res->order = (rRingOrder_t*)omAlloc0(3*sizeof(rRingOrder_t));
4900 res->block0 = (int*)omAlloc0(3*sizeof(int));
4901 res->block1 = (int*)omAlloc0(3*sizeof(int));
4902 res->wvhdl = (int**)omAlloc0(3*sizeof(int*));
4903 res->order[0] = ringorder_Wp;
4904 res->order[1] = ringorder_C;
4905 res->block0[1] = 1;
4906 res->block1[1] = r->N;
4907 res->wvhdl[0]=(int*)omAlloc(r->N*sizeof(int));
4908 for(int i=0;i<r->N;i++)
4909 {
4910 r->wvhdl[0][i]=(*w)[i];
4911 }
4912 rComplete(res, 1);
4913 if (r->qideal!=NULL) res->qideal= idrCopyR_NoSort(r->qideal, r, res);
4914#ifdef HAVE_PLURAL
4915 if (rIsPluralRing(r))
4916 {
4917 if ( nc_rComplete(r, res, false) ) // no qideal!
4918 {
4919#ifndef SING_NDEBUG
4920 WarnS("error in nc_rComplete");
4921#endif
4922 }
4923 }
4924#endif
4925// rChangeCurrRing(res);
4926 return res;
4927}
int BOOLEAN
Definition auxiliary.h:87
const CanonicalForm & w
Definition facAbsFact.cc:51

◆ rBlocks()

static int rBlocks ( const ring  r)
inlinestatic

Definition at line 573 of file ring.h.

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

◆ rCanShortOut()

static BOOLEAN rCanShortOut ( const ring  r)
inlinestatic

Definition at line 591 of file ring.h.

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

◆ rChangeSComps()

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

Definition at line 4437 of file ring.cc.

4438{
4439#ifdef PDEBUG
4441#else
4443#endif
4444}
static BOOLEAN length(leftv result, leftv arg)
Definition interval.cc:257
static void rNChangeSComps(int *currComponents, long *currShiftedComponents, ring r)
Definition ring.cc:4399
static void rDBChangeSComps(int *currComponents, long *currShiftedComponents, int length, ring r)
Definition ring.cc:4415
EXTERN_VAR long * currShiftedComponents
Definition syz.h:118

◆ rChar()

int rChar ( ring  r)

Definition at line 715 of file ring.cc.

715{ 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 649 of file ring.cc.

649{ 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:963

◆ 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:94
void WerrorS(const char *s)
Definition feFopen.cc:24

◆ rComplete()

BOOLEAN rComplete ( ring  r,
int  force = 0 
)

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

Definition at line 3466 of file ring.cc.

3467{
3468 if (r->VarOffset!=NULL && force == 0) return FALSE;
3469 rSetOutParams(r);
3470 int n=rBlocks(r)-1;
3471 int i;
3472 int bits;
3473 r->bitmask=rGetExpSize(r->wanted_maxExp,bits,r->N);
3474 r->BitsPerExp = bits;
3475 r->ExpPerLong = BIT_SIZEOF_LONG / bits;
3476 r->divmask=rGetDivMask(bits);
3477
3478 // will be used for ordsgn:
3479 long *tmp_ordsgn=(long *)omAlloc0(3*(n+r->N)*sizeof(long));
3480 // will be used for VarOffset:
3481 int *v=(int *)omAlloc((r->N+1)*sizeof(int));
3482 for(i=r->N; i>=0 ; i--)
3483 {
3484 v[i]=-1;
3485 }
3486 sro_ord *tmp_typ=(sro_ord *)omAlloc0(3*(n+r->N)*sizeof(sro_ord));
3487 int typ_i=0;
3488 int prev_ordsgn=0;
3489
3490 // fill in v, tmp_typ, tmp_ordsgn, determine typ_i (== ordSize)
3491 int j=0;
3493
3494 BOOLEAN need_to_add_comp=FALSE; // Only for ringorder_s and ringorder_S!
3495
3496 for(i=0;i<n;i++)
3497 {
3498 tmp_typ[typ_i].order_index=i;
3499 switch (r->order[i])
3500 {
3501 case ringorder_a:
3502 case ringorder_aa:
3503 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3504 r->wvhdl[i]);
3505 typ_i++;
3506 break;
3507
3508 case ringorder_am:
3509 rO_WMDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,tmp_typ[typ_i],
3510 r->wvhdl[i]);
3511 typ_i++;
3512 break;
3513
3514 case ringorder_a64:
3515 rO_WDegree64(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3516 tmp_typ[typ_i], (int64 *)(r->wvhdl[i]));
3517 typ_i++;
3518 break;
3519
3520 case ringorder_c:
3521 rO_Align(j, j_bits);
3523 r->ComponentOrder=1;
3524 break;
3525
3526 case ringorder_C:
3527 rO_Align(j, j_bits);
3529 r->ComponentOrder=-1;
3530 break;
3531
3532 case ringorder_M:
3533 {
3534 int k,l;
3535 k=r->block1[i]-r->block0[i]+1; // number of vars
3536 for(l=0;l<k;l++)
3537 {
3538 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3539 tmp_typ[typ_i],
3540 r->wvhdl[i]+(r->block1[i]-r->block0[i]+1)*l);
3541 typ_i++;
3542 }
3543 break;
3544 }
3545
3546 case ringorder_lp:
3547 rO_LexVars(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3548 tmp_ordsgn,v,bits, -1);
3549 break;
3550
3551 case ringorder_ls:
3552 rO_LexVars_neg(j, j_bits, r->block0[i],r->block1[i], prev_ordsgn,
3553 tmp_ordsgn,v, bits, -1);
3554 break;
3555
3556 case ringorder_is:
3557 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3558 tmp_ordsgn,v, bits, -1);
3559 break;
3560
3561 case ringorder_ip:
3562 rO_LexVars(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3563 tmp_ordsgn,v, bits, -1);
3564 break;
3565
3566 case ringorder_dp:
3567 if (r->block0[i]==r->block1[i])
3568 {
3569 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3570 tmp_ordsgn,v, bits, -1);
3571 }
3572 else
3573 {
3574 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3575 tmp_typ[typ_i]);
3576 typ_i++;
3577 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i]+1,
3578 prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3579 }
3580 break;
3581
3582 case ringorder_Dp:
3583 if (r->block0[i]==r->block1[i])
3584 {
3585 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3586 tmp_ordsgn,v, bits, -1);
3587 }
3588 else
3589 {
3590 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3591 tmp_typ[typ_i]);
3592 typ_i++;
3593 rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3594 tmp_ordsgn,v, bits, r->block1[i]);
3595 }
3596 break;
3597
3598 case ringorder_Ip:
3599 if (r->block0[i]==r->block1[i])
3600 {
3601 rO_LexVars(j, j_bits, r->block0[i],r->block0[i], prev_ordsgn,
3602 tmp_ordsgn,v, bits, -1);
3603 }
3604 else
3605 {
3606 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3607 tmp_typ[typ_i]);
3608 typ_i++;
3609 rO_LexVars(j, j_bits, r->block1[i],r->block0[i], prev_ordsgn,
3610 tmp_ordsgn,v, bits, -1);
3611 }
3612 break;
3613
3614 case ringorder_ds:
3615 if (r->block0[i]==r->block1[i])
3616 {
3617 rO_LexVars_neg(j, j_bits,r->block0[i],r->block1[i],prev_ordsgn,
3618 tmp_ordsgn,v,bits, -1);
3619 }
3620 else
3621 {
3622 rO_TDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3623 tmp_typ[typ_i]);
3624 typ_i++;
3625 rO_LexVars_neg(j, j_bits, r->block1[i],r->block0[i]+1,
3626 prev_ordsgn,tmp_ordsgn,v,bits, r->block0[i]);
3627 }
3628 break;
3629
3630 case ringorder_Ds:
3631 if (r->block0[i]==r->block1[i])
3632 {
3633 rO_LexVars_neg(j, j_bits, r->block0[i],r->block0[i],prev_ordsgn,
3634 tmp_ordsgn,v, bits, -1);
3635 }
3636 else
3637 {
3638 rO_TDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3639 tmp_typ[typ_i]);
3640 typ_i++;
3641 rO_LexVars(j, j_bits, r->block0[i],r->block1[i]-1, prev_ordsgn,
3642 tmp_ordsgn,v, bits, r->block1[i]);
3643 }
3644 break;
3645
3646 case ringorder_wp:
3647 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3648 tmp_typ[typ_i], r->wvhdl[i]);
3649 typ_i++;
3650 { // check for weights <=0
3651 int jj;
3653 for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3654 {
3655 if (r->wvhdl[i][jj]<=0) have_bad_weights=TRUE;
3656 }
3657 if (have_bad_weights)
3658 {
3659 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3660 tmp_typ[typ_i]);
3661 typ_i++;
3662 }
3663 }
3664 if (r->block1[i]!=r->block0[i])
3665 {
3666 rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3667 tmp_ordsgn, v,bits, r->block0[i]);
3668 }
3669 break;
3670
3671 case ringorder_Wp:
3672 rO_WDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3673 tmp_typ[typ_i], r->wvhdl[i]);
3674 typ_i++;
3675 { // check for weights <=0
3676 int jj;
3678 for(jj=r->block1[i]-r->block0[i];jj>=0; jj--)
3679 {
3680 if (r->wvhdl[i][jj]<=0) have_bad_weights=TRUE;
3681 }
3682 if (have_bad_weights)
3683 {
3684 rO_TDegree(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3685 tmp_typ[typ_i]);
3686 typ_i++;
3687 }
3688 }
3689 if (r->block1[i]!=r->block0[i])
3690 {
3691 rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3692 tmp_ordsgn,v, bits, r->block1[i]);
3693 }
3694 break;
3695
3696 case ringorder_ws:
3697 rO_WDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3698 tmp_typ[typ_i], r->wvhdl[i]);
3699 typ_i++;
3700 if (r->block1[i]!=r->block0[i])
3701 {
3702 rO_LexVars_neg(j, j_bits,r->block1[i],r->block0[i]+1, prev_ordsgn,
3703 tmp_ordsgn, v,bits, r->block0[i]);
3704 }
3705 break;
3706
3707 case ringorder_Ws:
3708 rO_WDegree_neg(j,j_bits,r->block0[i],r->block1[i],tmp_ordsgn,
3709 tmp_typ[typ_i], r->wvhdl[i]);
3710 typ_i++;
3711 if (r->block1[i]!=r->block0[i])
3712 {
3713 rO_LexVars(j, j_bits,r->block0[i],r->block1[i]-1, prev_ordsgn,
3714 tmp_ordsgn,v, bits, r->block1[i]);
3715 }
3716 break;
3717
3718 case ringorder_S:
3719 assume(typ_i == 1); // For LaScala3 only: on the 2nd place ([1])!
3720 // TODO: for K[x]: it is 0...?!
3723 r->ComponentOrder=-1;
3724 typ_i++;
3725 break;
3726
3727 case ringorder_s:
3728 assume(typ_i == 0 && j == 0);
3729 rO_Syz(j, j_bits, prev_ordsgn, r->block0[i], tmp_ordsgn, tmp_typ[typ_i]); // set syz-limit?
3731 r->ComponentOrder=-1;
3732 typ_i++;
3733 break;
3734
3735 case ringorder_IS:
3736 {
3737
3738 assume( r->block0[i] == r->block1[i] );
3739 const int s = r->block0[i];
3740 assume( -2 < s && s < 2);
3741
3742 if(s == 0) // Prefix IS
3743 rO_ISPrefix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ[typ_i++]); // What about prev_ordsgn?
3744 else // s = +1 or -1 // Note: typ_i might be incremented here inside!
3745 {
3746 rO_ISSuffix(j, j_bits, prev_ordsgn, tmp_ordsgn, r->N, v, tmp_typ, typ_i, s); // Suffix.
3748 }
3749
3750 break;
3751 }
3752 case ringorder_unspec:
3753 case ringorder_no:
3754 default:
3755 dReportError("undef. ringorder used\n");
3756 break;
3757 }
3758 }
3759 rCheckOrdSgn(r,n-1);
3760
3761 int j0=j; // save j
3762 int j_bits0=j_bits; // save jbits
3763 rO_Align(j,j_bits);
3764 r->CmpL_Size = j;
3765
3766 j_bits=j_bits0; j=j0;
3767
3768 // fill in some empty slots with variables not already covered
3769 // v0 is special, is therefore normally already covered
3770 // now we do have rings without comp...
3771 if((need_to_add_comp) && (v[0]== -1))
3772 {
3773 if (prev_ordsgn==1)
3774 {
3775 rO_Align(j, j_bits);
3777 }
3778 else
3779 {
3780 rO_Align(j, j_bits);
3782 }
3783 }
3784 // the variables
3785 for(i=1 ; i<=r->N ; i++)
3786 {
3787 if(v[i]==(-1))
3788 {
3789 if (prev_ordsgn==1)
3790 {
3792 }
3793 else
3794 {
3796 }
3797 }
3798 }
3799
3800 rO_Align(j,j_bits);
3801 // ----------------------------
3802 // finished with constructing the monomial, computing sizes:
3803
3804 r->ExpL_Size=j;
3805 r->PolyBin = omGetSpecBin(POLYSIZE + (r->ExpL_Size)*sizeof(long));
3806 assume(r->PolyBin != NULL);
3807
3808 // ----------------------------
3809 // indices and ordsgn vector for comparison
3810 //
3811 // r->pCompHighIndex already set
3812 r->ordsgn=(long *)omAlloc0(r->ExpL_Size*sizeof(long));
3813
3814 for(j=0;j<r->CmpL_Size;j++)
3815 {
3816 r->ordsgn[j] = tmp_ordsgn[j];
3817 }
3818
3819 omFreeSize((ADDRESS)tmp_ordsgn,(3*(n+r->N)*sizeof(long)));
3820
3821 // ----------------------------
3822 // description of orderings for setm:
3823 //
3824 r->OrdSize=typ_i;
3825 if (typ_i==0) r->typ=NULL;
3826 else
3827 {
3828 r->typ=(sro_ord*)omAlloc(typ_i*sizeof(sro_ord));
3829 memcpy(r->typ,tmp_typ,typ_i*sizeof(sro_ord));
3830 }
3831 omFreeSize((ADDRESS)tmp_typ,(3*(n+r->N)*sizeof(sro_ord)));
3832
3833 // ----------------------------
3834 // indices for (first copy of ) variable entries in exp.e vector (VarOffset):
3835 r->VarOffset=v;
3836
3837 // ----------------------------
3838 // other indicies
3839 r->pCompIndex=(r->VarOffset[0] & 0xffff); //r->VarOffset[0];
3840 i=0; // position
3841 j=0; // index in r->typ
3842 if (i==r->pCompIndex) i++; // IS???
3843 while ((j < r->OrdSize)
3844 && ((r->typ[j].ord_typ==ro_syzcomp) ||
3845 (r->typ[j].ord_typ==ro_syz) || (r->typ[j].ord_typ==ro_isTemp) || (r->typ[j].ord_typ==ro_is) ||
3846 (r->order[r->typ[j].order_index] == ringorder_aa)))
3847 {
3848 i++; j++;
3849 }
3850
3851 if (i==r->pCompIndex) i++;
3852 r->pOrdIndex=i;
3853
3854 // ----------------------------
3855 rSetDegStuff(r); // OrdSgn etc already set
3856 rSetOption(r);
3857 // ----------------------------
3858 // r->p_Setm
3859 r->p_Setm = p_GetSetmProc(r);
3860
3861 // ----------------------------
3862 // set VarL_*
3863 rSetVarL(r);
3864
3865 // ----------------------------
3866 // right-adjust VarOffset
3868
3869 // ----------------------------
3870 // set NegWeightL*
3871 rSetNegWeight(r);
3872
3873 // ----------------------------
3874 // p_Procs: call AFTER NegWeightL
3875 r->p_Procs = (p_Procs_s*)omAlloc(sizeof(p_Procs_s));
3876 p_ProcsSet(r, r->p_Procs);
3877
3878 // use totaldegree on crazy oderings:
3879 if ((r->pFDeg==p_WTotaldegree) && rOrd_is_MixedDegree_Ordering(r))
3880 r->pFDeg = p_Totaldegree;
3881 return FALSE;
3882}
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:613
p_SetmProc p_GetSetmProc(const ring r)
Definition p_polys.cc:560
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1507
static void rSetNegWeight(ring r)
Definition ring.cc:3363
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:2495
static void rSetOption(ring r)
Definition ring.cc:3400
#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:2305
static void rSetVarL(ring r)
set r->VarL_Size, r->VarL_Offset, r->VarL_LowIndex
Definition ring.cc:4059
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:2355
BOOLEAN rOrd_is_MixedDegree_Ordering(ring r)
Definition ring.cc:3444
static void rSetOutParams(ring r)
Definition ring.cc:3096
static void rSetDegStuff(ring r)
Definition ring.cc:3193
static void rO_WDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition ring.cc:2329
static void rO_Syzcomp(int &place, int &bitplace, int &prev_ord, long *o, sro_ord &ord_struct)
Definition ring.cc:2431
static void rO_TDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
Definition ring.cc:2215
static void rO_WMDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition ring.cc:2283
static void rO_Syz(int &place, int &bitplace, int &prev_ord, int syz_comp, long *o, sro_ord &ord_struct)
Definition ring.cc:2446
static unsigned long rGetExpSize(unsigned long bitmask, int &bits)
Definition ring.cc:2586
static void rCheckOrdSgn(ring r, int i)
Definition ring.cc:3884
static unsigned long rGetDivMask(int bits)
get r->divmask depending on bits per exponent
Definition ring.cc:4140
static void rRightAdjustVarOffset(ring r)
right-adjust r->VarOffset
Definition ring.cc:4114
static void rO_ISPrefix(int &place, int &bitplace, int &prev_ord, long *o, int N, int *v, sro_ord &ord_struct)
Definition ring.cc:2472
static void rO_Align(int &place, int &bitplace)
Definition ring.cc:2204
static void rO_TDegree_neg(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct)
Definition ring.cc:2229
static void rO_WDegree(int &place, int &bitplace, int start, int end, long *o, sro_ord &ord_struct, int *weights)
Definition ring.cc:2243
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:2392

◆ rCopy()

ring rCopy ( ring  r)

Definition at line 1733 of file ring.cc.

1734{
1735 if (r == NULL) return NULL;
1737 rComplete(res, 1); // res is purely commutative so far
1738 if (r->qideal!=NULL) res->qideal=idrCopyR_NoSort(r->qideal, r, res);
1739
1740#ifdef HAVE_PLURAL
1741 if (rIsPluralRing(r))
1742 if( nc_rCopy(res, r, true) ) {}
1743#endif
1744
1745 return res;
1746}
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 1423 of file ring.cc.

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

◆ rCopy0AndAddA()

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

Definition at line 1566 of file ring.cc.

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

◆ rDBTest()

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

Definition at line 2054 of file ring.cc.

2055{
2056 int i,j;
2057
2058 if (r == NULL)
2059 {
2060 dReportError("Null ring in %s:%d", fn, l);
2061 return FALSE;
2062 }
2063
2064
2065 if (r->N == 0) return TRUE;
2066
2067 if ((r->OrdSgn!=1) && (r->OrdSgn!= -1))
2068 {
2069 dReportError("missing OrdSgn in %s:%d", fn, l);
2070 return FALSE;
2071 }
2072
2073// omCheckAddrSize(r,sizeof(ip_sring));
2074#if OM_CHECK > 0
2075 i=rBlocks(r);
2076 omCheckAddrSize(r->order,i*sizeof(int));
2077 omCheckAddrSize(r->block0,i*sizeof(int));
2078 omCheckAddrSize(r->block1,i*sizeof(int));
2079 for(int j=0;j<=i;j++)
2080 {
2081 if((r->order[j]<0)||(r->order[j]>ringorder_unspec))
2082 dError("wrong order in r->order");
2083 }
2084 if (r->wvhdl!=NULL)
2085 {
2086 omCheckAddrSize(r->wvhdl,i*sizeof(int *));
2087 for (j=0;j<i; j++)
2088 {
2089 if (r->wvhdl[j] != NULL) omCheckAddr(r->wvhdl[j]);
2090 }
2091 }
2092#endif
2093 if (r->VarOffset == NULL)
2094 {
2095 dReportError("Null ring VarOffset -- no rComplete (?) in n %s:%d", fn, l);
2096 return FALSE;
2097 }
2098 omCheckAddrSize(r->VarOffset,(r->N+1)*sizeof(int));
2099
2100 if ((r->OrdSize==0)!=(r->typ==NULL))
2101 {
2102 dReportError("mismatch OrdSize and typ-pointer in %s:%d");
2103 return FALSE;
2104 }
2105 omcheckAddrSize(r->typ,r->OrdSize*sizeof(*(r->typ)));
2106 omCheckAddrSize(r->VarOffset,(r->N+1)*sizeof(*(r->VarOffset)));
2107 // test assumptions:
2108 for(i=0;i<=r->N;i++) // for all variables (i = 0..N)
2109 {
2110 if(r->typ!=NULL)
2111 {
2112 for(j=0;j<r->OrdSize;j++) // for all ordering blocks (j =0..OrdSize-1)
2113 {
2114 if(r->typ[j].ord_typ == ro_isTemp)
2115 {
2116 const int p = r->typ[j].data.isTemp.suffixpos;
2117
2118 if(p <= j)
2119 dReportError("ordrec prefix %d is unmatched",j);
2120
2121 assume( p < r->OrdSize );
2122
2123 if(r->typ[p].ord_typ != ro_is)
2124 dReportError("ordrec prefix %d is unmatched (suffix: %d is wrong!!!)",j, p);
2125
2126 // Skip all intermediate blocks for undone variables:
2127 if(r->typ[j].data.isTemp.pVarOffset[i] != -1) // Check i^th variable
2128 {
2129 j = p - 1; // SKIP ALL INTERNAL BLOCKS...???
2130 continue; // To make for check OrdSize bound...
2131 }
2132 }
2133 else if (r->typ[j].ord_typ == ro_is)
2134 {
2135 // Skip all intermediate blocks for undone variables:
2136 if(r->typ[j].data.is.pVarOffset[i] != -1)
2137 {
2138 // TODO???
2139 }
2140
2141 }
2142 else
2143 {
2144 if (r->typ[j].ord_typ==ro_cp)
2145 {
2146 if(((short)r->VarOffset[i]) == r->typ[j].data.cp.place)
2147 dReportError("ordrec %d conflicts with var %d",j,i);
2148 }
2149 else
2150 if ((r->typ[j].ord_typ!=ro_syzcomp)
2151 && (r->VarOffset[i] == r->typ[j].data.dp.place))
2152 dReportError("ordrec %d conflicts with var %d",j,i);
2153 }
2154 }
2155 }
2156 int tmp;
2157 tmp=r->VarOffset[i] & 0xffffff;
2158 #if SIZEOF_LONG == 8
2159 if ((r->VarOffset[i] >> 24) >63)
2160 #else
2161 if ((r->VarOffset[i] >> 24) >31)
2162 #endif
2163 dReportError("bit_start out of range:%d",r->VarOffset[i] >> 24);
2164 if (i > 0 && ((tmp<0) ||(tmp>r->ExpL_Size-1)))
2165 {
2166 dReportError("varoffset out of range for var %d: %d",i,tmp);
2167 }
2168 }
2169 if(r->typ!=NULL)
2170 {
2171 for(j=0;j<r->OrdSize;j++)
2172 {
2173 if ((r->typ[j].ord_typ==ro_dp)
2174 || (r->typ[j].ord_typ==ro_wp)
2175 || (r->typ[j].ord_typ==ro_wp_neg))
2176 {
2177 if (r->typ[j].data.dp.start > r->typ[j].data.dp.end)
2178 dReportError("in ordrec %d: start(%d) > end(%d)",j,
2179 r->typ[j].data.dp.start, r->typ[j].data.dp.end);
2180 if ((r->typ[j].data.dp.start < 1)
2181 || (r->typ[j].data.dp.end > r->N))
2182 dReportError("in ordrec %d: start(%d)<1 or end(%d)>vars(%d)",j,
2183 r->typ[j].data.dp.start, r->typ[j].data.dp.end,r->N);
2184 }
2185 }
2186 }
2187
2188 assume(r != NULL);
2189 assume(r->cf != NULL);
2190
2191 if (nCoeff_is_algExt(r->cf))
2192 {
2193 assume(r->cf->extRing != NULL);
2194 assume(r->cf->extRing->qideal != NULL);
2195 omCheckAddr(r->cf->extRing->qideal->m[0]);
2196 }
2197
2198 //assume(r->cf!=NULL);
2199
2200 return TRUE;
2201}
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition coeffs.h:914
#define omCheckAddr(addr)
#define omCheckAddrSize(addr, size)
#define omcheckAddrSize(addr, size)

◆ rDebugPrint()

void rDebugPrint ( const ring  r)

Definition at line 4154 of file ring.cc.

4155{
4156 if (r==NULL)
4157 {
4158 PrintS("NULL ?\n");
4159 return;
4160 }
4161 // corresponds to ro_typ from ring.h:
4162 const char *TYP[]={"ro_dp","ro_wp","ro_am","ro_wp64","ro_wp_neg","ro_cp",
4163 "ro_syzcomp", "ro_syz", "ro_isTemp", "ro_is", "ro_none"};
4164 int i,j;
4165
4166 Print("ExpL_Size:%d ",r->ExpL_Size);
4167 Print("CmpL_Size:%d ",r->CmpL_Size);
4168 Print("VarL_Size:%d\n",r->VarL_Size);
4169 Print("bitmask=0x%lx (expbound=%ld) \n",r->bitmask, r->bitmask);
4170 Print("divmask=%lx\n", r->divmask);
4171 Print("BitsPerExp=%d ExpPerLong=%d at L[%d]\n", r->BitsPerExp, r->ExpPerLong, r->VarL_Offset[0]);
4172
4173 Print("VarL_LowIndex: %d\n", r->VarL_LowIndex);
4174 PrintS("VarL_Offset:\n");
4175 if (r->VarL_Offset==NULL) PrintS(" NULL");
4176 else
4177 for(j = 0; j < r->VarL_Size; j++)
4178 Print(" VarL_Offset[%d]: %d ", j, r->VarL_Offset[j]);
4179 PrintLn();
4180
4181
4182 PrintS("VarOffset:\n");
4183 if (r->VarOffset==NULL) PrintS(" NULL\n");
4184 else
4185 for(j=0;j<=r->N;j++)
4186 Print(" v%d at e-pos %d, bit %d\n",
4187 j,r->VarOffset[j] & 0xffffff, r->VarOffset[j] >>24);
4188 PrintS("ordsgn:\n");
4189 for(j=0;j<r->CmpL_Size;j++)
4190 Print(" ordsgn %ld at pos %d\n",r->ordsgn[j],j);
4191 Print("OrdSgn:%d\n",r->OrdSgn);
4192 PrintS("ordrec:\n");
4193 for(j=0;j<r->OrdSize;j++)
4194 {
4195 Print(" typ %s", TYP[r->typ[j].ord_typ]);
4196 if (r->typ[j].ord_typ==ro_syz)
4197 {
4198 const short place = r->typ[j].data.syz.place;
4199 const int limit = r->typ[j].data.syz.limit;
4200 const int curr_index = r->typ[j].data.syz.curr_index;
4201 const int* syz_index = r->typ[j].data.syz.syz_index;
4202
4203 Print(" limit %d (place: %d, curr_index: %d), syz_index: ", limit, place, curr_index);
4204
4205 if( syz_index == NULL )
4206 PrintS("(NULL)");
4207 else
4208 {
4209 PrintS("{");
4210 for( i=0; i <= limit; i++ )
4211 Print("%d ", syz_index[i]);
4212 PrintS("}");
4213 }
4214
4215 }
4216 else if (r->typ[j].ord_typ==ro_isTemp)
4217 {
4218 Print(" start (level) %d, suffixpos: %d, VO: ",r->typ[j].data.isTemp.start, r->typ[j].data.isTemp.suffixpos);
4219
4220 }
4221 else if (r->typ[j].ord_typ==ro_is)
4222 {
4223 Print(" start %d, end: %d: ",r->typ[j].data.is.start, r->typ[j].data.is.end);
4224
4225// 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]);
4226
4227 Print(" limit %d",r->typ[j].data.is.limit);
4228#ifndef SING_NDEBUG
4229 //PrintS(" F: ");idShow(r->typ[j].data.is.F, r, r, 1);
4230#endif
4231
4232 PrintLn();
4233 }
4234 else if (r->typ[j].ord_typ==ro_am)
4235 {
4236 Print(" place %d",r->typ[j].data.am.place);
4237 Print(" start %d",r->typ[j].data.am.start);
4238 Print(" end %d",r->typ[j].data.am.end);
4239 Print(" len_gen %d",r->typ[j].data.am.len_gen);
4240 PrintS(" w:");
4241 int l=0;
4242 for(l=r->typ[j].data.am.start;l<=r->typ[j].data.am.end;l++)
4243 Print(" %d",r->typ[j].data.am.weights[l-r->typ[j].data.am.start]);
4244 l=r->typ[j].data.am.end+1;
4245 int ll=r->typ[j].data.am.weights[l-r->typ[j].data.am.start];
4246 PrintS(" m:");
4247 for(int lll=l+1;lll<l+ll+1;lll++)
4248 Print(" %d",r->typ[j].data.am.weights[lll-r->typ[j].data.am.start]);
4249 }
4250 else
4251 {
4252 Print(" place %d",r->typ[j].data.dp.place);
4253
4254 if (r->typ[j].ord_typ!=ro_syzcomp && r->typ[j].ord_typ!=ro_syz)
4255 {
4256 Print(" start %d",r->typ[j].data.dp.start);
4257 Print(" end %d",r->typ[j].data.dp.end);
4258 if ((r->typ[j].ord_typ==ro_wp)
4259 || (r->typ[j].ord_typ==ro_wp_neg))
4260 {
4261 PrintS(" w:");
4262 for(int l=r->typ[j].data.wp.start;l<=r->typ[j].data.wp.end;l++)
4263 Print(" %d",r->typ[j].data.wp.weights[l-r->typ[j].data.wp.start]);
4264 }
4265 else if (r->typ[j].ord_typ==ro_wp64)
4266 {
4267 PrintS(" w64:");
4268 int l;
4269 for(l=r->typ[j].data.wp64.start;l<=r->typ[j].data.wp64.end;l++)
4270 Print(" %ld",(long)(r->typ[j].data.wp64.weights64+l-r->typ[j].data.wp64.start));
4271 }
4272 }
4273 }
4274 PrintLn();
4275 }
4276 Print("pOrdIndex:%d pCompIndex:%d\n", r->pOrdIndex, r->pCompIndex);
4277 Print("OrdSize:%d\n",r->OrdSize);
4278 PrintS("--------------------\n");
4279 for(j=0;j<r->ExpL_Size;j++)
4280 {
4281 Print("L[%d]: ",j);
4282 if (j< r->CmpL_Size)
4283 Print("ordsgn %ld ", r->ordsgn[j]);
4284 else
4285 PrintS("no comp ");
4286 i=1;
4287 for(;i<=r->N;i++)
4288 {
4289 if( (r->VarOffset[i] & 0xffffff) == j )
4290 { Print("v%d at e[%d], bit %d; ", i,r->VarOffset[i] & 0xffffff,
4291 r->VarOffset[i] >>24 ); }
4292 }
4293 if( r->pCompIndex==j ) PrintS("v0; ");
4294 for(i=0;i<r->OrdSize;i++)
4295 {
4296 if (r->typ[i].data.dp.place == j)
4297 {
4298 Print("ordrec:%s (start:%d, end:%d) ",TYP[r->typ[i].ord_typ],
4299 r->typ[i].data.dp.start, r->typ[i].data.dp.end);
4300 }
4301 }
4302
4303 if (j==r->pOrdIndex)
4304 PrintS("pOrdIndex\n");
4305 else
4306 PrintLn();
4307 }
4308 Print("LexOrder:%d, MixedOrder:%d\n",r->LexOrder, r->MixedOrder);
4309
4310 Print("NegWeightL_Size: %d, NegWeightL_Offset: ", r->NegWeightL_Size);
4311 if (r->NegWeightL_Offset==NULL) PrintS(" NULL");
4312 else
4313 for(j = 0; j < r->NegWeightL_Size; j++)
4314 Print(" [%d]: %d ", j, r->NegWeightL_Offset[j]);
4315 PrintLn();
4316
4317 // p_Procs stuff
4319 const char* field;
4320 const char* length;
4321 const char* ord;
4322 p_Debug_GetProcNames(r, &proc_names); // changes p_Procs!!!
4324
4325 Print("p_Spec : %s, %s, %s\n", field, length, ord);
4326 PrintS("p_Procs :\n");
4327 for (i=0; i<(int) (sizeof(p_Procs_s)/sizeof(void*)); i++)
4328 {
4329 Print(" %s,\n", ((char**) &proc_names)[i]);
4330 }
4331
4332 {
4333 PrintLn();
4334 PrintS("pFDeg : ");
4335#define pFDeg_CASE(A) if(r->pFDeg == A) PrintS( "" #A "" )
4339 pFDeg_CASE(p_Deg); else
4340#undef pFDeg_CASE
4341 Print("(%p)", r->pFDeg); // default case
4342
4343 PrintLn();
4344 Print("pLDeg : (%p)", r->pLDeg);
4345 PrintLn();
4346 }
4347 PrintS("pSetm:");
4348 void p_Setm_Dummy(poly p, const ring r);
4349 void p_Setm_TotalDegree(poly p, const ring r);
4350 void p_Setm_WFirstTotalDegree(poly p, const ring r);
4351 void p_Setm_General(poly p, const ring r);
4352 if (r->p_Setm==p_Setm_General) PrintS("p_Setm_General\n");
4353 else if (r->p_Setm==p_Setm_Dummy) PrintS("p_Setm_Dummy\n");
4354 else if (r->p_Setm==p_Setm_TotalDegree) PrintS("p_Setm_Totaldegree\n");
4355 else if (r->p_Setm==p_Setm_WFirstTotalDegree) PrintS("p_Setm_WFirstTotalDegree\n");
4356 else Print("%p\n",r->p_Setm);
4357}
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:554
long p_WFirstTotalDegree(poly p, const ring r)
Definition p_polys.cc:596
void p_Setm_Dummy(poly p, const ring r)
Definition p_polys.cc:541
void p_Setm_TotalDegree(poly p, const ring r)
Definition p_polys.cc:547
long p_Deg(poly a, const ring r)
Definition p_polys.cc:587
#define pFDeg_CASE(A)

◆ rDecRefCnt()

static void rDecRefCnt ( ring  r)
inlinestatic

Definition at line 847 of file ring.h.

847{ 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}
CanonicalForm cf
Definition cfModGcd.cc:4091
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);
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 intializations */
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:419

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

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

◆ rEnvelope()

ring rEnvelope ( ring  r)

Definition at line 5759 of file ring.cc.

5762{
5763 ring Ropp = rOpposite(R);
5764 ring Renv = NULL;
5765 int stat = rSum(R, Ropp, Renv); /* takes care of qideals */
5766 if ( stat <=0 )
5767 WarnS("Error in rEnvelope at rSum");
5768 rTest(Renv);
5769 return Renv;
5770}
int rSum(ring r1, ring r2, ring &sum)
Definition ring.cc:1404
ring rOpposite(ring src)
Definition ring.cc:5365
#define R
Definition sirandom.c:27

◆ rEqual()

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

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

Definition at line 1748 of file ring.cc.

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

558{ 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:910

◆ rField_has_simple_inverse()

static BOOLEAN rField_has_simple_inverse ( const ring  r)
inlinestatic

Definition at line 553 of file ring.h.

554{ 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:906

◆ rField_has_Units()

static BOOLEAN rField_has_Units ( const ring  r)
inlinestatic

Definition at line 495 of file ring.h.

496{ 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:801

◆ rField_is_Domain()

static BOOLEAN rField_is_Domain ( const ring  r)
inlinestatic

Definition at line 492 of file ring.h.

493{ 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:743

◆ rField_is_GF() [1/2]

static BOOLEAN rField_is_GF ( const ring  r)
inlinestatic

Definition at line 526 of file ring.h.

527{ 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:843

◆ rField_is_GF() [2/2]

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

Definition at line 529 of file ring.h.

530{ 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 550 of file ring.h.

551{ 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:898

◆ rField_is_long_R()

static BOOLEAN rField_is_long_R ( const ring  r)
inlinestatic

Definition at line 547 of file ring.h.

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

◆ rField_is_numeric()

static BOOLEAN rField_is_numeric ( const ring  r)
inlinestatic

Definition at line 520 of file ring.h.

521{ 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:836

◆ rField_is_Q()

static BOOLEAN rField_is_Q ( const ring  r)
inlinestatic

Definition at line 511 of file ring.h.

512{ 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:810

◆ rField_is_Q_a()

static BOOLEAN rField_is_Q_a ( const ring  r)
inlinestatic

Definition at line 544 of file ring.h.

545{ 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:889

◆ rField_is_R()

static BOOLEAN rField_is_R ( const ring  r)
inlinestatic

Definition at line 523 of file ring.h.

524{ 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:840

◆ rField_is_Ring_2toM()

static BOOLEAN rField_is_Ring_2toM ( const ring  r)
inlinestatic

Definition at line 484 of file ring.h.

485{ 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:728

◆ rField_is_Ring_PtoM()

static BOOLEAN rField_is_Ring_PtoM ( const ring  r)
inlinestatic

Definition at line 487 of file ring.h.

488{ 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:731

◆ rField_is_Z()

static BOOLEAN rField_is_Z ( const ring  r)
inlinestatic

Definition at line 514 of file ring.h.

515{ 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:820

◆ rField_is_Zn()

static BOOLEAN rField_is_Zn ( const ring  r)
inlinestatic

Definition at line 517 of file ring.h.

518{ 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:830

◆ rField_is_Zp() [1/2]

static BOOLEAN rField_is_Zp ( const ring  r)
inlinestatic

Definition at line 505 of file ring.h.

506{ 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 508 of file ring.h.

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

535{ 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:863

◆ rField_is_Zp_a() [2/2]

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

Definition at line 539 of file ring.h.

540{ 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 561 of file ring.h.

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

◆ rGetCurrSyzLimit()

static int rGetCurrSyzLimit ( const ring  r)
inlinestatic

Definition at line 728 of file ring.h.

729{ 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:725

◆ rGetExpSize()

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

Definition at line 2679 of file ring.cc.

2680{
2681 bitmask =rGetExpSize(bitmask, bits);
2683 int bits1;
2684 loop
2685 {
2686 if (bits == BIT_SIZEOF_LONG-1)
2687 {
2688 bits = BIT_SIZEOF_LONG - 1;
2689 return LONG_MAX;
2690 }
2691 unsigned long bitmask1 =rGetExpSize(bitmask+1, bits1);
2693 if ((((N+vars_per_long-1)/vars_per_long) ==
2695 {
2697 bits=bits1;
2698 bitmask=bitmask1;
2699 }
2700 else
2701 {
2702 return bitmask; /* and bits */
2703 }
2704 }
2705}
#define loop
Definition structs.h:75

◆ rGetISPos()

int rGetISPos ( const int  p,
const ring  r 
)

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

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

Definition at line 5084 of file ring.cc.

5085{
5086 // Put the reference set F into the ring -ordering -recor
5087#if MYTEST
5088 Print("rIsIS(p: %d)\nF:", p);
5089 PrintLn();
5090#endif
5091
5092 if (r->typ==NULL)
5093 {
5094// dReportError("'rIsIS:' Error: wrong ring! (typ == NULL)");
5095 return -1;
5096 }
5097
5098 int j = p; // Which IS record to use...
5099 for( int pos = 0; pos < r->OrdSize; pos++ )
5100 if( r->typ[pos].ord_typ == ro_is)
5101 if( j-- == 0 )
5102 return pos;
5103
5104 return -1;
5105}

◆ rGetMaxSyzComp()

int rGetMaxSyzComp ( int  i,
const ring  r 
)

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

Definition at line 5242 of file ring.cc.

5243{
5244 if ((r->typ!=NULL) && (r->typ[0].ord_typ==ro_syz) &&
5245 r->typ[0].data.syz.limit > 0 && i > 0)
5246 {
5247 assume(i <= r->typ[0].data.syz.limit);
5248 int j;
5249 for (j=0; j<r->typ[0].data.syz.limit; j++)
5250 {
5251 if (r->typ[0].data.syz.syz_index[j] == i &&
5252 r->typ[0].data.syz.syz_index[j+1] != i)
5253 {
5254 assume(r->typ[0].data.syz.syz_index[j+1] == i+1);
5255 return j;
5256 }
5257 }
5258 return r->typ[0].data.syz.limit;
5259 }
5260 else
5261 {
5262 #ifndef SING_NDEBUG
5263 WarnS("rGetMaxSyzComp: order c");
5264 #endif
5265 return 0;
5266 }
5267}

◆ rGetOrderType()

rOrderType_t rGetOrderType ( ring  r)

Definition at line 1842 of file ring.cc.

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

◆ rGetSComps()

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

Definition at line 4446 of file ring.cc.

4447{
4448#ifdef PDEBUG
4450#else
4452#endif
4453}
static void rNGetSComps(int **currComponents, long **currShiftedComponents, ring r)
Definition ring.cc:4407
static void rDBGetSComps(int **currComponents, long **currShiftedComponents, int *length, ring r)
Definition ring.cc:4425

◆ rGetVar()

poly rGetVar ( const int  varIndex,
const ring  r 
)

Definition at line 5851 of file ring.cc.

5852{
5853 poly p = p_ISet(1, r);
5854 p_SetExp(p, varIndex, 1, r);
5855 p_Setm(p, r);
5856 return p;
5857}
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition p_polys.cc:1300
static unsigned long p_SetExp(poly p, const unsigned long e, const unsigned long iBitmask, const int VarOffset)
set a single variable exponent @Note: VarOffset encodes the position in p->exp
Definition p_polys.h:488
static void p_Setm(poly p, const ring r)
Definition p_polys.h:233

◆ rGetWeightVec()

int64 * rGetWeightVec ( const ring  r)

Definition at line 5306 of file ring.cc.

5307{
5308 assume(r!=NULL);
5309 assume(r->OrdSize>0);
5310 int i=0;
5311 while((r->typ[i].ord_typ!=ro_wp64) && (r->typ[i].ord_typ>0)) i++;
5312 if (r->typ[i].ord_typ!=ro_wp64) return NULL; /* should not happen*/
5313 return r->typ[i].data.wp64.weights64;
5314}

◆ rHas_c_Ordering()

BOOLEAN rHas_c_Ordering ( const ring  r)

Definition at line 1885 of file ring.cc.

1886{
1887 return (r->order[0] == ringorder_c);
1888}

◆ rHasGlobalOrdering()

BOOLEAN rHasGlobalOrdering ( const ring  r)
inline

Definition at line 766 of file ring.h.

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

◆ rHasLocalOrMixedOrdering()

BOOLEAN rHasLocalOrMixedOrdering ( const ring  r)
inline

Definition at line 767 of file ring.h.

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

◆ rHasMixedOrdering()

BOOLEAN rHasMixedOrdering ( const ring  r)
inline

Definition at line 768 of file ring.h.

768{ return (r->MixedOrder); }

◆ rHasSimpleLexOrder()

BOOLEAN rHasSimpleLexOrder ( const ring  r)

returns TRUE, if simple lp or ls ordering

Definition at line 1921 of file ring.cc.

1922{
1923 return rHasSimpleOrder(r) &&
1924 (r->order[0] == ringorder_ls ||
1925 r->order[0] == ringorder_lp ||
1926 r->order[1] == ringorder_ls ||
1927 r->order[1] == ringorder_lp);
1928}

◆ rHasSimpleOrder()

BOOLEAN rHasSimpleOrder ( const ring  r)

Definition at line 1889 of file ring.cc.

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

◆ rIncRefCnt()

static ring rIncRefCnt ( ring  r)
inlinestatic

Definition at line 846 of file ring.h.

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

◆ rInternalChar()

static int rInternalChar ( const ring  r)
inlinestatic

Definition at line 694 of file ring.h.

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

◆ rIsLPRing()

static BOOLEAN rIsLPRing ( const ring  r)
inlinestatic

Definition at line 416 of file ring.h.

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

◆ rIsNCRing()

static BOOLEAN rIsNCRing ( const ring  r)
inlinestatic

Definition at line 426 of file ring.h.

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

◆ rIsPluralRing()

static BOOLEAN rIsPluralRing ( const ring  r)
inlinestatic

we must always have this test!

Definition at line 405 of file ring.h.

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

◆ rIsRatGRing()

static BOOLEAN rIsRatGRing ( const ring  r)
inlinestatic

Definition at line 432 of file ring.h.

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

◆ rIsSyzIndexRing()

static BOOLEAN rIsSyzIndexRing ( const ring  r)
inlinestatic

Definition at line 725 of file ring.h.

726{ 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 3085 of file ring.cc.

3086{
3087 rUnComplete(r);
3088 omFree(r->order);
3089 omFree(r->block0);
3090 omFree(r->block1);
3091 omFree(r->wvhdl[0]);
3092 omFree(r->wvhdl);
3094}

◆ rKillModifiedRing()

void rKillModifiedRing ( ring  r)

Definition at line 3075 of file ring.cc.

3076{
3077 rUnComplete(r);
3078 omFree(r->order);
3079 omFree(r->block0);
3080 omFree(r->block1);
3081 omFree(r->wvhdl);
3083}

◆ rMinpolyIsNULL()

static BOOLEAN rMinpolyIsNULL ( const ring  r)
inlinestatic

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

Definition at line 704 of file ring.h.

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

5965{
5966 if (r->order[2]!=0)
5967 {
5968 WerrorS("only for rings with an ordering of one block");
5969 return NULL;
5970 }
5971 int p;
5972 if((r->order[0]==ringorder_C)
5973 ||(r->order[0]==ringorder_c))
5974 p=1;
5975 else
5976 p=0;
5977 if((r->order[p]!=ringorder_dp)
5978 && (r->order[p]!=ringorder_Dp)
5979 && (r->order[p]!=ringorder_lp)
5980 && (r->order[p]!=ringorder_rp)
5981 && (r->order[p]!=ringorder_ds)
5982 && (r->order[p]!=ringorder_Ds)
5983 && (r->order[p]!=ringorder_ls))
5984 {
5985 WerrorS("ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5986 return NULL;
5987 }
5988 ring R=rCopy0(r);
5989 int i=R->N-1;
5990 while(i>=0)
5991 {
5992 if (strcmp(R->names[i],v)==0)
5993 {
5994 R->N--;
5995 omFree(R->names[i]);
5996 for(int j=i;j<R->N;j++) R->names[j]=R->names[j+1];
5997 R->names=(char**)omReallocSize(R->names,r->N*sizeof(char_ptr),R->N*sizeof(char_ptr));
5998 }
5999 i--;
6000 }
6001 R->block1[p]=R->N;
6002 rComplete(R,1);
6003 return R;
6004}
#define omReallocSize(addr, o_size, size)
char * char_ptr
Definition ring.cc:42
#define ringorder_rp
Definition ring.h:99

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

2717{
2718 assume (r != NULL );
2719 assume (exp_limit > 1);
2721
2722 int bits;
2724 BOOLEAN need_other_ring = (exp_limit != r->bitmask);
2725
2726 int iNeedInducedOrderingSetup = 0; ///< How many induced ordering block do we have?
2727
2728 int nblocks=rBlocks(r);
2730 int *block0=(int*)omAlloc0((nblocks+1)*sizeof(int));
2731 int *block1=(int*)omAlloc0((nblocks+1)*sizeof(int));
2732 int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int *));
2733
2734 int i=0;
2735 int j=0; /* i index in r, j index in res */
2736
2737 for( rRingOrder_t r_ord=r->order[i]; (r_ord != (rRingOrder_t)0) && (i < nblocks); j++, r_ord=r->order[++i])
2738 {
2740
2741 if (r->block0[i]==r->block1[i])
2742 {
2743 switch(r_ord)
2744 {
2745 case ringorder_wp:
2746 case ringorder_dp:
2747 case ringorder_Wp:
2748 case ringorder_Dp:
2750 break;
2751 case ringorder_Ws:
2752 case ringorder_Ds:
2753 case ringorder_ws:
2754 case ringorder_ds:
2756 break;
2757 default:
2758 break;
2759 }
2760 }
2761 switch(r_ord)
2762 {
2763 case ringorder_S:
2764 {
2765#ifndef SING_NDEBUG
2766 Warn("Error: unhandled ordering in rModifyRing: ringorder_S = [%d]", r_ord);
2767#endif
2768 order[j]=r_ord; /*r->order[i];*/
2769 break;
2770 }
2771 case ringorder_C:
2772 case ringorder_c:
2773 if (!try_omit_comp)
2774 {
2775 order[j]=r_ord; /*r->order[i]*/;
2776 }
2777 else
2778 {
2779 j--;
2783 }
2784 break;
2785 case ringorder_wp:
2786 case ringorder_dp:
2787 case ringorder_ws:
2788 case ringorder_ds:
2789 if(!omit_degree)
2790 {
2791 order[j]=r_ord; /*r->order[i]*/;
2792 }
2793 else
2794 {
2795 order[j]=ringorder_rs;
2799 }
2800 break;
2801 case ringorder_Wp:
2802 case ringorder_Dp:
2803 case ringorder_Ws:
2804 case ringorder_Ds:
2805 if(!omit_degree)
2806 {
2807 order[j]=r_ord; /*r->order[i];*/
2808 }
2809 else
2810 {
2811 order[j]=ringorder_lp;
2815 }
2816 break;
2817 case ringorder_IS:
2818 {
2819 if (try_omit_comp)
2820 {
2821 // tried, but cannot omit component due to the ordering block [%d]: %d (ringorder_IS)", i, r_ord
2823 }
2824 order[j]=r_ord; /*r->order[i];*/
2826 break;
2827 }
2828 case ringorder_s:
2829 {
2830 assume((i == 0) && (j == 0));
2831 if (try_omit_comp)
2832 {
2833 // tried, but cannot omit component due to the ordering block [%d]: %d (ringorder_s)", i, r_ord
2835 }
2836 order[j]=r_ord; /*r->order[i];*/
2837 break;
2838 }
2839 default:
2840 order[j]=r_ord; /*r->order[i];*/
2841 break;
2842 }
2843 if (copy_block_index)
2844 {
2845 block0[j]=r->block0[i];
2846 block1[j]=r->block1[i];
2847 wvhdl[j]=r->wvhdl[i];
2848 }
2849
2850 // order[j]=ringorder_no; // done by omAlloc0
2851 }
2852 if(!need_other_ring)
2853 {
2854 omFreeSize(order,(nblocks+1)*sizeof(rRingOrder_t));
2855 omFreeSize(block0,(nblocks+1)*sizeof(int));
2856 omFreeSize(block1,(nblocks+1)*sizeof(int));
2857 omFreeSize(wvhdl,(nblocks+1)*sizeof(int *));
2858 return r;
2859 }
2861 *res = *r;
2862
2863#ifdef HAVE_PLURAL
2864 res->GetNC() = NULL;
2865#endif
2866
2867 // res->qideal, res->idroot ???
2868 res->wvhdl=wvhdl;
2869 res->order=order;
2870 res->block0=block0;
2871 res->block1=block1;
2872 res->bitmask=exp_limit;
2873 res->wanted_maxExp=r->wanted_maxExp;
2874 //int tmpref=r->cf->ref0;
2875 rComplete(res, 1);
2876 //r->cf->ref=tmpref;
2877
2878 // adjust res->pFDeg: if it was changed globally, then
2879 // it must also be changed for new ring
2880 if (r->pFDegOrig != res->pFDegOrig &&
2882 {
2883 // still might need adjustment for weighted orderings
2884 // and omit_degree
2885 res->firstwv = r->firstwv;
2886 res->firstBlockEnds = r->firstBlockEnds;
2887 res->pFDeg = res->pFDegOrig = p_WFirstTotalDegree;
2888 }
2889 if (omitted_degree)
2890 res->pLDeg = r->pLDegOrig;
2891
2892 rOptimizeLDeg(res); // also sets res->pLDegOrig
2893
2894 // set syzcomp
2895 if (res->typ != NULL)
2896 {
2897 if( res->typ[0].ord_typ == ro_syz) // "s" Always on [0] place!
2898 {
2899 res->typ[0] = r->typ[0]; // Copy struct!? + setup the same limit!
2900
2901 if (r->typ[0].data.syz.limit > 0)
2902 {
2903 res->typ[0].data.syz.syz_index
2904 = (int*) omAlloc((r->typ[0].data.syz.limit +1)*sizeof(int));
2905 memcpy(res->typ[0].data.syz.syz_index, r->typ[0].data.syz.syz_index,
2906 (r->typ[0].data.syz.limit +1)*sizeof(int));
2907 }
2908 }
2909
2911 {
2912 for(j = 0, i = 0; (i < nblocks) && (iNeedInducedOrderingSetup > 0); i++)
2913 if( res->typ[i].ord_typ == ro_is ) // Search for suffixes!
2914 {
2915 ideal F = idrHeadR(r->typ[i].data.is.F, r, res); // Copy F from r into res!
2916 assume(
2918 F, // WILL BE COPIED!
2919 r->typ[i].data.is.limit,
2920 j++
2921 )
2922 );
2923 id_Delete(&F, res);
2925 }
2926 } // Process all induced Ordering blocks! ...
2927 }
2928 // the special case: homog (omit_degree) and 1 block rs: that is global:
2929 // it comes from dp
2930 res->OrdSgn=r->OrdSgn;
2931
2932
2933#ifdef HAVE_PLURAL
2934 if (rIsPluralRing(r))
2935 {
2936 if ( nc_rComplete(r, res, false) ) // no qideal!
2937 {
2938#ifndef SING_NDEBUG
2939 WarnS("error in nc_rComplete");
2940#endif
2941 // cleanup?
2942
2943// rDelete(res);
2944// return r;
2945
2946 // just go on..
2947 }
2948
2949 if( rIsSCA(r) )
2950 {
2952 WarnS("error in sca_Force!");
2953 }
2954 }
2955#endif
2956
2957 return res;
2958}
#define Warn
Definition emacs.cc:77
bool sca_Force(ring rGR, int b, int e)
Definition sca.cc:1159
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:5116
static void rOptimizeLDeg(ring r)
Definition ring.cc:3166
BOOLEAN rOrd_is_WeightedDegree_Ordering(const ring r)
Definition ring.cc:2043
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 3009 of file ring.cc.

3010{
3011 simple=TRUE;
3012 if (!rHasSimpleOrder(r))
3013 {
3014 simple=FALSE; // sorting needed
3015 assume (r != NULL );
3016 assume (exp_limit > 1);
3017 int bits;
3018
3020
3021 int nblocks=1+(ommit_comp!=0);
3023 int *block0=(int*)omAlloc0((nblocks+1)*sizeof(int));
3024 int *block1=(int*)omAlloc0((nblocks+1)*sizeof(int));
3025 int **wvhdl=(int**)omAlloc0((nblocks+1)*sizeof(int *));
3026
3027 order[0]=ringorder_lp;
3028 block0[0]=1;
3029 block1[0]=r->N;
3030 if (!ommit_comp)
3031 {
3032 order[1]=ringorder_C;
3033 }
3035 *res = *r;
3036#ifdef HAVE_PLURAL
3037 res->GetNC() = NULL;
3038#endif
3039 // res->qideal, res->idroot ???
3040 res->wvhdl=wvhdl;
3041 res->order=order;
3042 res->block0=block0;
3043 res->block1=block1;
3044 res->bitmask=exp_limit;
3045 res->wanted_maxExp=r->wanted_maxExp;
3046 //int tmpref=r->cf->ref;
3047 rComplete(res, 1);
3048 //r->cf->ref=tmpref;
3049
3050#ifdef HAVE_PLURAL
3051 if (rIsPluralRing(r))
3052 {
3053 if ( nc_rComplete(r, res, false) ) // no qideal!
3054 {
3055#ifndef SING_NDEBUG
3056 WarnS("error in nc_rComplete");
3057#endif
3058 // cleanup?
3059
3060// rDelete(res);
3061// return r;
3062
3063 // just go on..
3064 }
3065 }
3066#endif
3067
3069
3070 return res;
3071 }
3073}
ring rModifyRing(ring r, BOOLEAN omit_degree, BOOLEAN try_omit_comp, unsigned long exp_limit)
Definition ring.cc:2714

◆ rModifyRing_Wp()

ring rModifyRing_Wp ( ring  r,
int weights 
)

construct Wp, C ring

Definition at line 2961 of file ring.cc.

2962{
2964 *res = *r;
2965#ifdef HAVE_PLURAL
2966 res->GetNC() = NULL;
2967#endif
2968
2969 /*weights: entries for 3 blocks: NULL*/
2970 res->wvhdl = (int **)omAlloc0(3 * sizeof(int *));
2971 /*order: Wp,C,0*/
2972 res->order = (rRingOrder_t *) omAlloc(3 * sizeof(rRingOrder_t *));
2973 res->block0 = (int *)omAlloc0(3 * sizeof(int *));
2974 res->block1 = (int *)omAlloc0(3 * sizeof(int *));
2975 /* ringorder Wp for the first block: var 1..r->N */
2976 res->order[0] = ringorder_Wp;
2977 res->block0[0] = 1;
2978 res->block1[0] = r->N;
2979 res->wvhdl[0] = weights;
2980 /* ringorder C for the second block: no vars */
2981 res->order[1] = ringorder_C;
2982 /* the last block: everything is 0 */
2983 res->order[2] = (rRingOrder_t)0;
2984
2985 //int tmpref=r->cf->ref;
2986 rComplete(res, 1);
2987 //r->cf->ref=tmpref;
2988#ifdef HAVE_PLURAL
2989 if (rIsPluralRing(r))
2990 {
2991 if ( nc_rComplete(r, res, false) ) // no qideal!
2992 {
2993#ifndef SING_NDEBUG
2994 WarnS("error in nc_rComplete");
2995#endif
2996 // cleanup?
2997
2998// rDelete(res);
2999// return r;
3000
3001 // just go on..
3002 }
3003 }
3004#endif
3005 return res;
3006}

◆ rOpposite()

ring rOpposite ( ring  r)

Definition at line 5365 of file ring.cc.

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

◆ rOrd_is_Comp_dp()

static BOOLEAN rOrd_is_Comp_dp ( const ring  r)
inlinestatic

Definition at line 781 of file ring.h.

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

◆ rOrd_is_dp()

BOOLEAN rOrd_is_dp ( const ring  r)

Definition at line 2028 of file ring.cc.

2029{
2030 return (rVar(r) > 1 &&
2031 ((r->order[0]==ringorder_dp)&&(r->block1[0]==r->N)) ||
2032 ((r->order[1]==ringorder_dp)&&(r->block1[1]==r->N)&&((r->block0[1]==1))));
2033}

◆ rOrd_is_ds()

BOOLEAN rOrd_is_ds ( const ring  r)

Definition at line 2035 of file ring.cc.

2036{
2037 return (rVar(r) > 1 &&
2038 ((r->order[0]==ringorder_ds)&&(r->block1[0]==r->N)) ||
2039 ((r->order[1]==ringorder_ds)&&(r->block1[1]==r->N)&&((r->block0[1]==1))));
2040}

◆ rOrd_is_Totaldegree_Ordering()

BOOLEAN rOrd_is_Totaldegree_Ordering ( const ring  r)

Definition at line 2015 of file ring.cc.

2016{
2017 // Hmm.... what about Syz orderings?
2018 return (rVar(r) > 1 &&
2019 ((rHasSimpleOrder(r) &&
2020 (rOrder_is_DegOrdering((rRingOrder_t)r->order[0]) ||
2021 rOrder_is_DegOrdering(( rRingOrder_t)r->order[1]))) ||
2022 (rHasSimpleOrderAA(r) &&
2023 (rOrder_is_DegOrdering((rRingOrder_t)r->order[1]) ||
2024 ((r->order[1]!=0) &&
2025 rOrder_is_DegOrdering((rRingOrder_t)r->order[2]))))));
2026}
BOOLEAN rOrder_is_DegOrdering(const rRingOrder_t order)
Definition ring.cc:1930
BOOLEAN rHasSimpleOrderAA(ring r)
Definition ring.cc:1964

◆ rOrd_SetCompRequiresSetm()

BOOLEAN rOrd_SetCompRequiresSetm ( const ring  r)

return TRUE if p_SetComp requires p_Setm

Definition at line 1995 of file ring.cc.

1996{
1997 if (r->typ != NULL)
1998 {
1999 int pos;
2000 for (pos=0;pos<r->OrdSize;pos++)
2001 {
2002 sro_ord* o=&(r->typ[pos]);
2003 if ( (o->ord_typ == ro_syzcomp)
2004 || (o->ord_typ == ro_syz)
2005 || (o->ord_typ == ro_is)
2006 || (o->ord_typ == ro_am)
2007 || (o->ord_typ == ro_isTemp))
2008 return TRUE;
2009 }
2010 }
2011 return FALSE;
2012}
ro_typ ord_typ
Definition ring.h:225

◆ rOrderName()

rRingOrder_t rOrderName ( char ordername)

Definition at line 509 of file ring.cc.

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

◆ rOrdStr()

char * rOrdStr ( ring  r)

Definition at line 523 of file ring.cc.

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

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

◆ rParameter()

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

(r->cf->parameter)

Definition at line 630 of file ring.h.

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

◆ rParStr()

char * rParStr ( ring  r)

Definition at line 651 of file ring.cc.

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

◆ rPlusVar()

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

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

Definition at line 5882 of file ring.cc.

5883{
5884 if (r->order[2]!=0)
5885 {
5886 WerrorS("only for rings with an ordering of one block");
5887 return NULL;
5888 }
5889 int p;
5890 if((r->order[0]==ringorder_C)
5891 ||(r->order[0]==ringorder_c))
5892 p=1;
5893 else
5894 p=0;
5895 if((r->order[p]!=ringorder_dp)
5896 && (r->order[p]!=ringorder_Dp)
5897 && (r->order[p]!=ringorder_lp)
5898 && (r->order[p]!=ringorder_rp)
5899 && (r->order[p]!=ringorder_ds)
5900 && (r->order[p]!=ringorder_Ds)
5901 && (r->order[p]!=ringorder_ls))
5902 {
5903 WerrorS("ordering must be dp,Dp,lp,rp,ds,Ds or ls");
5904 return NULL;
5905 }
5906 for(int i=r->N-1;i>=0;i--)
5907 {
5908 if (strcmp(r->names[i],v)==0)
5909 {
5910 Werror("duplicate variable name >>%s<<",v);
5911 return NULL;
5912 }
5913 }
5914 ring R=rCopy0(r);
5915 char **names;
5916 #ifdef HAVE_SHIFTBBA
5917 if (rIsLPRing(r))
5918 {
5919 R->isLPring=r->isLPring+1;
5920 R->N=((r->N)/r->isLPring)+r->N;
5921 names=(char**)omAlloc(R->N*sizeof(char_ptr));
5922 if (left)
5923 {
5924 for(int b=0;b<((r->N)/r->isLPring);b++)
5925 {
5926 names[b*R->isLPring]=omStrDup(v);
5927 for(int i=R->isLPring-1;i>0;i--)
5928 names[i+b*R->isLPring]=R->names[i-1+b*r->isLPring];
5929 }
5930 }
5931 else
5932 {
5933 for(int b=0;b<((r->N)/r->isLPring);b++)
5934 {
5935 names[(b+1)*R->isLPring-1]=omStrDup(v);
5936 for(int i=R->isLPring-2;i>=0;i--)
5937 names[i+b*R->isLPring]=R->names[i+b*r->isLPring];
5938 }
5939 }
5940 }
5941 else
5942 #endif
5943 {
5944 R->N++;
5945 names=(char**)omAlloc(R->N*sizeof(char_ptr));
5946 if (left)
5947 {
5948 names[0]=omStrDup(v);
5949 for(int i=R->N-1;i>0;i--) names[i]=R->names[i-1];
5950 }
5951 else
5952 {
5953 names[R->N-1]=omStrDup(v);
5954 for(int i=R->N-2;i>=0;i--) names[i]=R->names[i];
5955 }
5956 }
5957 omFreeSize(R->names,r->N*sizeof(char_ptr));
5958 R->names=names;
5959 R->block1[p]=R->N;
5960 rComplete(R);
5961 return R;
5962}
CanonicalForm b
Definition cfModGcd.cc:4111

◆ rRing_has_CompLastBlock()

BOOLEAN rRing_has_CompLastBlock ( const ring  r)

Definition at line 5269 of file ring.cc.

5270{
5271 assume(r != NULL);
5272 int lb = rBlocks(r) - 2;
5273 return (r->order[lb] == ringorder_c || r->order[lb] == ringorder_C);
5274}

◆ rRing_ord_pure_dp()

BOOLEAN rRing_ord_pure_dp ( const ring  r)

Definition at line 5276 of file ring.cc.

5277{
5278 if ((r->order[0]==ringorder_dp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5279 return TRUE;
5280 if (((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C))
5281 && ((r->order[1]==ringorder_dp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5282 return TRUE;
5283 return FALSE;
5284}

◆ rRing_ord_pure_Dp()

BOOLEAN rRing_ord_pure_Dp ( const ring  r)

Definition at line 5286 of file ring.cc.

5287{
5288 if ((r->order[0]==ringorder_Dp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5289 return TRUE;
5290 if (((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C))
5291 && ((r->order[1]==ringorder_Dp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5292 return TRUE;
5293 return FALSE;
5294}

◆ rRing_ord_pure_lp()

BOOLEAN rRing_ord_pure_lp ( const ring  r)

Definition at line 5296 of file ring.cc.

5297{
5298 if ((r->order[0]==ringorder_lp) &&(r->block0[0]==1) &&(r->block1[0]==r->N))
5299 return TRUE;
5300 if (((r->order[0]==ringorder_c)||(r->order[0]==ringorder_C))
5301 && ((r->order[1]==ringorder_lp) &&(r->block0[1]==1) &&(r->block1[1]==r->N)))
5302 return TRUE;
5303 return FALSE;
5304}

◆ rRingVar()

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

Definition at line 582 of file ring.h.

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

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

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

◆ rSetISReference()

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

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

Definition at line 5116 of file ring.cc.

5117{
5118 // Put the reference set F into the ring -ordering -recor
5119
5120 if (r->typ==NULL)
5121 {
5122 dReportError("Error: WRONG USE of rSetISReference: wrong ring! (typ == NULL)");
5123 return FALSE;
5124 }
5125
5126
5127 int pos = rGetISPos(p, r);
5128
5129 if( pos == -1 )
5130 {
5131 dReportError("Error: WRONG USE of rSetISReference: specified ordering block was not found!!!" );
5132 return FALSE;
5133 }
5134
5135#if MYTEST
5136 if( i != r->typ[pos].data.is.limit )
5137 Print("Changing record on pos: %d\nOld limit: %d --->> New Limit: %d\n", pos, r->typ[pos].data.is.limit, i);
5138#endif
5139
5140 const ideal FF = idrHeadR(F, r, r); // id_Copy(F, r); // ???
5141
5142
5143 if( r->typ[pos].data.is.F != NULL)
5144 {
5145#if MYTEST
5146 PrintS("Deleting old reference set F... \n"); // idShow(r->typ[pos].data.is.F, r); PrintLn();
5147#endif
5148 id_Delete(&r->typ[pos].data.is.F, r);
5149 r->typ[pos].data.is.F = NULL;
5150 }
5151
5152 assume(r->typ[pos].data.is.F == NULL);
5153
5154 r->typ[pos].data.is.F = FF; // F is owened by ring now! TODO: delete at the end!
5155
5156 r->typ[pos].data.is.limit = i; // First induced component
5157
5158#if MYTEST
5159 PrintS("New reference set FF : \n"); idShow(FF, r, r, 1); PrintLn();
5160#endif
5161
5162 return TRUE;
5163}
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:5084
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 5170 of file ring.cc.

5171{
5172 if(k < 0)
5173 {
5174 dReportError("rSetSyzComp with negative limit!");
5175 return;
5176 }
5177
5178 assume( k >= 0 );
5179 if (TEST_OPT_PROT) Print("{%d}", k);
5180 if ((r->typ!=NULL) && (r->typ[0].ord_typ==ro_syz))
5181 {
5182 r->block0[0]=r->block1[0] = k;
5183 if( k == r->typ[0].data.syz.limit )
5184 return; // nothing to do
5185
5186 int i;
5187 if (r->typ[0].data.syz.limit == 0)
5188 {
5189 r->typ[0].data.syz.syz_index = (int*) omAlloc0((k+1)*sizeof(int));
5190 r->typ[0].data.syz.syz_index[0] = 0;
5191 r->typ[0].data.syz.curr_index = 1;
5192 }
5193 else
5194 {
5195 r->typ[0].data.syz.syz_index = (int*)
5196 omReallocSize(r->typ[0].data.syz.syz_index,
5197 (r->typ[0].data.syz.limit+1)*sizeof(int),
5198 (k+1)*sizeof(int));
5199 }
5200 for (i=r->typ[0].data.syz.limit + 1; i<= k; i++)
5201 {
5202 r->typ[0].data.syz.syz_index[i] =
5203 r->typ[0].data.syz.curr_index;
5204 }
5205 if(k < r->typ[0].data.syz.limit) // ?
5206 {
5207#ifndef SING_NDEBUG
5208 Warn("rSetSyzComp called with smaller limit (%d) as before (%d)", k, r->typ[0].data.syz.limit);
5209#endif
5210 r->typ[0].data.syz.curr_index = 1 + r->typ[0].data.syz.syz_index[k];
5211 }
5212
5213
5214 r->typ[0].data.syz.limit = k;
5215 r->typ[0].data.syz.curr_index++;
5216 }
5217 else if(
5218 (r->typ!=NULL) &&
5219 (r->typ[0].ord_typ==ro_isTemp)
5220 )
5221 {
5222// (r->typ[currRing->typ[0].data.isTemp.suffixpos].data.is.limit == k)
5223#ifndef SING_NDEBUG
5224 Warn("rSetSyzComp(%d) in an IS ring! Be careful!", k);
5225#endif
5226 }
5227 else if (r->order[0]==ringorder_s)
5228 {
5229 r->block0[0] = r->block1[0] = k;
5230 }
5231 else if (r->order[0]!=ringorder_c)
5232 {
5233 dReportError("syzcomp in incompatible ring");
5234 }
5235#ifdef PDEBUG
5237 pDBsyzComp=k;
5238#endif
5239}
#define EXTERN_VAR
Definition globaldefs.h:6
#define TEST_OPT_PROT
Definition options.h:103
VAR int pDBsyzComp
Definition ring.cc:5166

◆ rSetWeightVec()

void rSetWeightVec ( ring  r,
int64 wv 
)

Definition at line 5316 of file ring.cc.

5317{
5318 assume(r!=NULL);
5319 assume(r->OrdSize>0);
5320 assume(r->typ[0].ord_typ==ro_wp64);
5321 memcpy(r->typ[0].data.wp64.weights64,wv,r->N*sizeof(int64));
5322}

◆ rShortOut()

static BOOLEAN rShortOut ( const ring  r)
inlinestatic

Definition at line 586 of file ring.h.

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

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

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

◆ rSum()

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

Definition at line 1404 of file ring.cc.

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

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

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

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

3998{
3999 if (r == NULL) return;
4000 if (r->VarOffset != NULL)
4001 {
4002 if (r->OrdSize!=0 && r->typ != NULL)
4003 {
4004 for(int i = 0; i < r->OrdSize; i++)
4005 if( r->typ[i].ord_typ == ro_is) // Search for suffixes! (prefix have the same VarOffset)
4006 {
4007 id_Delete(&r->typ[i].data.is.F, r);
4008
4009 if( r->typ[i].data.is.pVarOffset != NULL )
4010 {
4011 omFreeSize((ADDRESS)r->typ[i].data.is.pVarOffset, (r->N +1)*sizeof(int));
4012 }
4013 }
4014 else if (r->typ[i].ord_typ == ro_syz)
4015 {
4016 if(r->typ[i].data.syz.limit > 0)
4017 omFreeSize(r->typ[i].data.syz.syz_index, ((r->typ[i].data.syz.limit) +1)*sizeof(int));
4018 }
4019 else if (r->typ[i].ord_typ == ro_syzcomp)
4020 {
4021 assume( r->typ[i].data.syzcomp.ShiftedComponents == NULL );
4022 assume( r->typ[i].data.syzcomp.Components == NULL );
4023// WarnS( "rUnComplete : ord_typ == ro_syzcomp was unhandled!!! Possibly memory leak!!!" );
4024#ifndef SING_NDEBUG
4025// assume(0);
4026#endif
4027 }
4028
4029 omFreeSize((ADDRESS)r->typ,r->OrdSize*sizeof(sro_ord)); r->typ = NULL;
4030 }
4031
4032 if (r->PolyBin != NULL)
4033 omUnGetSpecBin(&(r->PolyBin));
4034
4035 omFreeSize((ADDRESS)r->VarOffset, (r->N +1)*sizeof(int));
4036 r->VarOffset=NULL;
4037
4038 if (r->ordsgn != NULL && r->CmpL_Size != 0)
4039 {
4040 omFreeSize((ADDRESS)r->ordsgn,r->ExpL_Size*sizeof(long));
4041 r->ordsgn=NULL;
4042 }
4043 if (r->p_Procs != NULL)
4044 {
4045 omFreeSize(r->p_Procs, sizeof(p_Procs_s));
4046 r->p_Procs=NULL;
4047 }
4048 omfreeSize(r->VarL_Offset, r->VarL_Size*sizeof(int));
4049 r->VarL_Offset=NULL;
4050 }
4051 if (r->NegWeightL_Offset!=NULL)
4052 {
4053 omFreeSize(r->NegWeightL_Offset, r->NegWeightL_Size*sizeof(int));
4054 r->NegWeightL_Offset=NULL;
4055 }
4056}
#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 597 of file ring.h.

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

◆ rVarStr()

char * rVarStr ( ring  r)

Definition at line 625 of file ring.cc.

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

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

Variable Documentation

◆ sip_sring_bin

EXTERN_VAR omBin sip_sring_bin

Definition at line 837 of file ring.h.