Changeset f34215 in git for polys/polys.cc


Ignore:
Timestamp:
Nov 8, 2010, 4:57:06 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
fb4075bf0613cccede0552d05c1b4ee37a7f6530
Parents:
a04c5ec2b888d58e53a0701c12400ddca144d53e
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2010-11-08 16:57:06+01:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:55:35+01:00
Message:
moved some ring-indep. stuff to p_polys
File:
1 edited

Legend:

Unmodified
Added
Removed
  • polys/polys.cc

    ra04c5e rf34215  
    5252{
    5353  if (ppNoether!=NULL) pDelete(&ppNoether);
    54   //pVariables = r->N;
    5554  //pOrdSgn = r->OrdSgn;
    5655  //pFDeg=r->pFDeg;
     
    223222}
    224223
    225 /*2
    226 * convert monomial given as string to poly, e.g. 1x3y5z
    227 */
    228 const char * p_Read(const char *st, poly &rc, const ring r)
    229 {
    230   if (r==NULL) { rc=NULL;return st;}
    231   int i,j;
    232   rc = p_Init(r);
    233   const char *s = r->cf->nRead(st,&(rc->coef));
    234   if (s==st)
    235   /* i.e. it does not start with a coeff: test if it is a ringvar*/
    236   {
    237     j = r_IsRingVar(s,r);
    238     if (j >= 0)
    239     {
    240       p_IncrExp(rc,1+j,r);
    241       while (*s!='\0') s++;
    242       goto done;
    243     }
    244   }
    245   while (*s!='\0')
    246   {
    247     char ss[2];
    248     ss[0] = *s++;
    249     ss[1] = '\0';
    250     j = r_IsRingVar(ss,r);
    251     if (j >= 0)
    252     {
    253       const char *s_save=s;
    254       s = eati(s,&i);
    255       if (((unsigned long)i) >  r->bitmask)
    256       {
    257         // exponent to large: it is not a monomial
    258         p_LmDelete(&rc,r);
    259         return s_save;
    260       }
    261       p_AddExp(rc,1+j, (long)i, r);
    262     }
    263     else
    264     {
    265       // 1st char of is not a varname
    266       p_LmDelete(&rc,r);
    267       s--;
    268       return s;
    269     }
    270   }
    271 done:
    272   if (r->cf->nIsZero(pGetCoeff(rc))) p_LmDelete(&rc,r);
    273   else
    274   {
    275 #ifdef HAVE_PLURAL
    276     // in super-commutative ring
    277     // squares of anti-commutative variables are zeroes!
    278     if(rIsSCA(r))
    279     {
    280       const unsigned int iFirstAltVar = scaFirstAltVar(r);
    281       const unsigned int iLastAltVar  = scaLastAltVar(r);
    282 
    283       assume(rc != NULL);
    284 
    285       for(unsigned int k = iFirstAltVar; k <= iLastAltVar; k++)
    286         if( p_GetExp(rc, k, r) > 1 )
    287         {
    288           p_LmDelete(&rc, r);
    289           goto finish;
    290         }
    291     }
    292 #endif
    293     p_Setm(rc,r);
    294   }
    295 finish:
    296   return s;
    297 }
    298 
    299224BOOLEAN _p_Test(poly p, ring r, int level);
    300 poly pmInit(const char *st, BOOLEAN &ok)
    301 {
    302   poly p;
    303   const char *s=p_Read(st,p,currRing);
    304   if (*s!='\0')
    305   {
    306     if ((s!=st)&&isdigit(st[0]))
    307     {
    308       errorreported=TRUE;
    309     }
    310     ok=FALSE;
    311     pDelete(&p);
    312     return NULL;
    313   }
    314   #ifdef PDEBUG
    315   _p_Test(p,currRing,PDEBUG);
    316   #endif
    317   ok=!errorreported;
    318   return p;
    319 }
    320225
    321226/*2
     
    560465}
    561466/*----------end of utilities for syzygies--------------*/
    562 
    563 /*2
    564 * pair has no common factor ? or is no polynomial
    565 */
    566 BOOLEAN pHasNotCF(poly p1, poly p2)
    567 {
    568 
    569   if (pGetComp(p1) > 0 || pGetComp(p2) > 0)
    570     return FALSE;
    571   int i = pVariables;
    572   loop
    573   {
    574     if ((pGetExp(p1, i) > 0) && (pGetExp(p2, i) > 0))   return FALSE;
    575     i--;
    576     if (i == 0)                                         return TRUE;
    577   }
    578 }
    579467
    580468/*2
Note: See TracChangeset for help on using the changeset viewer.