Changeset e6cbed in git


Ignore:
Timestamp:
Jun 20, 2006, 11:44:18 PM (18 years ago)
Author:
Oliver Wienand <wienand@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
451a9afc25d0cd3e8d7385616d5a2ae5fe690dbe
Parents:
0266acf035e867ba3e767b7d865bb68b4ab24eca
Message:
[oliver]

kutil.cc:
* posInT/L tests
* posInS update

kspoly.cc:
* coefficient in case of rings


git-svn-id: file:///usr/local/Singular/svn/trunk@9246 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/kspoly.cc

    r0266ac re6cbed  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kspoly.cc,v 1.5 2006-06-09 23:17:04 wienand Exp $ */
     4/* $Id: kspoly.cc,v 1.6 2006-06-20 21:44:18 wienand Exp $ */
    55/*
    66*  ABSTRACT -  Routines for Spoly creation and reductions
     
    483483      {
    484484        p_LmFree(m2,currRing);
    485         nNew(&(pGetCoeff(m1)));
     485#ifdef HAVE_RING2TOM
     486        if (currRing->cring == 1)
     487          pSetCoeff(m1, t2);
     488        else
     489#endif
     490          nNew(&(pGetCoeff(m1)));
    486491        return m1;
    487492      }
     
    489494      {
    490495        p_LmFree(m1,currRing);
    491         nNew(&(pGetCoeff(m2)));
     496#ifdef HAVE_RING2TOM
     497        if (currRing->cring == 1)
     498            pSetCoeff(m2, t1);
     499        else
     500#endif
     501          nNew(&(pGetCoeff(m2)));
    492502        return m2;
    493503      }
  • kernel/kutil.cc

    r0266ac re6cbed  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.28 2006-06-12 17:40:09 wienand Exp $ */
     4/* $Id: kutil.cc,v 1.29 2006-06-20 21:44:18 wienand Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for kStd
     
    22772277  int i;
    22782278  int an = 0;
    2279   int en= length;
    2280   int cmp_int=pOrdSgn;
     2279  int en = length;
     2280  int cmp_int = pOrdSgn;
    22812281  if (currRing->MixedOrder)
    22822282  {
     
    23112311      if (pLmCmp(set[length],p)== -cmp_int)
    23122312        return length+1;
    2313 
     2313      int cmp;
    23142314      loop
    23152315      {
    23162316        if (an >= en-1)
    23172317        {
    2318           if (pLmCmp(set[an],p) == cmp_int)  return an;
    2319           if (pLmCmp(set[an],p) == -cmp_int) return en;
    2320           if (currRing->cring == 1) {
    2321               if (nGreater(pGetCoeff(p), pGetCoeff(set[an]))) return en;
    2322               return an;
    2323           }
    2324           if ((cmp_int!=1) && ((strat->ecartS[an])>ecart_p)) return an;
    2325           return en;
    2326         }
    2327         i=(an+en) / 2;
    2328         if (pLmCmp(set[i],p) == cmp_int)         en=i;
    2329         else if (pLmCmp(set[i],p) == -cmp_int)   an=i;
     2318          cmp = pLmCmp(set[an],p);
     2319          if (cmp == cmp_int)  return an;
     2320          if (cmp == -cmp_int) return en;
     2321          if (nGreater(pGetCoeff(p), pGetCoeff(set[an]))) return en;
     2322          return an;
     2323        }
     2324        i = (an+en) / 2;
     2325        cmp = pLmCmp(set[i],p);
     2326        if (cmp == cmp_int)         en = i;
     2327        else if (cmp == -cmp_int)   an = i;
    23302328        else
    23312329        {
    2332           if (currRing->cring == 1) {
    2333               if (nGreater(pGetCoeff(p), pGetCoeff(set[i]))) an = i;
    2334               else en = i;
    2335           }
    2336           else
    2337           {
    2338             if ((cmp_int!=1) && ((strat->ecartS[i])<ecart_p))
    2339               en=i;
    2340             else
    2341               an=i;
    2342           }
     2330          if (nGreater(pGetCoeff(p), pGetCoeff(set[i]))) an = i;
     2331          else en = i;
    23432332        }
    23442333      }
     
    25002489}
    25012490
     2491/*2 Pos for rings T: Here I am
     2492* looks up the position of p in T
     2493* set[0] is the smallest with respect to the ordering-procedure
     2494* totaldegree,pComp
     2495*/
     2496int posInTrg0 (const TSet set,const int length,LObject &p)
     2497{
     2498  if (length==-1) return 0;
     2499  int o = p.GetpFDeg();
     2500  int op = set[length].GetpFDeg();
     2501  int i;
     2502  int an = 0;
     2503  int en = length;
     2504  int cmp_int = pOrdSgn;
     2505  if ((op < o) || (pLmCmp(set[length].p,p.p)== -cmp_int))
     2506    return length+1;
     2507  int cmp;
     2508  loop
     2509  {
     2510    if (an >= en-1)
     2511    {
     2512      op = set[an].GetpFDeg();
     2513      if (op > o) return an;
     2514      if (op < 0) return en;
     2515      cmp = pLmCmp(set[an].p,p.p);
     2516      if (cmp == cmp_int)  return an;
     2517      if (cmp == -cmp_int) return en;
     2518      if (nGreater(pGetCoeff(p.p), pGetCoeff(set[an].p))) return en;
     2519      return an;
     2520    }
     2521    i = (an + en) / 2;
     2522    op = set[i].GetpFDeg();
     2523    if (op > o)       en = i;
     2524    else if (op < o)  an = i;
     2525    else
     2526    {
     2527      cmp = pLmCmp(set[i].p,p.p);
     2528      if (cmp == cmp_int)                                     en = i;
     2529      else if (cmp == -cmp_int)                               an = i;
     2530      else if (nGreater(pGetCoeff(p.p), pGetCoeff(set[i].p))) an = i;
     2531      else                                                    en = i;
     2532    }
     2533  }
     2534}
     2535/*
     2536  int o = p.GetpFDeg();
     2537  int op = set[length].GetpFDeg();
     2538
     2539  if ((op < o)
     2540  || ((op == o) && (pLmCmp(set[length].p,p.p) != pOrdSgn)))
     2541    return length+1;
     2542
     2543  int i;
     2544  int an = 0;
     2545  int en= length;
     2546
     2547  loop
     2548  {
     2549    if (an >= en-1)
     2550    {
     2551      op= set[an].GetpFDeg();
     2552      if ((op > o)
     2553      || (( op == o) && (pLmCmp(set[an].p,p.p) == pOrdSgn)))
     2554        return an;
     2555      return en;
     2556    }
     2557    i=(an+en) / 2;
     2558    op = set[i].GetpFDeg();
     2559    if (( op > o)
     2560    || (( op == o) && (pLmCmp(set[i].p,p.p) == pOrdSgn)))
     2561      en=i;
     2562    else
     2563      an=i;
     2564  }
     2565}
     2566  */
    25022567/*2
    25032568* looks up the position of p in T
     
    29853050  }
    29863051}
     3052
     3053/*2 Position for rings L: Here I am
     3054* looks up the position of polynomial p in set
     3055* e is the ecart of p
     3056* set[length] is the smallest element in set with respect
     3057* to the ordering-procedure totaldegree,pComp
     3058*/
     3059inline int getIndexRng(long coeff)
     3060{
     3061  if (coeff == 0) return -1;
     3062  long tmp = coeff;
     3063  int ind = 0;
     3064  while (tmp % 2 == 0) {
     3065    tmp = tmp / 2;
     3066    ind++;
     3067  }
     3068  return ind;
     3069}
     3070
     3071int posInLrg0 (const LSet set, const int length,
     3072              LObject* p,const kStrategy strat)
     3073/*          if (nGreater(pGetCoeff(p), pGetCoeff(set[an]))) return en;
     3074        if (pLmCmp(set[i],p) == cmp_int)         en = i;
     3075        else if (pLmCmp(set[i],p) == -cmp_int)   an = i;
     3076        else
     3077        {
     3078          if (nGreater(pGetCoeff(p), pGetCoeff(set[i]))) an = i;
     3079          else en = i;
     3080        }*/
     3081{
     3082  if (length < 0) return 0;
     3083
     3084  int o = p->GetpFDeg();
     3085  int op = set[length].GetpFDeg();
     3086
     3087  if ((op > o) || ((op == o) && (pLmCmp(set[length].p,p->p) != -pOrdSgn)))
     3088    return length + 1;
     3089  int i;
     3090  int an = 0;
     3091  int en = length;
     3092  loop
     3093  {
     3094    if (an >= en - 1)
     3095    {
     3096      op = set[an].GetpFDeg();
     3097      if ((op > o) || ((op == o) && (pLmCmp(set[an].p,p->p) != -pOrdSgn)))
     3098        return en;
     3099      return an;
     3100    }
     3101    i = (an+en) / 2;
     3102    op = set[i].GetpFDeg();
     3103    if ((op > o) || ((op == o) && (pLmCmp(set[i].p,p->p) != -pOrdSgn)))
     3104      an = i;
     3105    else
     3106      en = i;
     3107  }
     3108}
     3109
     3110/*{
     3111  if (length < 0) return 0;
     3112
     3113  int o = p->GetpFDeg();
     3114  int op = set[length].GetpFDeg();
     3115
     3116  int inde = getIndexRng((unsigned long) pGetCoeff(set[length].p));
     3117  int indp = getIndexRng((unsigned long) pGetCoeff(p->p));
     3118  int inda;
     3119  int indi;
     3120
     3121  if ((inda > indp) || ((inda == inde) && ((op > o) || ((op == o) && (pLmCmp(set[length].p,p->p) != -pOrdSgn)))))
     3122    return length + 1;
     3123  int i;
     3124  int an = 0;
     3125  inda = getIndexRng((unsigned long) pGetCoeff(set[an].p));
     3126  int en = length;
     3127  loop
     3128  {
     3129    if (an >= en-1)
     3130    {
     3131      op = set[an].GetpFDeg();
     3132      if ((indp > inda) || ((indp == inda) && ((op > o) || ((op == o) && (pLmCmp(set[an].p,p->p) != -pOrdSgn)))))
     3133        return en;
     3134      return an;
     3135    }
     3136    i = (an + en) / 2;
     3137    indi = getIndexRng((unsigned long) pGetCoeff(set[i].p));
     3138    op = set[i].GetpFDeg();
     3139    if ((indi > indp) || ((indi == indp) && ((op > o) || ((op == o) && (pLmCmp(set[i].p,p->p) != -pOrdSgn)))))
     3140    // if ((op > o) || ((op == o) && (pLmCmp(set[i].p,p->p) != -pOrdSgn)))
     3141    {
     3142      an = i;
     3143      inda = getIndexRng((unsigned long) pGetCoeff(set[an].p));
     3144    }
     3145    else
     3146      en = i;
     3147  }
     3148} */
    29873149
    29883150/*2
     
    46544816  else if (BTEST1(12) || BTEST1(14) || BTEST1(16) || BTEST1(18))
    46554817    strat->posInT = posInT1;
     4818#ifdef HAVE_RING2TOM
     4819  if (currRing->cring == 1)
     4820  {
     4821    strat->posInL = posInL11;
     4822    strat->posInT = posInT11;
     4823  }
     4824#endif
    46564825  strat->posInLDependsOnLength = kPosInLDependsOnLength(strat->posInL);
    46574826}
Note: See TracChangeset for help on using the changeset viewer.