My Project
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
nc.h File Reference
#include "polys/monomials/ring.h"
#include "polys/kbuckets.h"
#include "polys/matpol.h"

Go to the source code of this file.

Data Structures

struct  nc_pProcs
 
struct  nc_struct
 

Macros

#define UPMATELEM(i, j, nVar)   ( (nVar * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) )
 

Typedefs

typedef poly(* SPoly_Proc_Ptr) (const poly p1, const poly p2, const ring r)
 
typedef poly(* SPolyReduce_Proc_Ptr) (const poly p1, poly p2, const ring r)
 
typedef void(* bucket_Proc_Ptr) (kBucket_pt b, poly p, number *c, BOOLEAN reduce)
 

Enumerations

enum  nc_type {
  nc_error = -1 , nc_general = 0 , nc_skew , nc_comm ,
  nc_lie , nc_undef , nc_exterior
}
 

Functions

matrix nc_PrintMat (int a, int b, ring r, int metric)
 returns matrix with the info on noncomm multiplication More...
 
BOOLEAN rIsLikeOpposite (ring rBase, ring rCandidate)
 checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so More...
 
void nc_rKill (ring r)
 complete destructor More...
 
BOOLEAN nc_CheckSubalgebra (poly PolyVar, ring r)
 
static nc_struct *& GetNC (ring r)
 
static nc_typencRingType (nc_struct *p)
 
static nc_type ncRingType (ring r)
 
static void ncRingType (ring r, nc_type t)
 
static void ncRingType (nc_struct *p, nc_type t)
 
static bool rIsSCA (const ring r)
 
poly _nc_p_Mult_q (poly p, poly q, const ring r)
 general NC-multiplication with destruction More...
 
poly _nc_pp_Mult_qq (const poly p, const poly q, const ring r)
 general NC-multiplication without destruction More...
 
poly nc_p_Minus_mm_Mult_qq (poly p, const poly m, const poly q, int &lp, const poly, const ring r)
 for p_Minus_mm_Mult_qq in pInline2.h More...
 
poly nc_p_Plus_mm_Mult_qq (poly p, const poly m, const poly q, int &lp, const int, const ring r)
 
static poly nc_mm_Mult_pp (const poly m, const poly p, const ring r)
 
static poly nc_mm_Mult_p (const poly m, poly p, const ring r)
 
static poly nc_CreateSpoly (const poly p1, const poly p2, const ring r)
 
poly nc_CreateShortSpoly (poly p1, poly p2, const ring r)
 
poly nc_p_Bracket_qq (poly p, const poly q, const ring r)
 returns [p,q], destroys p More...
 
static poly nc_ReduceSpoly (const poly p1, poly p2, const ring r)
 
void nc_PolyPolyRed (poly &b, poly p, number *c, const ring r)
 
static void nc_kBucketPolyRed_NF (kBucket_pt b, poly p, number *c, BOOLEAN reduce)
 
static void nc_kBucketPolyRed_Z (kBucket_pt b, poly p, number *c, BOOLEAN reduce)
 
poly nc_pSubst (poly p, int n, poly e, const ring r)
 substitute the n-th variable by e in p destroy p e is not a constant More...
 
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, DO NOT initialize multiplication but call for it at the end checks the ordering condition and evtl. NDC NOTE: all the data belong to the curr, we change r which may be the same ring, and must have the same representation! More...
 
bool nc_SetupQuotient (ring rGR, const ring rG=NULL, bool bCopy=false)
 
BOOLEAN nc_rComplete (const ring src, ring dest, bool bSetupQuotient=true)
 
bool nc_rCopy (ring res, const ring r, bool bSetupQuotient)
 
poly pOppose (ring Rop_src, poly p, const ring Rop_dst)
 opposes a vector p from Rop to currRing (dst!) More...
 
ideal idOppose (ring Rop_src, ideal I, const ring Rop_dst)
 opposes a module I from Rop to currRing(dst) More...
 
int & getNCExtensions ()
 
int setNCExtensions (int iMask)
 
bool ncExtensions (int iMask)
 
void nc_p_ProcsSet (ring rGR, p_Procs_s *p_Procs)
 
static poly GetC (const ring r, int i, int j)
 
static poly GetD (const ring r, int i, int j)
 

Variables

const int GENERICMASK = 0x000
 
const int SCAMASK = 0x001
 
const int NOPLURALMASK = 0x002
 
const int NOFORMULAMASK =0x004
 
const int NOCACHEMASK = 0x008
 
const int TESTSYZSCAMASK = 0x0100 | SCAMASK
 

Data Structure Documentation

◆ nc_pProcs

struct nc_pProcs

Definition at line 50 of file nc.h.

Data Fields
bucket_Proc_Ptr BucketPolyRed_NF
bucket_Proc_Ptr BucketPolyRed_Z
void * GB From "gb_hack.h".
SPolyReduce_Proc_Ptr ReduceSPoly
SPoly_Proc_Ptr SPoly

Macro Definition Documentation

◆ UPMATELEM

#define UPMATELEM (   i,
  j,
  nVar 
)    ( (nVar * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) )

Definition at line 36 of file nc.h.

Typedef Documentation

◆ bucket_Proc_Ptr

typedef void(* bucket_Proc_Ptr) (kBucket_pt b, poly p, number *c, BOOLEAN reduce)

Definition at line 48 of file nc.h.

◆ SPoly_Proc_Ptr

typedef poly(* SPoly_Proc_Ptr) (const poly p1, const poly p2, const ring r)

Definition at line 45 of file nc.h.

◆ SPolyReduce_Proc_Ptr

typedef poly(* SPolyReduce_Proc_Ptr) (const poly p1, poly p2, const ring r)

Definition at line 46 of file nc.h.

Enumeration Type Documentation

◆ nc_type

enum nc_type
Enumerator
nc_error 
nc_general 
nc_skew 
nc_comm 
nc_lie 
nc_undef 
nc_exterior 

Definition at line 12 of file nc.h.

13 {
14  nc_error = -1, // Something's gone wrong!
15  nc_general = 0, /* yx=q xy+... */
16  nc_skew, /*1*/ /* yx=q xy */
17  nc_comm, /*2*/ /* yx= xy */
18  nc_lie, /*3*/ /* yx=xy+... */
19  nc_undef, /*4*/ /* for internal reasons */
20 
21  nc_exterior /*5*/ // Exterior Algebra(SCA): yx= -xy & (!:) x^2 = 0
22 };
@ nc_skew
Definition: nc.h:16
@ nc_lie
Definition: nc.h:18
@ nc_error
Definition: nc.h:14
@ nc_general
Definition: nc.h:15
@ nc_exterior
Definition: nc.h:21
@ nc_undef
Definition: nc.h:19
@ nc_comm
Definition: nc.h:17

Function Documentation

◆ _nc_p_Mult_q()

poly _nc_p_Mult_q ( poly  p,
poly  q,
const ring  r 
)

general NC-multiplication with destruction

Definition at line 215 of file old.gring.cc.

216 {
217  assume( rIsNCRing(rRing) );
218 #ifdef PDEBUG
219  p_Test(pPolyP, rRing);
220  p_Test(pPolyQ, rRing);
221 #endif
222 #ifdef RDEBUG
223  rTest(rRing);
224 #endif
225 
226  int lp, lq;
227 
228  pqLength(pPolyP, pPolyQ, lp, lq, MIN_LENGTH_BUCKET);
229 
230  bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (si_max(lp, lq) < MIN_LENGTH_BUCKET); // ???
231 
232  CPolynomialSummator sum(rRing, bUsePolynomial);
233 
234  if (lq <= lp) // ?
235  {
236  // always length(q) times "p * q[j]"
237  for( ; pPolyQ!=NULL; pPolyQ = p_LmDeleteAndNext( pPolyQ, rRing ) )
238  sum += pp_Mult_mm( pPolyP, pPolyQ, rRing);
239 
240  p_Delete( &pPolyP, rRing );
241  } else
242  {
243  // always length(p) times "p[i] * q"
244  for( ; pPolyP!=NULL; pPolyP = p_LmDeleteAndNext( pPolyP, rRing ) )
245  sum += nc_mm_Mult_pp( pPolyP, pPolyQ, rRing);
246 
247  p_Delete( &pPolyQ, rRing );
248  }
249 
250  return(sum);
251 }
static int si_max(const int a, const int b)
Definition: auxiliary.h:124
CPolynomialSummator: unifies bucket and polynomial summation as the later is brocken in buckets :(.
Definition: summator.h:21
static poly nc_mm_Mult_pp(const poly m, const poly p, const ring r)
Definition: nc.h:224
#define assume(x)
Definition: mod2.h:389
Definition: lq.h:40
#define NULL
Definition: omList.c:12
#define TEST_OPT_NOT_BUCKETS
Definition: options.h:106
BOOLEAN pqLength(poly p, poly q, int &lp, int &lq, const int min)
return TRUE and lp == pLength(p), lq == pLength(q), if min(pLength(p), pLength(q)) >= min FALSE if mi...
Definition: p_Mult_q.cc:31
#define MIN_LENGTH_BUCKET
Definition: p_Mult_q.h:21
static poly pp_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:1029
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:899
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition: p_polys.h:753
#define p_Test(p, r)
Definition: p_polys.h:159
static BOOLEAN rIsNCRing(const ring r)
Definition: ring.h:421
#define rTest(r)
Definition: ring.h:782

◆ _nc_pp_Mult_qq()

poly _nc_pp_Mult_qq ( const poly  p,
const poly  q,
const ring  r 
)

general NC-multiplication without destruction

Definition at line 254 of file old.gring.cc.

255 {
256  assume( rIsNCRing(rRing) );
257 #ifdef PDEBUG
258  p_Test(pPolyP, rRing);
259  p_Test(pPolyQ, rRing);
260 #endif
261 #ifdef RDEBUG
262  rTest(rRing);
263 #endif
264 
265  int lp, lq;
266 
267  pqLength(pPolyP, pPolyQ, lp, lq, MIN_LENGTH_BUCKET);
268 
269  bool bUsePolynomial = TEST_OPT_NOT_BUCKETS || (si_max(lp, lq) < MIN_LENGTH_BUCKET); // ???
270 
271  CPolynomialSummator sum(rRing, bUsePolynomial);
272 
273  if (lq <= lp) // ?
274  {
275  // always length(q) times "p * q[j]"
276  for( poly q = pPolyQ; q !=NULL; q = pNext(q) )
277  sum += pp_Mult_mm(pPolyP, q, rRing);
278  } else
279  {
280  // always length(p) times "p[i] * q"
281  for( poly p = pPolyP; p !=NULL; p = pNext(p) )
282  sum += nc_mm_Mult_pp( p, pPolyQ, rRing);
283  }
284 
285  return(sum);
286 }
int p
Definition: cfModGcd.cc:4078
#define pNext(p)
Definition: monomials.h:36

◆ GetC()

static poly GetC ( const ring  r,
int  i,
int  j 
)
inlinestatic

Definition at line 362 of file nc.h.

363 {
364  assume(r!= NULL && rIsPluralRing(r));
365  const matrix C = GetNC(r)->C;
366  assume(C != NULL);
367  const int ncols = C->ncols;
368  assume( (i > 0) && (i < j) && (j <= ncols) );
369  return ( C->m[ncols * ((i)-1) + (j)-1] );
370 }
int i
Definition: cfEzgcd.cc:132
int int ncols
Definition: cf_linsys.cc:32
int ncols
Definition: matpol.h:21
poly * m
Definition: matpol.h:18
int j
Definition: facHensel.cc:110
static nc_struct *& GetNC(ring r)
Definition: nc.h:154
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400
matrix C
Definition: nc.h:75

◆ GetD()

static poly GetD ( const ring  r,
int  i,
int  j 
)
inlinestatic

Definition at line 373 of file nc.h.

374 {
375  assume(r!= NULL && rIsPluralRing(r));
376  const matrix D = GetNC(r)->D;
377  assume(D != NULL);
378  const int ncols = D->ncols;
379  assume( (i > 0) && (i < j) && (j <= ncols) );
380  return ( D->m[ncols * ((i)-1) + (j)-1] );
381 }
#define D(A)
Definition: gentable.cc:131
matrix D
Definition: nc.h:76

◆ GetNC()

static nc_struct*& GetNC ( ring  r)
inlinestatic

Definition at line 154 of file nc.h.

155 {
156  return r->GetNC();
157 }

◆ getNCExtensions()

int& getNCExtensions ( )

Definition at line 82 of file old.gring.cc.

83 {
84  return (iNCExtensions);
85 }
VAR int iNCExtensions
Definition: old.gring.cc:80

◆ idOppose()

ideal idOppose ( ring  Rop_src,
ideal  I,
const ring  Rop_dst 
)

opposes a module I from Rop to currRing(dst)

Definition at line 3389 of file old.gring.cc.

3390 {
3391  /* the simplest case:*/
3392  if ( Rop == dst ) return id_Copy(I, dst);
3393 
3394  /* check Rop == rOpposite(currRing) */
3395  if (!rIsLikeOpposite(dst, Rop))
3396  {
3397  WarnS("an opposite ring should be used");
3398  return NULL;
3399  }
3400  int i;
3401  ideal idOp = idInit(I->ncols, I->rank);
3402  for (i=0; i< (I->ncols)*(I->nrows); i++)
3403  {
3404  idOp->m[i] = pOppose(Rop,I->m[i], dst);
3405  }
3406  id_Test(idOp, dst);
3407  return idOp;
3408 }
#define WarnS
Definition: emacs.cc:78
ideal id_Copy(ideal h1, const ring r)
copy an ideal
poly pOppose(ring Rop, poly p, const ring dst)
opposes a vector p from Rop to currRing (dst!)
Definition: old.gring.cc:3350
BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate)
checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so
Definition: old.gring.cc:3323
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
#define id_Test(A, lR)
Definition: simpleideals.h:87

◆ nc_CallPlural()

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, DO NOT initialize multiplication but call for it at the end checks the ordering condition and evtl. NDC NOTE: all the data belong to the curr, we change r which may be the same ring, and must have the same representation!

Definition at line 2690 of file old.gring.cc.

2695 {
2696  assume( r != NULL );
2697  assume( curr != NULL );
2698 
2699  if( !bSetupQuotient)
2700  assume( (r->qideal == NULL) ); // The basering must NOT be a qring!??
2701 
2702  assume( rSamePolyRep(r, curr) || bCopyInput ); // wrong assumption?
2703 
2704 
2705  if( r->N == 1 ) // clearly commutative!!!
2706  {
2707  assume(
2708  ( (CCC != NULL) && (MATCOLS(CCC) == 1) && (MATROWS(CCC) == 1) && (MATELEM(CCC,1,1) == NULL) ) ||
2709  ( (CCN == NULL) )
2710  );
2711 
2712  assume(
2713  ( (DDD != NULL) && (MATCOLS(DDD) == 1) && (MATROWS(DDD) == 1) && (MATELEM(DDD,1,1) == NULL) ) ||
2714  ( (DDN == NULL) )
2715  );
2716  if(!dummy_ring)
2717  {
2718  WarnS("commutative ring with 1 variable");
2719  return FALSE;
2720  }
2721  }
2722 
2723  // there must be:
2724  assume( (CCC != NULL) != (CCN != NULL) ); // exactly one data about coeffs (C).
2725  assume( !((DDD != NULL) && (DDN != NULL)) ); // at most one data about tails (D).
2726 
2727 #if OUTPUT
2728  if( CCC != NULL )
2729  {
2730  PrintS("nc_CallPlural(), Input data, CCC: \n");
2731  iiWriteMatrix(CCC, "C", 2, curr, 4);
2732  }
2733  if( DDD != NULL )
2734  {
2735  PrintS("nc_CallPlural(), Input data, DDD: \n");
2736  iiWriteMatrix(DDD, "D", 2, curr, 4);
2737  }
2738 #endif
2739 
2740 
2741 #ifndef SING_NDEBUG
2742  if (CCC!=NULL) id_Test((ideal)CCC, curr);
2743  if (DDD!=NULL) id_Test((ideal)DDD, curr);
2744  p_Test(CCN, curr);
2745  p_Test(DDN, curr);
2746 #endif
2747 
2748  if( (!bBeQuiet) && (r->GetNC() != NULL) )
2749  WarnS("going to redefine the algebra structure");
2750 
2751  matrix CC = NULL;
2752  poly CN = NULL;
2753  matrix C; bool bCnew = false;
2754 
2755  matrix DD = NULL;
2756  poly DN = NULL;
2757  matrix D; bool bDnew = false;
2758 
2759  number nN, pN, qN;
2760 
2761  bool IsSkewConstant = false, tmpIsSkewConstant;
2762  int i, j;
2763 
2764  nc_type nctype = nc_undef;
2765 
2766  //////////////////////////////////////////////////////////////////
2767  // check the correctness of arguments, without any real chagnes!!!
2768 
2769 
2770 
2771  // check C
2772  if ((CCC != NULL) && ( (MATCOLS(CCC)==1) || MATROWS(CCC)==1 ) )
2773  {
2774  CN = MATELEM(CCC,1,1);
2775  }
2776  else
2777  {
2778  if ((CCC != NULL) && ( (MATCOLS(CCC)!=r->N) || (MATROWS(CCC)!=r->N) ))
2779  {
2780  Werror("Square %d x %d matrix expected", r->N, r->N);
2781  return TRUE;
2782  }
2783  }
2784  if (( CCC != NULL) && (CC == NULL)) CC = CCC; // mp_Copy(CCC, ?); // bug!?
2785  if (( CCN != NULL) && (CN == NULL)) CN = CCN;
2786 
2787  // check D
2788  if ((DDD != NULL) && ( (MATCOLS(DDD)==1) || MATROWS(DDD)==1 ) )
2789  {
2790  DN = MATELEM(DDD,1,1);
2791  }
2792  else
2793  {
2794  if ((DDD != NULL) && ( (MATCOLS(DDD)!=r->N) || (MATROWS(DDD)!=r->N) ))
2795  {
2796  Werror("Square %d x %d matrix expected",r->N,r->N);
2797  return TRUE;
2798  }
2799  }
2800 
2801  if (( DDD != NULL) && (DD == NULL)) DD = DDD; // mp_Copy(DDD, ?); // ???
2802  if (( DDN != NULL) && (DN == NULL)) DN = DDN;
2803 
2804  // further checks and some analysis:
2805  // all data in 'curr'!
2806  if (CN != NULL) /* create matrix C = CN * Id */
2807  {
2808  if (!p_IsConstant(CN,curr))
2809  {
2810  WerrorS("Incorrect input : non-constants are not allowed as coefficients (first argument)");
2811  return TRUE;
2812  }
2813  assume(p_IsConstant(CN,curr));
2814 
2815  nN = pGetCoeff(CN);
2816  if (n_IsZero(nN, curr->cf))
2817  {
2818  WerrorS("Incorrect input : zero coefficients are not allowed");
2819  return TRUE;
2820  }
2821 
2822  if (n_IsOne(nN, curr->cf))
2823  nctype = nc_lie;
2824  else
2825  nctype = nc_general;
2826 
2827  IsSkewConstant = true;
2828 
2829  C = mpNew(r->N,r->N); // ring independent!
2830  bCnew = true;
2831 
2832  for(i=1; i<r->N; i++)
2833  for(j=i+1; j<=r->N; j++)
2834  MATELEM(C,i,j) = prCopyR_NoSort(CN, curr, r); // nc_p_CopyPut(CN, r); // copy CN from curr into r
2835 
2836 #ifndef SING_NDEBUG
2837  id_Test((ideal)C, r);
2838 #endif
2839 
2840  }
2841  else if ( (CN == NULL) && (CC != NULL) ) /* copy matrix C */
2842  {
2843  /* analyze C */
2844 
2845  BOOLEAN pN_set=FALSE;
2846  pN = n_Init(0,curr->cf);
2847 
2848  if( r->N > 1 )
2849  if ( MATELEM(CC,1,2) != NULL )
2850  {
2851  if (!pN_set) n_Delete(&pN,curr->cf); // free initial nInit(0)
2852  pN = p_GetCoeff(MATELEM(CC,1,2), curr);
2853  pN_set=TRUE;
2854  }
2855 
2856  tmpIsSkewConstant = true;
2857 
2858  for(i=1; i<r->N; i++)
2859  for(j=i+1; j<=r->N; j++)
2860  {
2861  if (MATELEM(CC,i,j) == NULL)
2862  qN = NULL;
2863  else
2864  {
2865  if (!p_IsConstant(MATELEM(CC,i,j),curr))
2866  {
2867  Werror("Incorrect input : non-constants are not allowed as coefficients (first argument at [%d, %d])", i, j);
2868  return TRUE;
2869  }
2870  assume(p_IsConstant(MATELEM(CC,i,j),curr));
2871  qN = p_GetCoeff(MATELEM(CC,i,j),curr);
2872  }
2873 
2874  if ( qN == NULL ) /* check the consistency: Cij!=0 */
2875  // find also illegal pN
2876  {
2877  WerrorS("Incorrect input : matrix of coefficients contains zeros in the upper triangle");
2878  return TRUE;
2879  }
2880 
2881  if (!n_Equal(pN, qN, curr->cf)) tmpIsSkewConstant = false;
2882  }
2883 
2884  if( bCopyInput )
2885  {
2886  C = mp_Copy(CC, curr, r); // Copy C into r!!!???
2887 #ifndef SING_NDEBUG
2888  id_Test((ideal)C, r);
2889 #endif
2890  bCnew = true;
2891  }
2892  else
2893 
2894  C = CC;
2895 
2896  IsSkewConstant = tmpIsSkewConstant;
2897 
2898  if ( tmpIsSkewConstant && n_IsOne(pN, curr->cf) )
2899  nctype = nc_lie;
2900  else
2901  nctype = nc_general;
2902  if (!pN_set) n_Delete(&pN,curr->cf); // free initial nInit(0)
2903  }
2904 
2905  /* initialition of the matrix D */
2906  if ( DD == NULL ) /* we treat DN only (it could also be NULL) */
2907  {
2908  D = mpNew(r->N,r->N); bDnew = true;
2909 
2910  if (DN == NULL)
2911  {
2912  if ( (nctype == nc_lie) || (nctype == nc_undef) )
2913  nctype = nc_comm; /* it was nc_skew earlier */
2914  else /* nc_general, nc_skew */
2915  nctype = nc_skew;
2916  }
2917  else /* DN != NULL */
2918  for(i=1; i<r->N; i++)
2919  for(j=i+1; j<=r->N; j++)
2920  MATELEM(D,i,j) = prCopyR_NoSort(DN, curr, r); // project DN into r->GetNC()->basering!
2921 #ifndef SING_NDEBUG
2922  id_Test((ideal)D, r);
2923 #endif
2924  }
2925  else /* DD != NULL */
2926  {
2927  bool b = true; // DD == null ?
2928 
2929  for(int i = 1; (i < r->N) && b; i++)
2930  for(int j = i+1; (j <= r->N) && b; j++)
2931  if (MATELEM(DD, i, j) != NULL)
2932  {
2933  b = false;
2934  break;
2935  }
2936 
2937  if (b) // D == NULL!!!
2938  {
2939  if ( (nctype == nc_lie) || (nctype == nc_undef) )
2940  nctype = nc_comm; /* it was nc_skew earlier */
2941  else /* nc_general, nc_skew */
2942  nctype = nc_skew;
2943  }
2944 
2945  if( bCopyInput )
2946  {
2947  D = mp_Copy(DD, curr, r); // Copy DD into r!!!
2948 #ifndef SING_NDEBUG
2949  id_Test((ideal)D, r);
2950 #endif
2951  bDnew = true;
2952  }
2953  else
2954  D = DD;
2955  }
2956 
2957  assume( C != NULL );
2958  assume( D != NULL );
2959 
2960 #if OUTPUT
2961  PrintS("nc_CallPlural(), Computed data, C: \n");
2962  iiWriteMatrix(C, "C", 2, r, 4);
2963 
2964  PrintS("nc_CallPlural(), Computed data, D: \n");
2965  iiWriteMatrix(D, "D", 2, r, 4);
2966 
2967  Print("\nTemporary: type = %d, IsSkewConstant = %d\n", nctype, IsSkewConstant);
2968 #endif
2969 
2970 
2971  // check the ordering condition for D (both matrix and poly cases):
2972  if ( gnc_CheckOrdCondition(D, r) )
2973  {
2974  if( bCnew ) mp_Delete( &C, r );
2975  if( bDnew ) mp_Delete( &D, r );
2976 
2977  WerrorS("Matrix of polynomials violates the ordering condition");
2978  return TRUE;
2979  }
2980 
2981  // okay now we are ready for this!!!
2982 
2983  // create new non-commutative structure
2984  nc_struct *nc_new = (nc_struct *)omAlloc0(sizeof(nc_struct));
2985 
2986  ncRingType(nc_new, nctype);
2987 
2988  nc_new->C = C; // if C and D were given by matrices at the beginning they are in r
2989  nc_new->D = D; // otherwise they should be in r->GetNC()->basering(polynomial * Id_{N})
2990 
2991  nc_new->IsSkewConstant = (IsSkewConstant?1:0);
2992 
2993  // Setup new NC structure!!!
2994  if (r->GetNC() != NULL)
2995  {
2996 #ifndef SING_NDEBUG
2997  WarnS("Changing the NC-structure of an existing NC-ring!!!");
2998 #endif
2999  nc_rKill(r);
3000  }
3001 
3002  r->GetNC() = nc_new;
3003 
3004  r->ext_ref=NULL;
3005 
3006  return gnc_InitMultiplication(r, bSetupQuotient);
3007 }
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
CanonicalForm b
Definition: cfModGcd.cc:4103
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition: coeffs.h:461
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition: coeffs.h:452
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:535
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
Definition: coeffs.h:457
static FORCE_INLINE BOOLEAN n_IsOne(number n, const coeffs r)
TRUE iff 'n' represents the one element.
Definition: coeffs.h:465
#define Print
Definition: emacs.cc:80
void WerrorS(const char *s)
Definition: feFopen.cc:24
nc_type
Definition: nc.h:13
static nc_type & ncRingType(nc_struct *p)
Definition: nc.h:159
void mp_Delete(matrix *a, const ring r)
Definition: matpol.cc:880
matrix mpNew(int r, int c)
create a r x c zero-matrix
Definition: matpol.cc:37
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:64
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition: matpol.cc:834
#define MATELEM(mat, i, j)
1-based access to matrix
Definition: matpol.h:29
#define MATROWS(i)
Definition: matpol.h:26
#define MATCOLS(i)
Definition: matpol.h:27
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy
Definition: monomials.h:44
#define p_GetCoeff(p, r)
Definition: monomials.h:50
BOOLEAN gnc_InitMultiplication(ring r, bool bSetupQuotient=false)
Definition: old.gring.cc:3023
BOOLEAN gnc_CheckOrdCondition(matrix D, ring r)
Definition: old.gring.cc:2635
void nc_rKill(ring r)
complete destructor
Definition: old.gring.cc:2483
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static BOOLEAN p_IsConstant(const poly p, const ring r)
Definition: p_polys.h:1962
poly prCopyR_NoSort(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:77
void PrintS(const char *s)
Definition: reporter.cc:284
void Werror(const char *fmt,...)
Definition: reporter.cc:189
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:1799
Definition: nc.h:68
int IsSkewConstant
Definition: nc.h:85

◆ nc_CheckSubalgebra()

BOOLEAN nc_CheckSubalgebra ( poly  PolyVar,
ring  r 
)

Definition at line 2576 of file old.gring.cc.

2577 {
2578 // ring save = currRing;
2579 // int WeChangeRing = 0;
2580 // if (currRing != r)
2581 // rChangeCurrRing(r);
2582 // WeChangeRing = 1;
2583 // }
2584  int rN=r->N;
2585  int *ExpVar=(int*)omAlloc0((rN+1)*sizeof(int));
2586  int *ExpTmp=(int*)omAlloc0((rN+1)*sizeof(int));
2587  p_GetExpV(PolyVar, ExpVar, r);
2588  int i; int j; int k;
2589  poly test=NULL;
2590  int OK=1;
2591  for (i=1; i<rN; i++)
2592  {
2593  if (ExpVar[i]==0) /* i.e. not in PolyVar */
2594  {
2595  for (j=i+1; j<=rN; j++)
2596  {
2597  if (ExpVar[j]==0)
2598  {
2599  test = MATELEM(r->GetNC()->D,i,j);
2600  while (test!=NULL)
2601  {
2602  p_GetExpV(test, ExpTmp, r);
2603  OK=1;
2604  for (k=1;k<=rN;k++)
2605  {
2606  if (ExpTmp[k]!=0)
2607  {
2608  if (ExpVar[k]!=0) OK=0;
2609  }
2610  }
2611  if (!OK)
2612  {
2613 // if ( WeChangeRing )
2614 // rChangeCurrRing(save);
2615  return(TRUE);
2616  }
2617  pIter(test);
2618  }
2619  }
2620  }
2621  }
2622  }
2623  freeT(ExpVar,rN);
2624  freeT(ExpTmp,rN);
2625 // if ( WeChangeRing )
2626 // rChangeCurrRing(save);
2627  return(FALSE);
2628 }
int k
Definition: cfEzgcd.cc:99
CanonicalForm test
Definition: cfModGcd.cc:4096
#define pIter(p)
Definition: monomials.h:37
#define freeT(A, v)
Definition: old.gring.cc:101
static void p_GetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1518

◆ nc_CreateShortSpoly()

poly nc_CreateShortSpoly ( poly  p1,
poly  p2,
const ring  r 
)

Definition at line 1879 of file old.gring.cc.

1880 {
1881 #ifdef PDEBUG
1882  p_Test(p1, r);
1883  p_Test(p2, r);
1884 #endif
1885 
1886  const long lCompP1 = p_GetComp(p1,r);
1887  const long lCompP2 = p_GetComp(p2,r);
1888 
1889  if ((lCompP1!=lCompP2) && (lCompP1!=0) && (lCompP2!=0))
1890  {
1891 #ifdef PDEBUG
1892  WerrorS("nc_CreateShortSpoly: wrong module components!"); // !!!!
1893 #endif
1894  return(NULL);
1895  }
1896 
1897  poly m;
1898 
1899 #ifdef HAVE_RATGRING
1900  if ( rIsRatGRing(r))
1901  {
1902  /* rational version */
1903  m = p_LcmRat(p1, p2, si_max(lCompP1, lCompP2), r);
1904  } else
1905 #endif
1906  {
1907  m = p_Lcm(p1, p2, r);
1908  }
1909 
1910  pSetCoeff0(m,NULL);
1911 
1912  return(m);
1913 }
int m
Definition: cfEzgcd.cc:128
#define p_GetComp(p, r)
Definition: monomials.h:64
#define pSetCoeff0(p, n)
Definition: monomials.h:59
poly p_LcmRat(const poly a, const poly b, const long lCompM, const ring r)
Definition: p_polys.cc:1673
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition: p_polys.cc:1651
static BOOLEAN rIsRatGRing(const ring r)
Definition: ring.h:427

◆ nc_CreateSpoly()

static poly nc_CreateSpoly ( const poly  p1,
const poly  p2,
const ring  r 
)
inlinestatic

Definition at line 241 of file nc.h.

242 {
243  assume(rIsPluralRing(r));
244  assume(r->GetNC()->p_Procs.SPoly!=NULL);
245  return r->GetNC()->p_Procs.SPoly(p1, p2, r);
246 }

◆ nc_kBucketPolyRed_NF()

static void nc_kBucketPolyRed_NF ( kBucket_pt  b,
poly  p,
number *  c,
BOOLEAN  reduce 
)
inlinestatic

Definition at line 275 of file nc.h.

276 {
277  const ring r = b->bucket_ring;
278  assume(rIsPluralRing(r));
279 
280  assume(r->GetNC()->p_Procs.BucketPolyRed_NF!=NULL);
281  return r->GetNC()->p_Procs.BucketPolyRed_NF(b, p, c, reduce);
282 }
CanonicalForm reduce(const CanonicalForm &f, const CanonicalForm &M)
polynomials in M.mvar() are considered coefficients M univariate monic polynomial the coefficients of...
Definition: cf_ops.cc:660

◆ nc_kBucketPolyRed_Z()

static void nc_kBucketPolyRed_Z ( kBucket_pt  b,
poly  p,
number *  c,
BOOLEAN  reduce 
)
inlinestatic

Definition at line 284 of file nc.h.

285 {
286  const ring r = b->bucket_ring;
287  assume(rIsPluralRing(r));
288 
289  assume(r->GetNC()->p_Procs.BucketPolyRed_Z!=NULL);
290  return r->GetNC()->p_Procs.BucketPolyRed_Z(b, p, c, reduce);
291 
292 }

◆ nc_mm_Mult_p()

static poly nc_mm_Mult_p ( const poly  m,
poly  p,
const ring  r 
)
inlinestatic

Definition at line 233 of file nc.h.

234 {
235  assume(rIsPluralRing(r));
236  assume(r->p_Procs->p_mm_Mult!=NULL);
237  return r->p_Procs->p_mm_Mult(p, m, r);
238 // return p_Mult_mm( p, m, r);
239 }

◆ nc_mm_Mult_pp()

static poly nc_mm_Mult_pp ( const poly  m,
const poly  p,
const ring  r 
)
inlinestatic

Definition at line 224 of file nc.h.

225 {
226  assume(rIsNCRing(r));
227  assume(r->p_Procs->pp_mm_Mult!=NULL);
228  return r->p_Procs->pp_mm_Mult(p, m, r);
229 }

◆ nc_p_Bracket_qq()

poly nc_p_Bracket_qq ( poly  p,
const poly  q,
const ring  r 
)

returns [p,q], destroys p

Definition at line 2251 of file old.gring.cc.

2252 {
2253  assume(p != NULL && q!= NULL);
2254 
2255  if (!rIsPluralRing(r)) return(NULL);
2256  if (p_ComparePolys(p,q, r)) return(NULL);
2257  /* Components !? */
2258  poly Q=NULL;
2259  number coef=NULL;
2260  poly pres=NULL;
2261  int UseBuckets=1;
2262  if (((pLength(p)< MIN_LENGTH_BUCKET/2) && (pLength(q)< MIN_LENGTH_BUCKET/2))
2264  UseBuckets=0;
2265 
2266 
2267  CPolynomialSummator sum(r, UseBuckets == 0);
2268 
2269  while (p!=NULL)
2270  {
2271  Q=q;
2272  while(Q!=NULL)
2273  {
2274  pres=nc_mm_Bracket_nn(p,Q, r); /* since no coeffs are taken into account there */
2275  if (pres!=NULL)
2276  {
2277  coef = n_Mult(pGetCoeff(p),pGetCoeff(Q), r->cf);
2278  pres = __p_Mult_nn(pres,coef,r);
2279 
2280  sum += pres;
2281  n_Delete(&coef, r->cf);
2282  }
2283  pIter(Q);
2284  }
2285  p=p_LmDeleteAndNext(p, r);
2286  }
2287  return(sum);
2288 }
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition: coeffs.h:633
STATIC_VAR jList * Q
Definition: janet.cc:30
poly nc_mm_Bracket_nn(poly m1, poly m2, const ring r)
returns [m1,m2] for two monoms, destroys nothing without coeffs
Definition: old.gring.cc:2292
BOOLEAN p_ComparePolys(poly p1, poly p2, const ring r)
returns TRUE if p1 is a skalar multiple of p2 assume p1 != NULL and p2 != NULL
Definition: p_polys.cc:4572
static int pLength(poly a)
Definition: p_polys.h:188
#define __p_Mult_nn(p, n, r)
Definition: p_polys.h:969

◆ nc_p_Minus_mm_Mult_qq()

poly nc_p_Minus_mm_Mult_qq ( poly  p,
const poly  m,
const poly  q,
int &  lp,
const  poly,
const ring  r 
)

for p_Minus_mm_Mult_qq in pInline2.h

Definition at line 150 of file old.gring.cc.

152 {
153  poly mc = p_Neg( p_Copy(m, r), r );
154  poly mmc = nc_mm_Mult_pp( mc, q, r );
155  p_Delete(&mc, r);
156 
157  int org_p=pLength(p);
158  int org_q=pLength(q);
159 
160  p = p_Add_q(p, mmc, r);
161 
162  shorter = pLength(p)-org_p-org_q; // ring independent!
163 
164  return(p);
165 }
static poly p_Neg(poly p, const ring r)
Definition: p_polys.h:1105
static poly p_Add_q(poly p, poly q, const ring r)
Definition: p_polys.h:934
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:844

◆ nc_p_Plus_mm_Mult_qq()

poly nc_p_Plus_mm_Mult_qq ( poly  p,
const poly  m,
const poly  q,
int &  lp,
const int  ,
const ring  r 
)

Definition at line 168 of file old.gring.cc.

170 {
171  p = p_Add_q(p, nc_mm_Mult_pp( m, q, r ), r);
172 
173  lp = pLength(p);
174 
175  return(p);
176 }

◆ nc_p_ProcsSet()

void nc_p_ProcsSet ( ring  rGR,
p_Procs_s p_Procs 
)

Definition at line 3187 of file old.gring.cc.

3188 {
3189  assume(rIsPluralRing(rGR));
3190  assume(p_Procs!=NULL);
3191 
3192  gnc_p_ProcsSet(rGR, p_Procs);
3193 
3194  if(rIsSCA(rGR) && ncExtensions(SCAMASK) )
3195  {
3196  sca_p_ProcsSet(rGR, p_Procs);
3197  }
3198 
3199  if( ncExtensions(NOPLURALMASK) )
3201 
3202  if(!rIsSCA(rGR) && !ncExtensions(NOFORMULAMASK))
3204 
3205 }
static bool rIsSCA(const ring r)
Definition: nc.h:190
const int NOPLURALMASK
Definition: nc.h:334
const int NOFORMULAMASK
Definition: nc.h:335
const int SCAMASK
Definition: nc.h:320
void sca_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: sca.cc:1225
bool ncInitSpecialPowersMultiplication(ring r)
Definition: ncSAFormula.cc:50
BOOLEAN ncInitSpecialPairMultiplication(ring r)
Definition: ncSAMult.cc:266
bool ncExtensions(int iMask)
Definition: old.gring.cc:94
static void gnc_p_ProcsSet(ring rGR, p_Procs_s *p_Procs)
Definition: old.gring.cc:3123

◆ nc_PolyPolyRed()

void nc_PolyPolyRed ( poly &  b,
poly  p,
number *  c,
const ring  r 
)

Definition at line 2238 of file old.gring.cc.

2239 {
2240 #if 0
2241  nc_PolyPolyRedOld(b, p, c, r);
2242 #else
2243  nc_PolyPolyRedNew(b, p, c, r);
2244 #endif
2245 }
void nc_PolyPolyRedNew(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2138
void nc_PolyPolyRedOld(poly &b, poly p, number *c, const ring r)
Definition: old.gring.cc:2104

◆ nc_PrintMat()

matrix nc_PrintMat ( int  a,
int  b,
ring  r,
int  metric 
)

returns matrix with the info on noncomm multiplication

Definition at line 2402 of file old.gring.cc.

2403 {
2404 
2405  if ( (a==b) || !rIsPluralRing(r) ) return(NULL);
2406  int i;
2407  int j;
2408  if (a>b) {j=b; i=a;}
2409  else {j=a; i=b;}
2410  /* i<j */
2411  int rN=r->N;
2412  int size=r->GetNC()->MTsize[UPMATELEM(i,j,rN)];
2413  matrix M = r->GetNC()->MT[UPMATELEM(i,j,rN)];
2414  /* return(M); */
2415 /*
2416  int sizeofres;
2417  if (metric==0)
2418  {
2419  sizeofres=sizeof(int);
2420  }
2421  if (metric==1)
2422  {
2423  sizeofres=sizeof(number);
2424  }
2425 */
2427  int s;
2428  int t;
2429  int length;
2430  long totdeg;
2431  poly p;
2432  for(s=1;s<=size;s++)
2433  {
2434  for(t=1;t<=size;t++)
2435  {
2436  p=MATELEM(M,s,t);
2437  if (p==NULL)
2438  {
2439  MATELEM(res,s,t)=0;
2440  }
2441  else
2442  {
2443  length = pLength(p);
2444  if (metric==0) /* length */
2445  {
2446  MATELEM(res,s,t)= p_ISet(length,r);
2447  }
2448  else if (metric==1) /* sum of deg divided by the length */
2449  {
2450  totdeg=0;
2451  while (p!=NULL)
2452  {
2453  totdeg=totdeg+p_Deg(p,r);
2454  pIter(p);
2455  }
2456  number ntd = n_Init(totdeg, r->cf);
2457  number nln = n_Init(length, r->cf);
2458  number nres= n_Div(ntd,nln, r->cf);
2459  n_Delete(&ntd, r->cf);
2460  n_Delete(&nln, r->cf);
2461  MATELEM(res,s,t)=p_NSet(nres,r);
2462  }
2463  }
2464  }
2465  }
2466  return(res);
2467 }
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
Definition: coeffs.h:612
const CanonicalForm int s
Definition: facAbsFact.cc:51
CanonicalForm res
Definition: facAbsFact.cc:60
static BOOLEAN length(leftv result, leftv arg)
Definition: interval.cc:257
#define UPMATELEM(i, j, nVar)
Definition: nc.h:36
poly p_ISet(long i, const ring r)
returns the poly representing the integer i
Definition: p_polys.cc:1297
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition: p_polys.cc:1469
long p_Deg(poly a, const ring r)
Definition: p_polys.cc:587
#define M
Definition: sirandom.c:25

◆ nc_pSubst()

poly nc_pSubst ( poly  p,
int  n,
poly  e,
const ring  r 
)

substitute the n-th variable by e in p destroy p e is not a constant

Definition at line 3211 of file old.gring.cc.

3212 {
3213  int rN = r->N;
3214  int *PRE = (int *)omAlloc0((rN+1)*sizeof(int));
3215  int *SUF = (int *)omAlloc0((rN+1)*sizeof(int));
3216  int i,pow;
3217  number C;
3218  poly suf,pre;
3219  poly res = NULL;
3220  poly out = NULL;
3221  while ( p!= NULL )
3222  {
3223  C = p_GetCoeff(p, r);
3224  p_GetExpV(p, PRE, r); /* faster splitting? */
3225  pow = PRE[n]; PRE[n]=0;
3226  res = NULL;
3227  if (pow!=0)
3228  {
3229  for (i=n+1; i<=rN; i++)
3230  {
3231  SUF[i] = PRE[i];
3232  PRE[i] = 0;
3233  }
3234  res = p_Power(p_Copy(e, r),pow, r);
3235  /* multiply with prefix */
3236  pre = p_One(r);
3237  p_SetExpV(pre,PRE, r);
3238  p_Setm(pre, r);
3239  res = nc_mm_Mult_p(pre,res, r);
3240  /* multiply with suffix */
3241  suf = p_One(r);
3242  p_SetExpV(suf,SUF, r);
3243  p_Setm(suf, r);
3244  res = p_Mult_mm(res,suf, r);
3245  res = __p_Mult_nn(res,C, r);
3246  p_SetComp(res,PRE[0], r);
3247  }
3248  else /* pow==0 */
3249  {
3250  res = p_Head(p, r);
3251  }
3252  p = p_LmDeleteAndNext(p, r);
3253  out = p_Add_q(out,res, r);
3254  }
3255  freeT(PRE,rN);
3256  freeT(SUF,rN);
3257  return(out);
3258 }
Rational pow(const Rational &a, int e)
Definition: GMPrat.cc:411
static poly nc_mm_Mult_p(const poly m, poly p, const ring r)
Definition: nc.h:233
poly p_Power(poly p, int i, const ring r)
Definition: p_polys.cc:2193
poly p_One(const ring r)
Definition: p_polys.cc:1313
static void p_SetExpV(poly p, int *ev, const ring r)
Definition: p_polys.h:1542
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition: p_polys.h:245
static void p_Setm(poly p, const ring r)
Definition: p_polys.h:231
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition: p_polys.h:858
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition: p_polys.h:1049

◆ nc_rComplete()

BOOLEAN nc_rComplete ( const ring  src,
ring  dest,
bool  bSetupQuotient = true 
)

Definition at line 5685 of file ring.cc.

5690 {
5691 // NOTE: Originally used only by idElimination to transfer NC structure to dest
5692 // ring created by dirty hack (without nc_CallPlural)
5693  rTest(src);
5694 
5695  assume(!rIsPluralRing(dest)); // destination must be a newly constructed commutative ring
5696 
5697  if (!rIsPluralRing(src))
5698  {
5699  return FALSE;
5700  }
5701 
5702  const int N = dest->N;
5703 
5704  assume(src->N == N);
5705 
5706 // ring save = currRing;
5707 
5708 // if (dest != save)
5709 // rChangeCurrRing(dest);
5710 
5711  const ring srcBase = src;
5712 
5713  assume( n_SetMap(srcBase->cf,dest->cf) == n_SetMap(dest->cf,dest->cf) ); // currRing is important here!
5714 
5715  matrix C = mpNew(N,N); // ring independent
5716  matrix D = mpNew(N,N);
5717 
5718  matrix C0 = src->GetNC()->C;
5719  matrix D0 = src->GetNC()->D;
5720 
5721  // map C and D into dest
5722  for (int i = 1; i < N; i++)
5723  {
5724  for (int j = i + 1; j <= N; j++)
5725  {
5726  const number n = n_Copy(p_GetCoeff(MATELEM(C0,i,j), srcBase), srcBase->cf); // src, mapping for coeffs into currRing = dest!
5727  const poly p = p_NSet(n, dest);
5728  MATELEM(C,i,j) = p;
5729  if (MATELEM(D0,i,j) != NULL)
5730  MATELEM(D,i,j) = prCopyR(MATELEM(D0,i,j), srcBase, dest); // ?
5731  }
5732  }
5733  /* One must test C and D _only_ in r->GetNC()->basering!!! not in r!!! */
5734 
5735  id_Test((ideal)C, dest);
5736  id_Test((ideal)D, dest);
5737 
5738  if (nc_CallPlural(C, D, NULL, NULL, dest, bSetupQuotient, false, true, dest)) // also takes care about quotient ideal
5739  {
5740  //WarnS("Error transferring non-commutative structure");
5741  // error message should be in the interpreter interface
5742 
5743  mp_Delete(&C, dest);
5744  mp_Delete(&D, dest);
5745 
5746 // if (currRing != save)
5747 // rChangeCurrRing(save);
5748 
5749  return TRUE;
5750  }
5751 
5752 // mp_Delete(&C, dest); // used by nc_CallPlural!
5753 // mp_Delete(&D, dest);
5754 
5755 // if (dest != save)
5756 // rChangeCurrRing(save);
5757 
5758  assume(rIsPluralRing(dest));
5759  return FALSE;
5760 }
const CanonicalForm CFMap CFMap & N
Definition: cfEzgcd.cc:56
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:448
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:697
BOOLEAN nc_CallPlural(matrix cc, matrix dd, poly cn, poly dn, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring=false)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type,...
Definition: old.gring.cc:2690
poly prCopyR(poly p, ring src_r, ring dest_r)
Definition: prCopy.cc:34

◆ nc_rCopy()

bool nc_rCopy ( ring  res,
const ring  r,
bool  bSetupQuotient 
)

Definition at line 3011 of file old.gring.cc.

3012 {
3013  if (nc_CallPlural(r->GetNC()->C, r->GetNC()->D, NULL, NULL, res, bSetupQuotient, true, true, r))
3014  {
3015  WarnS("Error occurred while coping/setuping the NC structure!"); // No reaction!???
3016  return true; // error
3017  }
3018 
3019  return false;
3020 }
BOOLEAN nc_CallPlural(matrix CCC, matrix DDD, poly CCN, poly DDN, ring r, bool bSetupQuotient, bool bCopyInput, bool bBeQuiet, ring curr, bool dummy_ring)
returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type,...
Definition: old.gring.cc:2690

◆ nc_ReduceSpoly()

static poly nc_ReduceSpoly ( const poly  p1,
poly  p2,
const ring  r 
)
inlinestatic

Definition at line 254 of file nc.h.

255 {
256  assume(rIsPluralRing(r));
257  assume(r->GetNC()->p_Procs.ReduceSPoly!=NULL);
258 #ifdef PDEBUG
259 // assume(p_LmDivisibleBy(p1, p2, r));
260 #endif
261  return r->GetNC()->p_Procs.ReduceSPoly(p1, p2, r);
262 }

◆ nc_rKill()

void nc_rKill ( ring  r)

complete destructor

Definition at line 2483 of file old.gring.cc.

2485 {
2486  if( r->GetNC()->GetGlobalMultiplier() != NULL )
2487  {
2488  delete r->GetNC()->GetGlobalMultiplier();
2489  r->GetNC()->GetGlobalMultiplier() = NULL;
2490  }
2491 
2492  if( r->GetNC()->GetFormulaPowerMultiplier() != NULL )
2493  {
2494  delete r->GetNC()->GetFormulaPowerMultiplier();
2495  r->GetNC()->GetFormulaPowerMultiplier() = NULL;
2496  }
2497 
2498 
2499  int i,j;
2500  int rN=r->N;
2501  if ( rN > 1 )
2502  {
2503  for(i=1;i<rN;i++)
2504  {
2505  for(j=i+1;j<=rN;j++)
2506  {
2507  id_Delete((ideal *)&(r->GetNC()->MT[UPMATELEM(i,j,rN)]),r);
2508  }
2509  }
2510  omFreeSize((ADDRESS)r->GetNC()->MT,rN*(rN-1)/2*sizeof(matrix));
2511  omFreeSize((ADDRESS)r->GetNC()->MTsize,rN*(rN-1)/2*sizeof(int));
2512  id_Delete((ideal *)&(r->GetNC()->COM),r);
2513  }
2514  id_Delete((ideal *)&(r->GetNC()->C),r);
2515  id_Delete((ideal *)&(r->GetNC()->D),r);
2516 
2517  if( rIsSCA(r) && (r->GetNC()->SCAQuotient() != NULL) )
2518  {
2519  id_Delete(&r->GetNC()->SCAQuotient(), r); // Custom SCA destructor!!!
2520  }
2521 
2522 
2523  nc_CleanUp(r);
2524 }
void * ADDRESS
Definition: auxiliary.h:119
void nc_CleanUp(nc_struct *p)
Definition: old.gring.cc:2469
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix

◆ nc_SetupQuotient()

bool nc_SetupQuotient ( ring  rGR,
const ring  rG = NULL,
bool  bCopy = false 
)

Definition at line 3411 of file old.gring.cc.

3412 {
3413  if( rGR->qideal == NULL )
3414  return false; // no quotient = no work! done!? What about factors of SCA?
3415 
3416  bool ret = true;
3417  // currently only super-commutative extension deals with factors.
3418 
3419  if( ncExtensions(SCAMASK) )
3420  {
3421  bool sca_ret = sca_SetupQuotient(rGR, rG, bCopy);
3422 
3423  if(sca_ret) // yes it was dealt with!
3424  ret = false;
3425  }
3426 
3427  if( bCopy )
3428  {
3429  assume(rIsPluralRing(rGR) == rIsPluralRing(rG));
3430  assume((rGR->qideal==NULL) == (rG->qideal==NULL));
3431  assume(rIsSCA(rGR) == rIsSCA(rG));
3432  assume(ncRingType(rGR) == ncRingType(rG));
3433  }
3434 
3435  return ret;
3436 }
bool sca_SetupQuotient(ring rGR, ring rG, bool bCopy)
Definition: sca.cc:911

◆ ncExtensions()

bool ncExtensions ( int  iMask)

Definition at line 94 of file old.gring.cc.

95 {
96  return ((getNCExtensions() & iMask) == iMask);
97 }
int & getNCExtensions()
Definition: old.gring.cc:82

◆ ncRingType() [1/4]

static nc_type& ncRingType ( nc_struct p)
inlinestatic

Definition at line 159 of file nc.h.

160 {
161  assume(p!=NULL);
162  return (p->ncRingType());
163 }

◆ ncRingType() [2/4]

static void ncRingType ( nc_struct p,
nc_type  t 
)
inlinestatic

Definition at line 179 of file nc.h.

180 {
181  assume(p!=NULL);
182  ncRingType(p) = t;
183 }

◆ ncRingType() [3/4]

static nc_type ncRingType ( ring  r)
inlinestatic

Definition at line 165 of file nc.h.

166 {
167  if(rIsPluralRing(r))
168  return (ncRingType(r->GetNC()));
169  else
170  return (nc_error);
171 }

◆ ncRingType() [4/4]

static void ncRingType ( ring  r,
nc_type  t 
)
inlinestatic

Definition at line 173 of file nc.h.

174 {
175  assume((r != NULL) && (r->GetNC() != NULL));
176  ncRingType(r->GetNC()) = t;
177 }

◆ pOppose()

poly pOppose ( ring  Rop_src,
poly  p,
const ring  Rop_dst 
)

opposes a vector p from Rop to currRing (dst!)

Definition at line 3350 of file old.gring.cc.

3351 {
3352  /* the simplest case:*/
3353  if ( Rop == dst ) return(p_Copy(p, dst));
3354  /* check Rop == rOpposite(currRing) */
3355 
3356 
3357  if ( !rIsLikeOpposite(dst, Rop) )
3358  {
3359  WarnS("an opposite ring should be used");
3360  return NULL;
3361  }
3362 
3363  nMapFunc nMap = n_SetMap(Rop->cf, dst->cf); // reverse?
3364 
3365  /* nMapFunc nMap = nSetMap(Rop);*/
3366  /* since we know that basefields coinside! */
3367 
3368  // coinside???
3369 
3370  int *perm=(int *)omAlloc0((Rop->N+1)*sizeof(int));
3371  if (!p_IsConstant(p, Rop))
3372  {
3373  /* we know perm exactly */
3374  int i;
3375  for(i=1; i<=Rop->N; i++)
3376  {
3377  perm[i] = Rop->N+1-i;
3378  }
3379  }
3380  poly res = p_PermPoly(p, perm, Rop, dst, nMap);
3381  omFreeSize((ADDRESS)perm,(Rop->N+1)*sizeof(int));
3382 
3383  p_Test(res, dst);
3384 
3385  return res;
3386 }
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition: coeffs.h:73
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:4126

◆ rIsLikeOpposite()

BOOLEAN rIsLikeOpposite ( ring  rBase,
ring  rCandidate 
)

checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so

Definition at line 3323 of file old.gring.cc.

3324 {
3325  /* the same basefield */
3326  int diagnose = TRUE;
3327  nMapFunc nMap = n_SetMap(rCandidate->cf, rBase->cf); // reverse?
3328 
3329 ////// if (nMap != nCopy) diagnose = FALSE;
3330  if (nMap == NULL) diagnose = FALSE;
3331 
3332 
3333  /* same number of variables */
3334  if (rBase->N != rCandidate->N) diagnose = FALSE;
3335  /* nc and comm ring */
3336  if ( rIsPluralRing(rBase) != rIsPluralRing(rCandidate) ) diagnose = FALSE;
3337  /* both are qrings */
3338  /* NO CHECK, since it is used in building opposite qring */
3339  /* if ( ((rBase->qideal != NULL) && (rCandidate->qideal == NULL)) */
3340  /* || ((rBase->qideal == NULL) && (rCandidate->qideal != NULL)) ) */
3341  /* diagnose = FALSE; */
3342  /* TODO: varnames are e->E etc */
3343  return diagnose;
3344 }

◆ rIsSCA()

static bool rIsSCA ( const ring  r)
inlinestatic

Definition at line 190 of file nc.h.

191 {
192 #ifdef HAVE_PLURAL
193  return rIsPluralRing(r) && (ncRingType(r) == nc_exterior);
194 #else
195  return false;
196 #endif
197 }

◆ setNCExtensions()

int setNCExtensions ( int  iMask)

Definition at line 87 of file old.gring.cc.

88 {
89  const int iOld = getNCExtensions();
90  getNCExtensions() = iMask;
91  return (iOld);
92 }

Variable Documentation

◆ GENERICMASK

const int GENERICMASK = 0x000

Definition at line 319 of file nc.h.

◆ NOCACHEMASK

const int NOCACHEMASK = 0x008

Definition at line 336 of file nc.h.

◆ NOFORMULAMASK

const int NOFORMULAMASK =0x004

Definition at line 335 of file nc.h.

◆ NOPLURALMASK

const int NOPLURALMASK = 0x002

Definition at line 334 of file nc.h.

◆ SCAMASK

const int SCAMASK = 0x001

Definition at line 320 of file nc.h.

◆ TESTSYZSCAMASK

const int TESTSYZSCAMASK = 0x0100 | SCAMASK

Definition at line 338 of file nc.h.