Changeset ad25ace in git


Ignore:
Timestamp:
Apr 13, 2000, 3:01:49 PM (23 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '0604212ebb110535022efecad887940825b97c3f')
Children:
8e153e5516cee595e5037ab243fc9a0d54dad39e
Parents:
4fc736efe01670e3ed92d3911fa633d760f79b7c
Message:
*hannes: bug 19 (vector/poly)


git-svn-id: file:///usr/local/Singular/svn/trunk@4266 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r4fc736e rad25ace  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: iparith.cc,v 1.208 2000-04-11 15:40:22 Singular Exp $ */
     4/* $Id: iparith.cc,v 1.209 2000-04-13 13:01:49 Singular Exp $ */
    55
    66/*
     
    117117extern BOOLEAN expected_parms;
    118118
     119#define ii_div_by_0 "div. by 0"
    119120int iiOp; /* the current operation*/
    120121
     
    10181019  if (b==0)
    10191020  {
    1020     WerrorS("div. by 0");
     1021    WerrorS(ii_div_by_0);
    10211022    return TRUE;
    10221023  }
     
    10441045  if (nIsZero(q))
    10451046  {
    1046     WerrorS("div. by 0");
     1047    WerrorS(ii_div_by_0);
    10471048    return TRUE;
    10481049  }
     
    10571058  if (q==NULL)
    10581059  {
    1059     WerrorS("div. by 0");
     1060    WerrorS(ii_div_by_0);
    10601061    return TRUE;
    10611062  }
     
    10631064  {
    10641065#ifdef HAVE_FACTORY
    1065     res->data=(void*)(singclap_pdivide((poly)(u->Data()),
    1066                                        (poly)(v->Data())));
     1066    poly p=(poly)(u->Data());
     1067    if(pGetComp(p)==0)
     1068    {
     1069      res->data=(void*)(singclap_pdivide(p /*(poly)(u->Data())*/ ,
     1070                                         q /*(poly)(v->Data())*/ ));
     1071    }
     1072    else
     1073    {
     1074      int comps=pMaxComp(p);
     1075      ideal I=idInit(comps,1);
     1076      p=(poly)(u->CopyD());
     1077      poly h;
     1078      int i;
     1079      // conversio to a list of polys:
     1080      while (p!=NULL)
     1081      {
     1082        i=pGetComp(p)-1;
     1083        h=pNext(p);
     1084        pNext(p)=NULL;
     1085        pSetComp(p,0);
     1086        I->m[i]=pAdd(I->m[i],p);
     1087        p=h;
     1088      }
     1089      // division and conversion to vector:
     1090      h=NULL;
     1091      p=NULL;
     1092      for(i=comps-1;i>=0;i--)
     1093      {
     1094        if (I->m[i]!=NULL)
     1095        {
     1096          h=singclap_pdivide(I->m[i],q);
     1097          pSetCompP(h,i+1);
     1098          p=pAdd(p,h);
     1099        }
     1100      }
     1101      idDelete(&I);
     1102      res->data=(void *)p;
     1103    }
    10671104#else
    10681105    WerrorS("division only by a monomial");
Note: See TracChangeset for help on using the changeset viewer.