[singular] 01/09: singular_15435.patch

felix salfelder felix-guest at alioth.debian.org
Tue Sep 3 20:24:43 UTC 2013


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master-3-1-5
in repository singular.

commit 543679eef52dd2782f42da04dd9088f1fe835ebf
Author: Felix Salfelder <felix at salfelder.org>
Date:   Tue Sep 3 19:45:23 2013 +0200

    singular_15435.patch
---
 kernel/gring.cc |   14 +++-----------
 kernel/ring.cc  |   25 +++++++++++++++++++------
 kernel/ring.h   |   10 +++++-----
 3 files changed, 27 insertions(+), 22 deletions(-)

diff --git a/kernel/gring.cc b/kernel/gring.cc
index c811cca..d0abac9 100644
--- a/kernel/gring.cc
+++ b/kernel/gring.cc
@@ -35,9 +35,6 @@
 #include <kernel/p_Mult_q.h>
 #include <kernel/pInline1.h>
 
-// dirty tricks:
-#include <kernel/p_MemAdd.h>
-
 #include <kernel/gring.h>
 #include <kernel/sca.h>
 #include <summator.h>
@@ -458,8 +455,6 @@ poly gnc_mm_Mult_pp(const poly m, const poly p, const ring r)
   return( gnc_p_Mult_mm_Common(p_Copy(p,r), m, 0, r) );
 }
 
-
-
 poly gnc_mm_Mult_nn(int *F0, int *G0, const ring r)
 /* destroys nothing, no coeffs and exps */
 {
@@ -467,7 +462,6 @@ poly gnc_mm_Mult_nn(int *F0, int *G0, const ring r)
   int i,j;
   int iF,jG,iG;
   int rN=r->N;
-  int ExpSize=(((rN+1)*sizeof(int)+sizeof(long)-1)/sizeof(long))*sizeof(long);
 
   int *F=(int *)omAlloc0((rN+1)*sizeof(int));
   int *G=(int *)omAlloc0((rN+1)*sizeof(int));
@@ -476,7 +470,7 @@ poly gnc_mm_Mult_nn(int *F0, int *G0, const ring r)
   // pExpVectorCopy(F,F0);
   memcpy(G, G0,(rN+1)*sizeof(int));
   //  pExpVectorCopy(G,G0);
-  F[0]=0; /* important for p_MemAdd */
+  F[0]=0;
   G[0]=0;
 
   iF=rN;
@@ -500,10 +494,9 @@ poly gnc_mm_Mult_nn(int *F0, int *G0, const ring r)
   if (iF<=jG)
     /* i.e. no mixed exp_num , MERGE case */
   {
-    p_MemAdd_LengthGeneral(F, G, ExpSize/sizeof(long));
+    { for(int ii=rN;ii>0;ii--) F[ii]+=G[ii]; }
     p_SetExpV(out,F,r);
     p_Setm(out,r);
-    //    omFreeSize((ADDRESS)F,ExpSize);
     freeT(F,rN);
     freeT(G,rN);
     return(out);
@@ -562,11 +555,10 @@ poly gnc_mm_Mult_nn(int *F0, int *G0, const ring r)
       }
       cff=totcff;
     }
-    p_MemAdd_LengthGeneral(F, G, ExpSize/sizeof(long));
+    { for(int ii=rN;ii>0;ii--) F[ii]+=G[ii]; }
     p_SetExpV(out,F,r);
     p_Setm(out,r);
     p_SetCoeff(out,cff,r);
-    //    p_MemAdd_NegWeightAdjust(p, r); ??? do we need this?
     freeT(F,rN);
     freeT(G,rN);
     return(out);
diff --git a/kernel/ring.cc b/kernel/ring.cc
index 6b30f7f..e9819c9 100644
--- a/kernel/ring.cc
+++ b/kernel/ring.cc
@@ -1898,7 +1898,7 @@ BOOLEAN rSamePolyRep(ring r1, ring r2)
   return TRUE;
 }
 
-rOrderType_t rGetOrderType(ring r)
+rOrderType_t rGetOrderType(const ring r)
 {
   // check for simple ordering
   if (rHasSimpleOrder(r))
@@ -2016,7 +2016,7 @@ BOOLEAN rOrder_is_WeightedOrdering(rRingOrder_t order)
   }
 }
 
-BOOLEAN rHasSimpleOrderAA(ring r)
+BOOLEAN rHasSimpleOrderAA(const ring r)
 {
   if (r->order[0] == ringorder_unspec) return TRUE;
   int blocks = rBlocks(r) - 1;
@@ -2047,7 +2047,7 @@ BOOLEAN rHasSimpleOrderAA(ring r)
 }
 
 // return TRUE if p_SetComp requires p_Setm
-BOOLEAN rOrd_SetCompRequiresSetm(ring r)
+BOOLEAN rOrd_SetCompRequiresSetm(const ring r)
 {
   if (r->typ != NULL)
   {
@@ -2061,15 +2061,28 @@ BOOLEAN rOrd_SetCompRequiresSetm(ring r)
   return FALSE;
 }
 
+BOOLEAN rHasModuleOrder(const ring r)
+{
+  int i=0;
+  loop
+  {
+    if ((r->order[i]==ringorder_c)
+    || (r->order[i]==ringorder_C))
+      return TRUE;
+    if (r->order[i]==0) return FALSE;
+    i++;
+  }
+  return FALSE; /*never reached */
+}
 // return TRUE if p->exp[r->pOrdIndex] holds total degree of p */
-BOOLEAN rOrd_is_Totaldegree_Ordering(ring r)
+BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r)
 {
   // Hmm.... what about Syz orderings?
   return (rVar(r) > 1 &&
           ((rHasSimpleOrder(r) &&
            (rOrder_is_DegOrdering((rRingOrder_t)r->order[0]) ||
             rOrder_is_DegOrdering(( rRingOrder_t)r->order[1]))) ||
-           (rHasSimpleOrderAA(r) &&
+           (rHasSimpleOrderAA(r) && rHasModuleOrder(r) &&
             (rOrder_is_DegOrdering((rRingOrder_t)r->order[1]) ||
              rOrder_is_DegOrdering((rRingOrder_t)r->order[2])))));
 }
@@ -2084,7 +2097,7 @@ BOOLEAN rOrd_is_WeightedDegree_Ordering(ring r =currRing)
            rOrder_is_WeightedOrdering(( rRingOrder_t)r->order[1])));
 }
 
-BOOLEAN rIsPolyVar(int v, ring r)
+BOOLEAN rIsPolyVar(int v, const ring r)
 {
   int  i=0;
   while(r->order[i]!=0)
diff --git a/kernel/ring.h b/kernel/ring.h
index 58f8e8b..6b12af8 100644
--- a/kernel/ring.h
+++ b/kernel/ring.h
@@ -408,16 +408,16 @@ BOOLEAN rHasSimpleLexOrder(const ring r);
 //{ return (r->OrdSgn==-1); }
 #define rHasLocalOrMixedOrdering(R) ((R)->OrdSgn==-1)
 #define rHasLocalOrMixedOrdering_currRing() (pOrdSgn==-1)
-BOOLEAN rOrd_is_Totaldegree_Ordering(ring r =currRing);
+BOOLEAN rOrd_is_Totaldegree_Ordering(const ring r =currRing);
 
 /// return TRUE if p_SetComp requires p_Setm
-BOOLEAN rOrd_SetCompRequiresSetm(ring r);
-rOrderType_t    rGetOrderType(ring r);
+BOOLEAN rOrd_SetCompRequiresSetm(const ring r);
+rOrderType_t    rGetOrderType(const ring r);
 
 /// returns TRUE if var(i) belongs to p-block
-BOOLEAN rIsPolyVar(int i, ring r = currRing);
+BOOLEAN rIsPolyVar(int i, const ring r = currRing);
 
-static inline BOOLEAN rOrd_is_Comp_dp(ring r)
+static inline BOOLEAN rOrd_is_Comp_dp(const ring r)
 {
   return ((r->order[0] == ringorder_c || r->order[0] == ringorder_C) &&
           r->order[1] == ringorder_dp &&

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/singular.git



More information about the debian-science-commits mailing list