Changeset 2a97b3 in git for Singular


Ignore:
Timestamp:
Feb 26, 2003, 4:40:51 PM (21 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b4f17ed1d25f93d46dbe29e4b499baecc2fd51bb')
Children:
d6f4d943dc9e5df16732b62b38b67a0be4f90de3
Parents:
d9ddf538a2046f81d0acb90982bf1ff0e91e71f1
Message:
multiplication looks better


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

Legend:

Unmodified
Added
Removed
  • Singular/gring.cc

    rd9ddf53 r2a97b3  
    77 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: gring.cc,v 1.23 2003-01-30 21:41:01 levandov Exp $
     9 *  Version: $Id: gring.cc,v 1.24 2003-02-26 15:40:51 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    9090  {
    9191    v=p_Head(p,r);
     92#ifdef PDEBUG
    9293    p_Test(v,r);
    9394    p_Test(p,r);
     95#endif
    9496
    9597    expP=p_GetComp(v,r);
     
    128130  int len=pLength(out);
    129131  sBucketDestroyAdd(bu_out, &out, &len);
     132#ifdef PDEBUG
    130133  p_Test(out,r);
     134#endif
    131135  return(out);
    132136}
     
    163167  {
    164168    v=p_Head(p,r);
     169#ifdef PDEBUG
    165170    p_Test(v,r);
    166171    p_Test(p,r);
    167 
     172#endif
    168173    expP=p_GetComp(v,r);
    169174    if (expP==0)
     
    200205  int len=pLength(out);
    201206  sBucketDestroyAdd(bu_out, &out, &len );
     207#ifdef PDEBUG
    202208  p_Test(out,r);
     209#endif
    203210  return(out);
    204211}
     
    328335       p_SetExpV(Pn,On,r);
    329336       p_Setm(Pn,r);
     337#ifdef PDEBUG
    330338       p_Test(Pn,r);
     339#endif
    331340
    332341//       if (pNext(D)==0)
     
    366375  p_SetExpV(Rout,U,r);
    367376  p_Setm(Rout,r);  /* use again this name Rout */
     377#ifdef PDEBUG
    368378  p_Test(Rout,r);
     379#endif
    369380  p_SetCoeff(Rout,c[cnt-1],r);
    370381  out=p_Add_q(out,Rout,r);
     
    377388    p_SetExpV(Rout,Prv,r);
    378389    p_Setm(Rout,r);
     390#ifdef PDEBUG
    379391    p_Test(Rout,r);
     392#endif
    380393    out=nc_mm_Mult_p(Rout,out,r); /* getting the final result */
    381394    freeT(Prv,r->N);
     
    456469       p_SetExpV(Rout,Prv,r);
    457470       p_Setm(Rout,r);
     471#ifdef PDEBUG
    458472       p_Test(Rout,r);
     473#endif
    459474       freeT(Prv,r->N);
    460475       out=nc_mm_Mult_p(Rout,out,r); /* getting the final result */
     
    530545         Rout=nc_p_Mult_mm(D,Pn,r);
    531546       }
     547#ifdef PDEBUG
    532548       p_Test(Pp,r);
     549#endif
    533550       p_Delete(&Pn,r);
    534551     }
     
    537554       Rout=nc_mm_Mult_p(Pp,D,r);
    538555     }
    539 
     556#ifdef PDEBUG
    540557     p_Test(Pp,r);
     558#endif
    541559     p_Delete(&Pp,r);
    542560     num=n_Mult(c[cnt+1],c[cnt],r);
     
    582600poly nc_uu_Mult_ww_vert (int i, int a, int j, int b, const ring r)
    583601{
    584   poly out=pOne();
    585   number tmp_number=NULL;
    586 
    587   /* Now check zero exeptions, commutativity and should we do something at all?  */
    588   if (i==j)
    589   {
    590     p_SetExp(out,j,a+b,r);
    591   }
    592   else
    593   {
    594     p_SetExp(out,j,b,r);
    595     p_SetExp(out,i,a,r);
    596   }
    597   p_Setm(out,r);
    598   if ((a==0)||(b==0)||(i<=j)) return(out);/* zero exeptions and usual case */
    599 
    600   if (MATELEM(r->nc->COM,j,i)!=NULL)
    601     /* commutative or quasicommutative case */
    602   {
    603     if (r->cf->nIsOne(p_GetCoeff(MATELEM(r->nc->COM,j,i),r))) /* commutative case */
    604     {
    605       return(out);
    606     }
    607     else
    608     {
    609       tmp_number=p_GetCoeff(MATELEM(r->nc->COM,j,i),r); /* quasicommutative case */
    610       nPower(tmp_number,a*b,&tmp_number);
    611       p_SetCoeff(out,tmp_number,r);
    612       return(out);
    613     }
    614   }/* end_of commutative or quasicommutative case */
    615 
    616   /* we are here if  i>j and variables do not commute or quasicommute */
    617   /* in fact, now a>=1 and b>=1; and j<i */
    618   /* now check wether the polynom is alredy computed */
    619   int vik = UPMATELEM(j,i,r->N);
    620   matrix cMT=r->nc->MT[vik];
    621   int cMTsize=r->nc->MTsize[vik];
    622   p_Delete(&out,r);
    623 
    624   if (((a<cMTsize)&&(b<cMTsize))&&(MATELEM(cMT,a,b)!=NULL))
    625   {
    626     out = nc_p_CopyGet(MATELEM(cMT,a,b),r);
    627     //   out=p_Copy(MATELEM(cMT,a,b),r);
    628     return (out);
    629   }
    630 
    631   int newcMTsize=0;
    632   int k,l,m;
    633 
    634   if (a>=b) {newcMTsize=a;} else {newcMTsize=b;}
    635   if (newcMTsize>cMTsize)
    636   {
    637      newcMTsize = newcMTsize+cMTsize;
    638      matrix tmp = mpNew(newcMTsize,newcMTsize);
    639      l=UPMATELEM(j,i,r->N);
    640      for (k=1;k<=cMTsize;k++)
    641      {
    642         for (m=1;m<=cMTsize;m++)
    643         {
    644           MATELEM(tmp,k,m) = nc_p_CopyPut(MATELEM(r->nc->MT[l],k,m),r);
    645           //      MATELEM(tmp,k,m) = MATELEM(r->nc->MT[l],k,m);
    646           //           omCheckAddr(tmp->m);
    647           //      MATELEM(r->nc->MT[l],k,m)=NULL;
    648           p_Delete(&MATELEM(r->nc->MT[l],k,m),r);
    649           //           omCheckAddr(r->nc->MT[UPMATELEM(j,i,r->N)]->m);
    650         }
    651      }
    652      id_Delete((ideal *)&(r->nc->MT[l]),r->nc->basering);
    653      r->nc->MT[l] = tmp;
    654      r->nc->MTsize[l] = newcMTsize;
    655   }  /* The update of multiplication matrix is finished */
    656 
    657   cMT=r->nc->MT[UPMATELEM(j,i,r->N)];         /* cMT=current MT */
    658 
    659   poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r);p_Test(x,r);/* var(j); */
    660   poly y=pOne();p_SetExp(y,i,1,r);p_Setm(y,r);p_Test(y,r);/*var(i);  for convenience */
    661 
     602  int k,m;
     603  matrix cMT=r->nc->MT[UPMATELEM(j,i,r->N)];         /* cMT=current MT */
     604
     605  poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r);
     606/* var(j); */
     607  poly y=pOne();p_SetExp(y,i,1,r);p_Setm(y,r);
     608/*var(i);  for convenience */
     609#ifdef PDEBUG
     610  p_Test(x,r);
     611  p_Test(y,r);
     612#endif
    662613  poly t=NULL;
    663614/* ------------ Main Cycles ----------------------------*/
     
    704655}
    705656
    706 poly nc_uu_Mult_ww_horvert (int i, int a, int j, int b, const ring r)
     657poly nc_uu_Mult_ww (int i, int a, int j, int b, const ring r)
    707658  /* (x_i)^a times (x_j)^b */
    708659  /* x_i = y,  x_j = x ! */
    709660{
    710   /* Check zero exeptions, (q-)commutativity and should we do something at all? */
     661  /* Check zero exceptions, (q-)commutativity and is there something to do? */
    711662  assume(a!=0);
    712663  assume(b!=0);
     
    798749    tmp=NULL;
    799750    r->nc->MTsize[UPMATELEM(j,i,r->N)] = newcMTsize;
    800   }  /* The update of multiplication matrix is finished */
    801 
     751  } 
     752  /* The update of multiplication matrix is finished */
     753    pDelete(&out);
     754    out = nc_uu_Mult_ww_vert(i, a, j, b, r);
     755    //    out = nc_uu_Mult_ww_horvert(i, a, j, b, r);
     756    return(out);
     757}
     758
     759poly nc_uu_Mult_ww_horvert (int i, int a, int j, int b, const ring r)
     760
     761{
     762  int k,m;
    802763  matrix cMT=r->nc->MT[UPMATELEM(j,i,r->N)];         /* cMT=current MT */
    803764
    804   poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r);p_Test(x,r); /* var(j); */
    805   poly y=pOne();p_SetExp(y,i,1,r);p_Setm(y,r);p_Test(y,r); /*var(i);  for convenience */
     765  poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r);/* var(j); */
     766  poly y=pOne();p_SetExp(y,i,1,r);p_Setm(y,r); /*var(i);  for convenience */
     767#ifdef PDEBUG
     768  p_Test(x,r);
     769  p_Test(y,r);
     770#endif
    806771
    807772  poly t=NULL;
     
    978943  p_Delete(&y,r);
    979944  t=p_Copy(MATELEM(cMT,a,b),r);
    980   return(t);  /* as the last computed element was cMT[a,b] */
     945  return(t);  /* since the last computed element was cMT[a,b] */
    981946}
    982947
     
    1000965  p_ExpVectorDiff(m,p2,p1,r);
    1001966  p_Setm(m,r);
     967#ifdef PDEBUG
    1002968  p_Test(m,r);
     969#endif
    1003970  /* pSetComp(m,r)=0? */
    1004971  poly N=nc_mm_Mult_p(m,p_Head(p1,r),r);
     
    10531020  pLcm(p1,p2,pL);
    10541021  p_Setm(pL,r);
     1022#ifdef PDEBUG
    10551023  p_Test(pL,r);
     1024#endif
    10561025  p_ExpVectorDiff(m1,pL,p1,r);
    10571026  p_SetComp(m1,0,r);
    10581027  p_Setm(m1,r);
     1028#ifdef PDEBUG
    10591029  p_Test(m1,r);
     1030#endif
    10601031  p_ExpVectorDiff(m2,pL,p2,r);
    10611032  p_SetComp(m2,0,r);
    10621033  p_Setm(m2,r);
     1034#ifdef PDEBUG
    10631035  p_Test(m2,r);
     1036#endif
    10641037  p_Delete(&pL,r);
    10651038  /* zero exponents ! */
     
    10961069  //  n_Delete(&C2,r);
    10971070  n_Delete(&MinusOne,r);
     1071#ifdef PDEBUG
    10981072  p_Test(M2,r);
     1073#endif
    10991074  return(M2);
    11001075}
     
    11141089  p_SetComp(m,0,r);
    11151090  p_Setm(m,r);
     1091#ifdef PDEBUG
    11161092  p_Test(m,r);
     1093#endif
    11171094  /* pSetComp(m,r)=0? */
    11181095  poly M=nc_mm_Mult_p(m,p_Copy(p1,r),r);
     
    11501127  pLcm(p1,p2,m);
    11511128  p_Setm(m,r);
     1129#ifdef PDEBUG
    11521130  p_Test(m,r);
     1131#endif
    11531132  return(m);
    11541133}
     
    11621141  pExpVectorDiff(m,kBucketGetLm(b),p);
    11631142  pSetm(m);
     1143#ifdef PDEBUG
    11641144  pTest(m);
     1145#endif
    11651146  poly pp=nc_mm_Mult_p(m,pCopy(p),currRing);
    11661147  pDelete(&m);
     
    11921173  pExpVectorDiff(m,pHead(b),p);
    11931174  pSetm(m);
     1175#ifdef PDEBUG
    11941176  pTest(m);
     1177#endif
    11951178  poly pp=nc_mm_Mult_p(m,pCopy(p),currRing);
    11961179  pDelete(&m);
     
    12911274              pSetCoeff(bres,nTmp); /* only lc ! */
    12921275            }
     1276#ifdef PDEBUG
    12931277            pTest(bres);
     1278#endif
    12941279            if (i>j)  bres=p_Mult_nn(bres, MinusOne,currRing);
    12951280          }
     
    14841469
    14851470void ncKill(ring r)
     1471  /* kills the nc extension of ring r */
    14861472{
    14871473  int i,j;
  • Singular/gring.h

    rd9ddf53 r2a97b3  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: gring.h,v 1.17 2003-01-29 19:13:36 levandov Exp $ */
     6/* $Id: gring.h,v 1.18 2003-02-26 15:40:51 levandov Exp $ */
    77/*
    88* ABSTRACT additional defines etc for --with-plural
     
    2424poly nc_mm_Mult_uu (Exponent_t *F,int jG,int bG, const ring r);
    2525
    26 #define nc_uu_Mult_ww nc_uu_Mult_ww_vert
    27 poly nc_uu_Mult_ww_vert (int i, int a, int j, int b, const ring r);
    28 poly nc_uu_Mult_ww_horvert (int i, int a, int j, int b, const ring r);
    29 poly nc_uu_Mult_ww_hvdiag (int i, int a, int j, int b, const ring r);
    30 
     26/* #define nc_uu_Mult_ww nc_uu_Mult_ww_vert */
     27poly nc_uu_Mult_ww (int i, int a, int j, int b, const ring r);
     28/* poly nc_uu_Mult_ww_vert (int i, int a, int j, int b, const ring r); */
     29/* poly nc_uu_Mult_ww_horvert (int i, int a, int j, int b, const ring r); */
     30/* poly nc_uu_Mult_ww_hvdiag (int i, int a, int j, int b, const ring r); */
     31/* not written yet */
    3132
    3233poly _nc_p_Mult_q(poly p, poly q, const int copy, const ring r);
Note: See TracChangeset for help on using the changeset viewer.