Changeset 3b58e9 in git


Ignore:
Timestamp:
Dec 7, 2000, 1:22:42 PM (23 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
7b34aedfeac63b17a621ba2a14291c7dc1930641
Parents:
fb4232247333afc978e691cd03863a559e8e8f29
Message:
*hannes:p_IsConstant


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

Legend:

Unmodified
Added
Removed
  • Singular/polys.h

    rfb4232 r3b58e9  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys.h,v 1.48 2000-11-30 16:46:08 Singular Exp $ */
     6/* $Id: polys.h,v 1.49 2000-12-07 12:22:42 Singular Exp $ */
    77/*
    88* ABSTRACT - all basic methods to manipulate polynomials of the
     
    235235
    236236/*-------------predicate on polys ----------------------*/
    237 BOOLEAN   pIsConstant(const poly p);
     237BOOLEAN   p_IsConstant(const poly p, const ring r);
     238#define   pIsConstant(p)    p_IsConstant(p,currRing)
    238239BOOLEAN   pIsConstantPoly(poly p);
    239240#define   pIsPurePower(p)   p_IsPurePower(p, currRing)
    240 #define   pIsVector(p)     (pGetComp(p)!=0)
     241#define   pIsVector(p)      (pGetComp(p)>0)
    241242BOOLEAN   pHasNotCF(poly p1, poly p2);   /*has no common factor ?*/
    242243void      pSplit(poly p, poly * r);   /*p => IN(p), r => REST(p) */
  • Singular/polys1.cc

    rfb4232 r3b58e9  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys1.cc,v 1.55 2000-11-23 17:44:07 Singular Exp $ */
     4/* $Id: polys1.cc,v 1.56 2000-12-07 12:22:42 Singular Exp $ */
    55
    66/*
     
    3232*test if the monomial is a constant
    3333*/
    34 BOOLEAN   pIsConstant(const poly p)
     34BOOLEAN   p_IsConstant(const poly p, const ring r)
    3535{
    3636  if (p!=NULL)
    3737  {
    3838    int i;
    39     for (i=pVariables;i;i--)
    40     {
    41       if (pGetExp(p,i)!=0) return FALSE;
    42     }
    43     if (pGetComp(p)) return FALSE;
     39    for (i=r->N;i;i--)
     40    {
     41      if (p_GetExp(p,i,r)!=0) return FALSE;
     42    }
     43    if (p_GetComp(p,r)>0) return FALSE;
    4444  }
    4545  return TRUE;
     
    873873          {
    874874            lnumber c=(lnumber)pGetCoeff(qq);
    875             c->z->e[-perm[i]-1]+=e/*p_GetExp( p,i,oldRing)*/;
     875            napAddExp(c->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/);
    876876            mapped_to_par=1;
    877877          }
     
    951951}
    952952
     953#if 0
     954/*2
     955*returns a re-ordered copy of a polynomial, with permutation of the variables
     956*/
     957poly p_PermPoly (poly p, int * perm, ring oldRing,
     958   int *par_perm, int OldPar, ring newRing)
     959{
     960  int OldpVariables = oldRing->N;
     961  poly result = NULL;
     962  poly result_last = NULL;
     963  poly aq=NULL; /* the map coefficient */
     964  poly qq; /* the mapped monomial */
     965
     966  while (p != NULL)
     967  {
     968    if (OldPar==0)
     969    {
     970      qq = pInit();
     971      number n=newRing->cf->nMap(pGetCoeff(p));
     972      if ((newRing->minpoly!=NULL)
     973      && ((rField_is_Zp_a(newRing)) || (rField_is_Q_a(newRing))))
     974      {
     975        newRing->cf->nNormalize(n);
     976      }
     977      pGetCoeff(qq)=n;
     978    // coef may be zero:  pTest(qq);
     979    }
     980    else
     981    {
     982      qq=p_ISet(1, newRing);
     983      aq=naPermNumber(pGetCoeff(p),par_perm,OldPar);
     984      if ((newRing->minpoly!=NULL)
     985      && ((rField_is_Zp_a(newRing)) || (rField_is_Q_a(newRing))))
     986      {
     987        poly tmp=aq;
     988        while (tmp!=NULL)
     989        {
     990          number n=pGetCoeff(tmp);
     991          newRing->cf->nNormalize(n);
     992          pGetCoeff(tmp)=n;
     993          pIter(tmp);
     994        }
     995      }
     996      //pTest(aq);
     997    }
     998    p_SetComp(qq, p_GetComp(p,oldRing), newRing);
     999    if (newRing->cf->nIsZero(pGetCoeff(qq)))
     1000    {
     1001      p_DeleteLm(&qq, newRing);
     1002    }
     1003    else
     1004    {
     1005      int i;
     1006      int mapped_to_par=0;
     1007      for(i=1; i<=OldpVariables; i++)
     1008      {
     1009        int e=p_GetExp(p,i,oldRing);
     1010        if (e!=0)
     1011        {
     1012          if (perm==NULL)
     1013          {
     1014            p_SetExp(qq,i, e, newRing);
     1015          }
     1016          else if (perm[i]>0)
     1017            p_AddExp(qq,perm[i], e/*p_GetExp( p,i,oldRing)*/, newRing);
     1018          else if (perm[i]<0)
     1019          {
     1020            lnumber c=(lnumber)pGetCoeff(qq);
     1021            napAddExp(c->z,-perm[i],e/*p_GetExp( p,i,oldRing)*/);
     1022            mapped_to_par=1;
     1023          }
     1024          else
     1025          {
     1026            /* this variable maps to 0 !*/
     1027            p_DeleteLm(&qq, newRing);
     1028            break;
     1029          }
     1030        }
     1031      }
     1032      if (mapped_to_par
     1033      && (newRing->minpoly!=NULL))
     1034      {
     1035        number n=pGetCoeff(qq);
     1036        newRing->cf->nNormalize(n);
     1037        pGetCoeff(qq)=n;
     1038      }
     1039    }
     1040    pIter(p);
     1041    if (qq!=NULL)
     1042    {
     1043      p_Setm(qq, newRing);
     1044      //pTest(aq);
     1045      //pTest(qq);
     1046      if (aq!=NULL) qq=pMult(aq,qq);
     1047      aq = qq;
     1048      while (pNext(aq) != NULL) pIter(aq);
     1049      if (result_last==NULL)
     1050      {
     1051        result=qq;
     1052      }
     1053      else
     1054      {
     1055        pNext(result_last)=qq;
     1056      }
     1057      result_last=aq;
     1058      aq = NULL;
     1059    }
     1060    else if (aq!=NULL)
     1061    {
     1062      p_Delete(&aq, newRing);
     1063    }
     1064  }
     1065  result=pOrdPolyMerge(result);
     1066  //pTest(result);
     1067  return result;
     1068}
     1069#endif
     1070
    9531071poly pJet(poly p, int m)
    9541072{
Note: See TracChangeset for help on using the changeset viewer.