Changeset f9591a in git


Ignore:
Timestamp:
Aug 3, 2011, 3:52:14 PM (12 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
567abae6e8087f803d5e7dc28c7fda93123381ce
Parents:
79ea4809aa81094eb116bd40570e1ef79259ab31
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-08-03 15:52:14+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 13:14:17+01:00
Message:
id_ChineseRemainder
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/ideals.cc

    r79ea48 rf9591a  
    696696      {
    697697        if (p_MinComp(s_h3->m[j],syz_ring) > k)
    698           p_Shift(&s_h3->m[j], -k,currRing);
     698          p_Shift(&s_h3->m[j], -k,syz_ring);
    699699        else
    700           pDelete(&s_h3->m[j]);
     700          p_Delete(&s_h3->m[j],syz_ring);
    701701      }
    702702    }
     
    727727        e->m[j] = s_h3->m[j];
    728728        isMonomial=isMonomial && (pNext(s_h3->m[j])==NULL);
    729         pDelete(&pNext(s_h3->m[j]));
     729        p_Delete(&pNext(s_h3->m[j]),syz_ring);
    730730        s_h3->m[j] = NULL;
    731731      }
     
    918918        }
    919919        else
    920           pDelete(&(s_h3->m[j]));
     920          p_Delete(&(s_h3->m[j]),currRing);
    921921      }
    922922    }
     
    10991099    {
    11001100      if ((s_h3->m[j] != NULL) && (pMinComp(s_h3->m[j]) > k))
    1101         pDelete(&(s_h3->m[j]));
     1101        p_Delete(&(s_h3->m[j]),currRing);
    11021102    }
    11031103  }
     
    12651265        pNormalize(p);
    12661266        if((w==NULL)&&(pDeg(p0)>n)||(w!=NULL)&&(pDegW(p0,w)>n))
    1267           pDelete(&p0);
     1267          p_Delete(&p0,currRing);
    12681268        else
    12691269          MATELEM(T,j+1,i+1)=pAdd(MATELEM(T,j+1,i+1),p0);
     
    12791279          if(((w==NULL)&&(pDeg(p0)>n))
    12801280          ||((w!=NULL)&&(pDegW(p0,w)>n)))
    1281             pDelete(&p0);
     1281            p_Delete(&p0,currRing);
    12821282          else
    12831283            R->m[i]=pAdd(R->m[i],p0);
     
    14761476    }
    14771477    else
    1478       pDelete(&s_h3->m[i]);
     1478      p_Delete(&s_h3->m[i],currRing);
    14791479  }
    14801480  if (resultIsIdeal)
     
    17821782            q = p;
    17831783            p = kNF(R,currQuotient,q);
    1784             pDelete(&q);
     1784            p_Delete(&q,currRing);
    17851785          }
    17861786          /*delete the matrix tmp*/
     
    18461846          q = p;
    18471847          p = kNF(R,currQuotient,q);
    1848           pDelete(&q);
     1848          p_Delete(&q,currRing);
    18491849        }
    18501850        if (p!=NULL)
     
    19521952      if (p != NULL)
    19531953      {
    1954         pDelete(&p);
     1954        p_Delete(&p,currRing);
    19551955        return FALSE;
    19561956      }
     
    22192219    && (pGetComp(s_temp1->m[i])<=length))
    22202220    {
    2221       pDelete(&(s_temp1->m[i]));
     2221      p_Delete(&(s_temp1->m[i]),currRing);
    22222222    }
    22232223    else
     
    23422342  *pos = idIndexOfKBase(base,kbase);
    23432343  if (*pos<0)
    2344     pDelete(&coeff);
    2345   pDelete(&base);
     2344    p_Delete(&coeff,currRing);
     2345  p_Delete(&base,currRing);
    23462346  return coeff;
    23472347}
     
    23832383      }
    23842384      else
    2385         pDelete(&q);
     2385        p_Delete(&q,currRing);
    23862386      pIter(p);
    23872387    }
     
    24702470  idDelete(&S);
    24712471  poly gcd_p=singclap_pdivide(f,gg,r);
    2472   pDelete(&gg);
     2472  p_Delete(&gg,r);
    24732473  rChangeCurrRing(save_r);
    24742474  return gcd_p;
     
    24842484*/
    24852485#ifdef HAVE_FACTORY
    2486 ideal idChineseRemainder(ideal *xx, number *q, int rl)
     2486ideal id_ChineseRemainder(ideal *xx, number *q, int rl, const ring R)
    24872487{
    24882488  int cnt=IDELEMS(xx[0])*xx[0]->nrows;
     
    25032503        h=xx[j]->m[i];
    25042504        if ((h!=NULL)
    2505         &&((r==NULL)||(pLmCmp(r,h)==-1)))
     2505        &&((r==NULL)||(p_LmCmp(r,h,R)==-1)))
    25062506          r=h;
    25072507      }
    25082508      if (r==NULL) break;
    2509       h=pHead(r);
     2509      h=p_Head(r,R);
    25102510      for(j=rl-1;j>=0;j--)
    25112511      {
    25122512        hh=xx[j]->m[i];
    2513         if ((hh!=NULL) && (pLmCmp(r,hh)==0))
     2513        if ((hh!=NULL) && (p_LmCmp(r,hh,R)==0))
    25142514        {
    25152515          x[j]=pGetCoeff(hh);
    2516           hh=pLmFreeAndNext(hh);
     2516          hh=p_LmFreeAndNext(hh,R);
    25172517          xx[j]->m[i]=hh;
    25182518        }
    25192519        else
    2520           x[j]=nlInit(0, currRing);
    2521       }
    2522       number n=nlChineseRemainder(x,q,rl);
     2520          x[j]=n_Init(0, R->cf);
     2521      }
     2522      number n=n_ChineseRemainder(x,q,rl,R->cf);
    25232523      for(j=rl-1;j>=0;j--)
    25242524      {
    25252525        x[j]=NULL; // nlInit(0...) takes no memory
    25262526      }
    2527       if (nlIsZero(n)) pDelete(&h);
     2527      if (n_IsZero(n,R->cf)) p_Delete(&h,R);
    25282528      else
    25292529      {
    2530         pSetCoeff(h,n);
     2530        p_SetCoeff(h,n,R);
    25312531        //Print("new mon:");pWrite(h);
    2532         res_p=pAdd(res_p,h);
     2532        res_p=p_Add_q(res_p,h,R);
    25332533      }
    25342534    }
     
    25362536  }
    25372537  omFree(x);
    2538   for(i=rl-1;i>=0;i--) idDelete(&(xx[i]));
     2538  for(i=rl-1;i>=0;i--) id_Delete(&(xx[i]),R);
    25392539  omFree(xx);
    25402540  return result;
     
    25572557 * lift ideal with coeffs over Z (mod N) to Q via Farey
    25582558 */
    2559 ideal idFarey(ideal x, number N)
     2559ideal id_Farey(ideal x, number N, const ring r)
    25602560{
    25612561  int cnt=IDELEMS(x)*x->nrows;
     
    25672567  for(i=cnt-1;i>=0;i--)
    25682568  {
    2569     poly h=pCopy(x->m[i]);
     2569    poly h=p_Copy(x->m[i],r);
    25702570    result->m[i]=h;
    25712571    while(h!=NULL)
    25722572    {
    25732573      number c=pGetCoeff(h);
    2574       pSetCoeff0(h,nlFarey(c,N));
    2575       nDelete(&c);
     2574      pSetCoeff0(h,n_Farey(c,N,r->cf));
     2575      n_Delete(&c,r->cf);
    25762576      pIter(h);
    25772577    }
    2578     while((result->m[i]!=NULL)&&(nIsZero(pGetCoeff(result->m[i]))))
    2579     {
    2580       pLmDelete(&(result->m[i]));
     2578    while((result->m[i]!=NULL)&&(n_IsZero(pGetCoeff(result->m[i]),r->cf)))
     2579    {
     2580      p_LmDelete(&(result->m[i]),r);
    25812581    }
    25822582    h=result->m[i];
    25832583    while((h!=NULL) && (pNext(h)!=NULL))
    25842584    {
    2585       if(nIsZero(pGetCoeff(pNext(h))))
    2586       {
    2587         pLmDelete(&pNext(h));
     2585      if(n_IsZero(pGetCoeff(pNext(h)),r->cf))
     2586      {
     2587        p_LmDelete(&pNext(h),r);
    25882588      }
    25892589      else pIter(h);
  • kernel/ideals.h

    r79ea48 rf9591a  
    188188poly id_GCD(poly f, poly g, const ring r);
    189189
    190 ideal idChineseRemainder(ideal *x, number *q, int rl);
     190ideal id_ChineseRemainder(ideal *x, number *q, int rl, const ring R);
    191191//ideal idChineseRemainder(ideal *x, intvec *iv); /* currently unused */
    192 ideal idFarey(ideal x, number N);
     192ideal id_Farey(ideal x, number N, const ring r);
    193193
    194194ideal id_TensorModuleMult(const int m, const ideal M, const ring rRing); // image of certain map for BGG
  • libpolys/coeffs/coeffs.h

    r79ea48 rf9591a  
    566566}
    567567
    568 static inline number n_farey(number a, number b, const coeffs r)
     568static inline number n_Farey(number a, number b, const coeffs r)
    569569{
    570570  assume(r != NULL);
Note: See TracChangeset for help on using the changeset viewer.