Changeset 7eb7b5 in git for libpolys/polys/monomials


Ignore:
Timestamp:
Jan 17, 2011, 7:20:24 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
1389a4dfb4e7b64fff56b85086d65dd004f4abbd
Parents:
dd012ca0a6f4728f90e73a6a9081c7310c1cc509
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2011-01-17 19:20:24+01:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:59:25+01:00
Message:
syntax fixes for libpoly, part 7: ring constructions
Location:
libpolys/polys/monomials
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/monomials/p_polys.cc

    rdd012ca r7eb7b5  
    1818#include <polys/monomials/ring.h>
    1919#include <coeffs/longrat.h>
     20#include <misc/options.h>
    2021// #include <???/ideals.h>
    2122// #include <???/int64vec.h>
     
    15971598  poly tail, b, res, h;
    15981599  number x;
    1599   number *bin = pnBin(exp);
     1600  number *bin = pnBin(exp,r);
    16001601
    16011602  tail = pNext(p);
     
    20712072  number d=pGetCoeff(ph);
    20722073  int s=naParDeg(d);
    2073   if (s /* naParDeg(d)*/ <=1) return naCopy(d);
     2074  if (s /* naParDeg(d)*/ <=1) return n_Copy(d,r->cf);
    20742075  int s2=-1;
    20752076  number d2;
     
    29092910        }
    29102911      }
    2911       pTest(aq);
     2912      p_Test(aq,dst);
    29122913    }
    29132914    if (rRing_has_Comp(dst)) p_SetComp(qq, p_GetComp(p,oldRing),dst);
     
    29502951              {
    29512952                lnumber mmc=(lnumber)naInit(1,dst);
    2952                 napSetExp(mmc->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/);
    2953                 napSetm(mmc->z);
     2953                p_SetExp(mmc->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/,dst->algring);
     2954                p_Setm(mmc->z,dst->algring->cf);
    29542955                pGetCoeff(qq)=naMult((number)c,(number)mmc);
    29552956                n_Delete((number *)&c,dst->cf);
  • libpolys/polys/monomials/ring.cc

    rdd012ca r7eb7b5  
    1616#include <polys/monomials/ring.h>
    1717#include <polys/monomials/p_polys.h>
     18#include <polys/simpleideals.h>
    1819#include <coeffs/numbers.h>
    1920// #include <???/febase.h>
     
    215216}
    216217
    217 // set R->order, R->block, R->wvhdl, r->OrdSgn from sleftv
    218 BOOLEAN rSleftvOrdering2Ordering(sleftv *ord, ring R);
    219 
    220 // get array of strings from list of sleftv's
    221 BOOLEAN rSleftvList2StringArray(sleftv* sl, char** p);
    222 
    223 
    224218/*2
    225219 * set a new ring from the data:
     
    454448#endif
    455449
    456   nKillChar(r);
     450  nKillChar(r->cf);
    457451  rUnComplete(r);
    458452  // delete order stuff
     
    825819          rChangeCurrRing(r1);
    826820          if ((!vartest || (strcmp(r1->parameter[0],r2->parameter[0])==0)) /* 1 par */
    827               && n_Equal(r1->minpoly,r2->minpoly, r1))
     821              && n_Equal(r1->minpoly,r2->minpoly, r1->cf))
    828822          {
    829823            tmpR.parameter=(char **)omAllocBin(char *);
    830824            tmpR.parameter[0]=omStrDup(r1->parameter[0]);
    831             tmpR.minpoly=n_Copy(r1->minpoly, r1);
     825            tmpR.minpoly=n_Copy(r1->minpoly, r1->cf);
    832826            tmpR.P=1;
    833827            // HANNES: TODO: delete nSetChar
     
    848842            tmpR.parameter[0]=omStrDup(r1->parameter[0]);
    849843            tmpR.P=1;
    850             tmpR.minpoly=n_Copy(r1->minpoly, r1);
     844            tmpR.minpoly=n_Copy(r1->minpoly, r1->cf);
    851845          }
    852846          else
     
    867861            tmpR.parameter[0]=omStrDup(r1->parameter[0]);
    868862            tmpR.P=1;
    869             tmpR.minpoly=n_Copy(r2->minpoly, r2);
     863            tmpR.minpoly=n_Copy(r2->minpoly, r2->cf);
    870864          }
    871865          else
     
    961955        if (r1->minpoly!=NULL)
    962956        {
    963           tmpR.minpoly=n_Copy(r1->minpoly, r1);
     957          tmpR.minpoly=n_Copy(r1->minpoly, r1->cf);
    964958        }
    965959      }
     
    989983        if (r2->minpoly!=NULL)
    990984        {
    991           tmpR.minpoly=n_Copy(r2->minpoly, r2);
     985          tmpR.minpoly=n_Copy(r2->minpoly, r2->cf);
    992986        }
    993987      }
     
    10221016        if (r1->minpoly!=NULL)
    10231017        {
    1024           tmpR.minpoly=n_Copy(r1->minpoly, r1);
     1018          tmpR.minpoly=n_Copy(r1->minpoly, r1->cf);
    10251019        }
    10261020      }
     
    10491043        if (r2->minpoly!=NULL)
    10501044        {
    1051           tmpR.minpoly=n_Copy(r2->minpoly, r2);
     1045          tmpR.minpoly=n_Copy(r2->minpoly, r2->cf);
    10521046        }
    10531047      }
     
    43524346// had already this property
    43534347//
    4354 // Without argument, these functions work on currRing and change it,
    4355 // if necessary
    4356 
    4357 // for the time being, this is still here
    4358 static ring rAssure_SyzComp(const ring r, BOOLEAN complete = TRUE);
    4359 
    4360 ring rCurrRingAssure_SyzComp()
    4361 {
    4362   ring r = rAssure_SyzComp(currRing, TRUE);
    4363 
    4364   if( r != currRing )
    4365   {
    4366     rChangeCurrRing(r);
    4367     assume(currRing == r);
    4368   }
    4369 
    4370   return r;
    4371 }
    4372 
    4373 static ring rAssure_SyzComp(const ring r, BOOLEAN complete)
     4348ring rAssure_SyzComp(const ring r, BOOLEAN complete)
    43744349{
    43754350  if ( (r->order[0] == ringorder_s) ) return r;
     
    45454520}
    45464521
    4547 ring rAssure_HasComp(ring r)
     4522ring rAssure_HasComp(const ring r)
    45484523{
    45494524  int last_block;
     
    46544629}
    46554630
    4656 ring rCurrRingAssure_CompLastBlock()
    4657 {
    4658   ring new_r = rAssure_CompLastBlock(currRing);
    4659   if (currRing != new_r)
    4660   {
    4661     ring old_r = currRing;
     4631// Moves _c or _C ordering to the last place AND adds _s on the 1st place
     4632ring rAssure_SyzComp_CompLastBlock(const ring r)
     4633{
     4634  ring new_r_1 = rAssure_CompLastBlock(r, FALSE); // due to this FALSE - no completion!
     4635  ring new_r = rAssure_SyzComp(new_r_1, FALSE); // new_r_1 is used only here!!!
     4636
     4637  if (new_r != r)
     4638  {
     4639    ring old_r = r;
     4640    if (new_r_1 != new_r && new_r_1 != old_r) rDelete(new_r_1);
     4641    rComplete(new_r, 1);
     4642#ifdef HAVE_PLURAL
     4643    if (rIsPluralRing(old_r))
     4644    {
     4645      if ( nc_rComplete(old_r, new_r, false) ) // no qideal!
     4646      {
     4647#ifndef NDEBUG
     4648        WarnS("error in nc_rComplete"); // cleanup?      rDelete(res);       return r;  // just go on...?
     4649#endif
     4650        }
     4651    }
     4652    assume(rIsPluralRing(new_r) == rIsPluralRing(old_r));
     4653#endif
    46624654    rChangeCurrRing(new_r);
    46634655    if (old_r->qideal != NULL)
    46644656    {
    4665       new_r->qideal = idrCopyR(old_r->qideal, old_r);
    4666       currQuotient = new_r->qideal;
     4657      new_r->qideal = idrCopyR(old_r->qideal, old_r, new_r);
     4658      //currQuotient = new_r->qideal;
     4659
    46674660#ifdef HAVE_PLURAL
    4668       if( rIsPluralRing(new_r) )
     4661      if( rIsPluralRing(old_r) )
    46694662        if( nc_SetupQuotient(new_r, old_r, true) )
    46704663        {
     
    46894682}
    46904683
    4691 // Moves _c or _C ordering to the last place AND adds _s on the 1st place
    4692 ring rCurrRingAssure_SyzComp_CompLastBlock()
    4693 {
    4694   ring new_r_1 = rAssure_CompLastBlock(currRing, FALSE); // due to this FALSE - no completion!
    4695   ring new_r = rAssure_SyzComp(new_r_1, FALSE); // new_r_1 is used only here!!!
    4696 
    4697   if (new_r != currRing)
    4698   {
    4699     ring old_r = currRing;
    4700     if (new_r_1 != new_r && new_r_1 != old_r) rDelete(new_r_1);
    4701     rComplete(new_r, 1);
    4702 #ifdef HAVE_PLURAL
    4703     if (rIsPluralRing(old_r))
    4704     {
    4705       if ( nc_rComplete(old_r, new_r, false) ) // no qideal!
    4706       {
    4707 #ifndef NDEBUG
    4708         WarnS("error in nc_rComplete"); // cleanup?      rDelete(res);       return r;  // just go on...?
    4709 #endif
    4710         }
    4711     }
    4712     assume(rIsPluralRing(new_r) == rIsPluralRing(old_r));
    4713 #endif
    4714     rChangeCurrRing(new_r);
    4715     if (old_r->qideal != NULL)
    4716     {
    4717       new_r->qideal = idrCopyR(old_r->qideal, old_r, new_r);
    4718       currQuotient = new_r->qideal;
    4719 
    4720 #ifdef HAVE_PLURAL
    4721       if( rIsPluralRing(old_r) )
    4722         if( nc_SetupQuotient(new_r, old_r, true) )
    4723         {
    4724 #ifndef NDEBUG
    4725           WarnS("error in nc_SetupQuotient"); // cleanup?      rDelete(res);       return r;  // just go on...?
    4726 #endif
    4727         }
    4728 #endif
    4729     }
    4730 
    4731 #ifdef HAVE_PLURAL
    4732     assume((new_r->qideal==NULL) == (old_r->qideal==NULL));
    4733     assume(rIsPluralRing(new_r) == rIsPluralRing(old_r));
    4734     assume(rIsSCA(new_r) == rIsSCA(old_r));
    4735     assume(ncRingType(new_r) == ncRingType(old_r));
    4736 #endif
    4737 
    4738     rTest(new_r);
    4739     rTest(old_r);
    4740   }
    4741   return new_r;
    4742 }
    4743 
    47444684// use this for global orderings consisting of two blocks
    4745 static ring rCurrRingAssure_Global(rRingOrder_t b1, rRingOrder_t b2)
    4746 {
    4747   int r_blocks = rBlocks(currRing);
     4685static ring rAssure_Global(rRingOrder_t b1, rRingOrder_t b2, const ring r)
     4686{
     4687  int r_blocks = rBlocks(r);
    47484688
    47494689  assume(b1 == ringorder_c || b1 == ringorder_C ||
     
    47514691         b2 == ringorder_S);
    47524692  if ((r_blocks == 3) &&
    4753       (currRing->order[0] == b1) &&
    4754       (currRing->order[1] == b2) &&
    4755       (currRing->order[2] == 0))
    4756     return currRing;
    4757   ring res = rCopy0(currRing, TRUE, FALSE);
     4693      (r->order[0] == b1) &&
     4694      (r->order[1] == b2) &&
     4695      (r->order[2] == 0))
     4696    return r;
     4697  ring res = rCopy0(r, TRUE, FALSE);
    47584698  res->order = (int*)omAlloc0(3*sizeof(int));
    47594699  res->block0 = (int*)omAlloc0(3*sizeof(int));
     
    47654705  {
    47664706    res->block0[1] = 1;
    4767     res->block1[1] = currRing->N;
     4707    res->block1[1] = r->N;
    47684708  }
    47694709  else
    47704710  {
    47714711    res->block0[0] = 1;
    4772     res->block1[0] = currRing->N;
     4712    res->block1[0] = r->N;
    47734713  }
    47744714  // HANNES: This sould be set in rComplete
     
    47764716  rComplete(res, 1);
    47774717#ifdef HAVE_PLURAL
    4778   if (rIsPluralRing(currRing))
    4779   {
    4780     if ( nc_rComplete(currRing, res, false) ) // no qideal!
     4718  if (rIsPluralRing(r))
     4719  {
     4720    if ( nc_rComplete(r, res, false) ) // no qideal!
    47814721    {
    47824722#ifndef NDEBUG
     
    49014841}
    49024842
    4903 ring rCurrRingAssure_dp_S()
    4904 {
    4905   return rCurrRingAssure_Global(ringorder_dp, ringorder_S);
    4906 }
    4907 
    4908 ring rCurrRingAssure_dp_C()
    4909 {
    4910   return rCurrRingAssure_Global(ringorder_dp, ringorder_C);
    4911 }
    4912 
    4913 ring rCurrRingAssure_C_dp()
    4914 {
    4915   return rCurrRingAssure_Global(ringorder_C, ringorder_dp);
     4843ring rAssure_dp_S(const ring r)
     4844{
     4845  return rAssure_Global(ringorder_dp, ringorder_S,r);
     4846}
     4847
     4848ring rAssure_dp_C(const ring r)
     4849{
     4850  return rAssure_Global(ringorder_dp, ringorder_C,r);
     4851}
     4852
     4853ring rAssure_C_dp(const ring r)
     4854{
     4855  return rAssure_Global(ringorder_C, ringorder_dp,r);
    49164856}
    49174857
     
    56125552    for (int j = i + 1; j <= N; j++)
    56135553    {
    5614       const number n = n_Copy(p_GetCoeff(MATELEM(C0,i,j), srcBase), srcBase); // src, mapping for coeffs into currRing = dest!
     5554      const number n = n_Copy(p_GetCoeff(MATELEM(C0,i,j), srcBase), srcBase->cf); // src, mapping for coeffs into currRing = dest!
    56155555      const poly   p = p_NSet(n, dest);
    56165556      MATELEM(C,i,j) = p;
  • libpolys/polys/monomials/ring.h

    rdd012ca r7eb7b5  
    565565
    566566// Ring Manipulations
    567 ring   rAssure_HasComp(ring r);
    568 ring   rCurrRingAssure_SyzComp();
     567ring   rAssure_HasComp(const ring r);
     568ring   rAssure_SyzComp(const ring r, BOOLEAN complete = TRUE);
    569569void   rSetSyzComp(int k, const ring r);
    570 ring   rCurrRingAssure_dp_S();
    571 ring   rCurrRingAssure_dp_C();
    572 ring   rCurrRingAssure_C_dp();
    573 
     570ring   rAssure_dp_S(const ring r);
     571ring   rAssure_dp_C(const ring r);
     572ring   rAssure_C_dp(const ring r);
    574573/// makes sure that c/C ordering is last ordering
    575 ring   rCurrRingAssure_CompLastBlock();
     574ring rAssure_CompLastBlock(const ring r);
    576575
    577576/// makes sure that c/C ordering is last ordering and SyzIndex is first
    578 ring   rCurrRingAssure_SyzComp_CompLastBlock();
     577ring   rAssure_SyzComp_CompLastBlock(const ring r);
    579578ring rAssure_TDeg(ring r, int start_var, int end_var, int &pos);
    580579
Note: See TracChangeset for help on using the changeset viewer.