My Project
Loading...
Searching...
No Matches
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)
 

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
 
BOOLEAN rIsLikeOpposite (ring rBase, ring rCandidate)
 checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so
 
void nc_rKill (ring r)
 complete destructor
 
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
 
poly _nc_pp_Mult_qq (const poly p, const poly q, const ring r)
 general NC-multiplication without destruction
 
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
 
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
 
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
 
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!
 
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!)
 
ideal idOppose (ring Rop_src, ideal I, const ring Rop_dst)
 opposes a module I from Rop to currRing(dst)
 
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 )
Value:
( (nVar * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) )
int i
Definition cfEzgcd.cc:132
int j
Definition facHensel.cc:110

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:125
CPolynomialSummator: unifies bucket and polynomial summation as the later is broken 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:107
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:1033
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
static poly p_LmDeleteAndNext(poly p, const ring r)
Definition p_polys.h:757
#define p_Test(p, r)
Definition p_polys.h:161
static BOOLEAN rIsNCRing(const ring r)
Definition ring.h:427
#define rTest(r)
Definition ring.h:794

◆ _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:4086
#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 int ncols
Definition cf_linsys.cc:32
int ncols
Definition matpol.h:21
poly * m
Definition matpol.h:18
static nc_struct *& GetNC(ring r)
Definition nc.h:154
ip_smatrix * matrix
Definition matpol.h:43
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:406
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:128
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 3363 of file old.gring.cc.

3364{
3365 /* the simplest case:*/
3366 if ( Rop == dst ) return id_Copy(I, dst);
3367
3368 /* check Rop == rOpposite(currRing) */
3369 if (!rIsLikeOpposite(dst, Rop))
3370 {
3371 WarnS("an opposite ring should be used");
3372 return NULL;
3373 }
3374 int i;
3375 ideal idOp = idInit(I->ncols, I->rank);
3376 for (i=0; i< (I->ncols)*(I->nrows); i++)
3377 {
3378 idOp->m[i] = pOppose(Rop,I->m[i], dst);
3379 }
3380 id_Test(idOp, dst);
3381 return idOp;
3382}
#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!)
BOOLEAN rIsLikeOpposite(ring rBase, ring rCandidate)
checks whether rings rBase and rCandidate could be opposite to each other returns TRUE if it is so
ideal idInit(int idsize, int rank)
initialise an ideal / module
#define id_Test(A, lR)

◆ 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 2692 of file old.gring.cc.

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

◆ nc_CheckSubalgebra()

BOOLEAN nc_CheckSubalgebra ( poly PolyVar,
ring r )

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

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

◆ 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:1681
void p_Lcm(const poly a, const poly b, poly m, const ring r)
Definition p_polys.cc:1659
static BOOLEAN rIsRatGRing(const ring r)
Definition ring.h:433

◆ 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{
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;
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;
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{
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:637
poly nc_mm_Bracket_nn(poly m1, poly m2, const ring r)
returns [m1,m2] for two monoms, destroys nothing without coeffs
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:4685
static int pLength(poly a)
Definition p_polys.h:190
#define __p_Mult_nn(p, n, r)
Definition p_polys.h:973
#define Q
Definition sirandom.c:26

◆ 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:1109
static poly p_Add_q(poly p, poly q, const ring r)
Definition p_polys.h:938
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition p_polys.h:848

◆ 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 3161 of file old.gring.cc.

3162{
3163 assume(rIsPluralRing(rGR));
3164 assume(p_Procs!=NULL);
3165
3166 gnc_p_ProcsSet(rGR, p_Procs);
3167
3168 if(rIsSCA(rGR) && ncExtensions(SCAMASK) )
3169 {
3170 sca_p_ProcsSet(rGR, p_Procs);
3171 }
3172
3175
3176 if(!rIsSCA(rGR) && !ncExtensions(NOFORMULAMASK))
3178
3179}
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:1223
bool ncInitSpecialPowersMultiplication(ring r)
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)

◆ 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)
void nc_PolyPolyRedOld(poly &b, poly p, number *c, const ring r)

◆ 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:616
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:1298
poly p_NSet(number n, const ring r)
returns the poly representing the number n, destroys n
Definition p_polys.cc:1474
long p_Deg(poly a, const ring r)
Definition p_polys.cc:586
#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 3185 of file old.gring.cc.

3186{
3187 int rN = r->N;
3188 int *PRE = (int *)omAlloc0((rN+1)*sizeof(int));
3189 int *SUF = (int *)omAlloc0((rN+1)*sizeof(int));
3190 int i,pow;
3191 number C;
3192 poly suf,pre;
3193 poly res = NULL;
3194 poly out = NULL;
3195 while ( p!= NULL )
3196 {
3197 C = p_GetCoeff(p, r);
3198 p_GetExpV(p, PRE, r); /* faster splitting? */
3199 pow = PRE[n]; PRE[n]=0;
3200 res = NULL;
3201 if (pow!=0)
3202 {
3203 for (i=n+1; i<=rN; i++)
3204 {
3205 SUF[i] = PRE[i];
3206 PRE[i] = 0;
3207 }
3208 res = p_Power(p_Copy(e, r),pow, r);
3209 /* multiply with prefix */
3210 pre = p_One(r);
3211 p_SetExpV(pre,PRE, r);
3212 p_Setm(pre, r);
3213 res = nc_mm_Mult_p(pre,res, r);
3214 /* multiply with suffix */
3215 suf = p_One(r);
3216 p_SetExpV(suf,SUF, r);
3217 p_Setm(suf, r);
3218 res = p_Mult_mm(res,suf, r);
3219 res = __p_Mult_nn(res,C, r);
3220 p_SetComp(res,PRE[0], r);
3221 }
3222 else /* pow==0 */
3223 {
3224 res = p_Head(p, r);
3225 }
3226 p = p_LmDeleteAndNext(p, r);
3227 out = p_Add_q(out,res, r);
3228 }
3229 freeT(PRE,rN);
3230 freeT(SUF,rN);
3231 return(out);
3232}
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:2201
poly p_One(const ring r)
Definition p_polys.cc:1314
static void p_SetExpV(poly p, int *ev, const ring r)
Definition p_polys.h:1560
static unsigned long p_SetComp(poly p, unsigned long c, ring r)
Definition p_polys.h:249
static void p_Setm(poly p, const ring r)
Definition p_polys.h:235
static poly p_Head(const poly p, const ring r)
copy the (leading) term of p
Definition p_polys.h:862
static poly p_Mult_mm(poly p, poly m, const ring r)
Definition p_polys.h:1053

◆ nc_rComplete()

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

Definition at line 5833 of file ring.cc.

5838{
5839// NOTE: Originally used only by idElimination to transfer NC structure to dest
5840// ring created by dirty hack (without nc_CallPlural)
5841 rTest(src);
5842
5843 assume(!rIsPluralRing(dest)); // destination must be a newly constructed commutative ring
5844
5845 if (!rIsPluralRing(src))
5846 {
5847 return FALSE;
5848 }
5849
5850 const int N = dest->N;
5851
5852 assume(src->N == N);
5853
5854// ring save = currRing;
5855
5856// if (dest != save)
5857// rChangeCurrRing(dest);
5858
5859 const ring srcBase = src;
5860
5861 assume( n_SetMap(srcBase->cf,dest->cf) == n_SetMap(dest->cf,dest->cf) ); // currRing is important here!
5862
5863 matrix C = mpNew(N,N); // ring independent
5864 matrix D = mpNew(N,N);
5865
5866 matrix C0 = src->GetNC()->C;
5867 matrix D0 = src->GetNC()->D;
5868
5869 // map C and D into dest
5870 for (int i = 1; i < N; i++)
5871 {
5872 for (int j = i + 1; j <= N; j++)
5873 {
5874 const number n = n_Copy(p_GetCoeff(MATELEM(C0,i,j), srcBase), srcBase->cf); // src, mapping for coeffs into currRing = dest!
5875 const poly p = p_NSet(n, dest);
5876 MATELEM(C,i,j) = p;
5877 if (MATELEM(D0,i,j) != NULL)
5878 MATELEM(D,i,j) = prCopyR(MATELEM(D0,i,j), srcBase, dest); // ?
5879 }
5880 }
5881 /* One must test C and D _only_ in r->GetNC()->basering!!! not in r!!! */
5882
5883 id_Test((ideal)C, dest);
5884 id_Test((ideal)D, dest);
5885
5886 if (nc_CallPlural(C, D, NULL, NULL, dest, bSetupQuotient, false, true, dest)) // also takes care about quotient ideal
5887 {
5888 //WarnS("Error transferring non-commutative structure");
5889 // error message should be in the interpreter interface
5890
5891 mp_Delete(&C, dest);
5892 mp_Delete(&D, dest);
5893
5894// if (currRing != save)
5895// rChangeCurrRing(save);
5896
5897 return TRUE;
5898 }
5899
5900// mp_Delete(&C, dest); // used by nc_CallPlural!
5901// mp_Delete(&D, dest);
5902
5903// if (dest != save)
5904// rChangeCurrRing(save);
5905
5906 assume(rIsPluralRing(dest));
5907 return FALSE;
5908}
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:455
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
Definition coeffs.h:701
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,...
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 2989 of file old.gring.cc.

2990{
2991 if (nc_CallPlural(r->GetNC()->C, r->GetNC()->D, NULL, NULL, res, bSetupQuotient, true, true, r))
2992 {
2993 WarnS("Error occurred while coping/setuping the NC structure!"); // No reaction!???
2994 return true; // error
2995 }
2996
2997 return false;
2998}
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,...

◆ nc_ReduceSpoly()

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

Definition at line 254 of file nc.h.

255{
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 int mat_size=rN*(rN-1)/2;
2511 mat_size=si_max(1,mat_size);
2512 omFreeSize((ADDRESS)r->GetNC()->MT,mat_size*sizeof(matrix));
2513 omFreeSize((ADDRESS)r->GetNC()->MTsize,mat_size*sizeof(int));
2514 id_Delete((ideal *)&(r->GetNC()->COM),r);
2515 }
2516 id_Delete((ideal *)&(r->GetNC()->C),r);
2517 id_Delete((ideal *)&(r->GetNC()->D),r);
2518
2519 if( rIsSCA(r) && (r->GetNC()->SCAQuotient() != NULL) )
2520 {
2521 id_Delete(&r->GetNC()->SCAQuotient(), r); // Custom SCA destructor!!!
2522 }
2523
2524
2525 nc_CleanUp(r);
2526}
void * ADDRESS
Definition auxiliary.h:120
void nc_CleanUp(nc_struct *p)
#define omFreeSize(addr, size)
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 3385 of file old.gring.cc.

3386{
3387 if( rGR->qideal == NULL )
3388 return false; // no quotient = no work! done!? What about factors of SCA?
3389
3390 bool ret = true;
3391 // currently only super-commutative extension deals with factors.
3392
3393 if( ncExtensions(SCAMASK) )
3394 {
3395 bool sca_ret = sca_SetupQuotient(rGR, rG, bCopy);
3396
3397 if(sca_ret) // yes it was dealt with!
3398 ret = false;
3399 }
3400
3401 if( bCopy )
3402 {
3403 assume(rIsPluralRing(rGR) == rIsPluralRing(rG));
3404 assume((rGR->qideal==NULL) == (rG->qideal==NULL));
3405 assume(rIsSCA(rGR) == rIsSCA(rG));
3406 assume(ncRingType(rGR) == ncRingType(rG));
3407 }
3408
3409 return ret;
3410}
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 3324 of file old.gring.cc.

3325{
3326 /* the simplest case:*/
3327 if ( Rop == dst ) return(p_Copy(p, dst));
3328 /* check Rop == rOpposite(currRing) */
3329
3330
3331 if ( !rIsLikeOpposite(dst, Rop) )
3332 {
3333 WarnS("an opposite ring should be used");
3334 return NULL;
3335 }
3336
3337 nMapFunc nMap = n_SetMap(Rop->cf, dst->cf); // reverse?
3338
3339 /* nMapFunc nMap = nSetMap(Rop);*/
3340 /* since we know that basefields coincide! */
3341
3342 // coincide???
3343
3344 int *perm=(int *)omAlloc0((Rop->N+1)*sizeof(int));
3345 if (!p_IsConstant(p, Rop))
3346 {
3347 /* we know perm exactly */
3348 int i;
3349 for(i=1; i<=Rop->N; i++)
3350 {
3351 perm[i] = Rop->N+1-i;
3352 }
3353 }
3354 poly res = p_PermPoly(p, perm, Rop, dst, nMap);
3355 omFreeSize((ADDRESS)perm,(Rop->N+1)*sizeof(int));
3356
3357 p_Test(res, dst);
3358
3359 return res;
3360}
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
Definition coeffs.h:80
poly p_PermPoly(poly p, const int *perm, const ring oldRing, const ring dst, nMapFunc nMap, const int *par_perm, int OldPar, BOOLEAN use_mult)
Definition p_polys.cc:4211

◆ 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 3297 of file old.gring.cc.

3298{
3299 /* the same basefield */
3300 int diagnose = TRUE;
3301 nMapFunc nMap = n_SetMap(rCandidate->cf, rBase->cf); // reverse?
3302
3303////// if (nMap != nCopy) diagnose = FALSE;
3304 if (nMap == NULL) diagnose = FALSE;
3305
3306
3307 /* same number of variables */
3308 if (rBase->N != rCandidate->N) diagnose = FALSE;
3309 /* nc and comm ring */
3310 if ( rIsPluralRing(rBase) != rIsPluralRing(rCandidate) ) diagnose = FALSE;
3311 /* both are qrings */
3312 /* NO CHECK, since it is used in building opposite qring */
3313 /* if ( ((rBase->qideal != NULL) && (rCandidate->qideal == NULL)) */
3314 /* || ((rBase->qideal == NULL) && (rCandidate->qideal != NULL)) ) */
3315 /* diagnose = FALSE; */
3316 /* TODO: varnames are e->E etc */
3317 return diagnose;
3318}

◆ 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.