Changeset 5f524e in git


Ignore:
Timestamp:
Nov 20, 2000, 5:02:03 PM (23 years ago)
Author:
Viktor Levandovskyy <levandov@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
c36beecfa29ca61b3d39473a32c3e6f3a0a985d1
Parents:
f2e841257a03cef8970190e17e935122992cc572
Message:
*** empty log message ***


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

Legend:

Unmodified
Added
Removed
  • Singular/gring.cc

    rf2e8412 r5f524e  
    33****************************************/
    44/***************************************************************
    5  *  File:    pp_Mult_mm__Template.cc
    6  *  Purpose: template for p_Mult_n
    7  *  Author:  obachman (Olaf Bachmann) / levandov (Viktor Levandovsky)
     5 *  File:    gring.cc
     6 *  Purpose: pMult family of procedures
     7 *  Author:  levandov (Viktor Levandovsky)
    88 *  Created: 8/00 - 11/00
    9  *  Version: $Id: gring.cc,v 1.1 2000-11-13 14:50:23 levandov Exp $
     9 *  Version: $Id: gring.cc,v 1.2 2000-11-20 16:02:03 levandov Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
    1212#include "gring.h"
     13#include "polys.h"
    1314#ifdef HAVE_PLURAL
    14 /***************************************************************
    15  *
    16  *   Returns:  p*m
    17  *   Const:    p, m
    18  *   If spNoether != NULL, then monoms which are smaller
    19  *   then spNoether are cut
    20  *
    21  ***************************************************************/
     15
     16//global nc_macros :
     17#define freeT(A) omFree((ADDRESS)A,(pVariables+1)*sizeof(Exponent_t))
     18#define freeN(A,k) omFree((ADDRESS)A,k*sizeof(number))
    2219
    2320poly nc_pp_Mult_mm(poly p, const poly m, const poly spNoether, const ring ri)
     
    5249}
    5350
    54 poly nc_mm_Mult_mm(Exponent_t *F, Exponent_t *G, const ring ri)
     51poly nc_mm_Mult_nn(Exponent_t *F, Exponent_t *G, const ring ri)
    5552
    5653/* destroys both f and g , f,g are monomials with the coefficient */
     
    8178    out=pOne();
    8279    for (i=1;i<=nv;i++) { F[i]=F[i]+G[i];}
    83     F[0]=exp;
     80//    F[0]=exp;
    8481    pSetExpV(out,F);
    8582    pSetCoeff(out,cOut);
     
    226223
    227224//----------pMultUU---------
    228 poly pMultUU (int i, int a, int j, int b)
     225poly nc_uu_Mult_ww (int i, int a, int j, int b,const ring r)
    229226{
    230227  int nv=pVariables;
     
    234231  {
    235232      out=pOne();
    236       pSetExp(out,j,b);
    237       pSetExp(out,i,a);
    238       if (i==j) pSetExp(out,j,a+b);
    239       pSetm(out);
     233      p_SetExp(out,j,b,r);
     234      p_SetExp(out,i,a,r);
     235      if (i==j) p_SetExp(out,j,a+b,r);
     236      p_Setm(out,r);
    240237      return(out);
    241238   }
     
    252249         {
    253250            out=pOne();
    254             pSetExp(out,j,b);pSetm(out);
     251            p_SetExp(out,j,b,r);p_Setm(out,r);
    255252            return(out);
    256253          }
     
    261258         {
    262259            out=pOne();
    263             pSetExp(out,i,a);pSetm(out);
     260            p_SetExp(out,i,a,r);p_Setm(out,r);
    264261            return(out);
    265262         }
     
    270267
    271268  int vik = UPMATELEM(j,i);
    272   if ((ri->nc->type==nc_skew)||(ri->nc->MF[vik]==0)) // ???
    273   {
    274     out=pOne();
    275     pSetExp(out,j,b); pSetExp(out,i,a);
    276     pSetm(out);
    277     number tmp_number=NULL;
    278     nPower(c,a*b,&tmp_number);
    279     pSetCoeff(out,tmp_number);
    280     return (out);
    281   }
    282   matrix cMT=currRing->MT[vik];
    283   int cMTsize=currRing->MTsize[vik];
     269// FOR future nc_skew case 
     270//  if ((ri->nc->type==nc_skew)||(ri->nc->MF[vik]==0))
     271//   {
     272//     out=pOne();
     273//     pSetExp(out,j,b); pSetExp(out,i,a);
     274//     pSetm(out);
     275//     number tmp_number=NULL;
     276//     nPower(c,a*b,&tmp_number);
     277//     pSetCoeff(out,tmp_number);
     278//     return (out);
     279//   }
     280  matrix cMT=r->MT[vik];
     281  int cMTsize=r->MTsize[vik];
    284282
    285283  if (((a<cMTsize)&&(b<cMTsize))&&(MATELEM(cMT,a,b)!=NULL))
    286284  {
    287      out=pCopy(MATELEM(cMT,a,b));
     285     out=p_Copy(MATELEM(cMT,a,b),r);
    288286     return (out);
    289287  }
    290288
    291 //End(Zero_Exceptions = (0,0),(0,b),(a,0) )
     289//End(Zero_Exceptions = (0,0),(0,b),(a,0),(a==b) )
    292290//in fact, now a>=1 and b>=1; and j<i
    293291
    294   poly C=MATELEM(currRing->C,j,i);
    295   number c=pGetCoeff(C); //coeff
    296   poly D=MATELEM(currRing->D,j,i);       //rest
    297 
    298   int newcMTsize;
     292  poly C=MATELEM(r->C,j,i);
     293  number c=p_GetCoeff(C,r); //coeff
     294  poly D=MATELEM(r->D,j,i);       //rest
     295
     296  int newcMTsize=0;
    299297
    300298  if (D==NULL)                   /* (skew)-commutativity check */
    301299  {
    302300     out=pOne();
    303      pSetExp(out,j,b); pSetExp(out,i,a);
    304      pSetm(out);
     301     p_SetExp(out,j,b,r); p_SetExp(out,i,a,r);
     302     p_Setm(out,r);
    305303     number tmp_number=NULL;
    306304     nPower(c,a*b,&tmp_number);
    307      pSetCoeff(out,tmp_number);
     305     p_SetCoeff(out,tmp_number,r);
    308306     return(out);
    309307  }
     
    311309  if ((a==1)&&(b==1))
    312310  {
    313      out= pCopy(MATELEM(cMT,1,1));  /* already computed */
     311     out= p_Copy(MATELEM(cMT,1,1),r);  /* already computed */
    314312     return(out);
    315313  }
     
    325323        for (int q=p;q<=nv;q++)
    326324        {
    327            MATELEM(tmp,p,q) = MATELEM(currRing->MT[UPMATELEM(j,i)],p,q);
    328            MATELEM(currRing->MT[UPMATELEM(j,i)],p,q)=NULL;
     325           MATELEM(tmp,p,q) = MATELEM(r->MT[UPMATELEM(j,i)],p,q);
     326           MATELEM(r->MT[UPMATELEM(j,i)],p,q)=NULL;
    329327        }
    330328     }
    331      idDelete((ideal *)&(currRing->MT[UPMATELEM(j,i)]));
    332      currRing->MT[UPMATELEM(j,i)] = tmp;
    333      currRing->MTsize[UPMATELEM(j,i)] = newcMTsize;
    334   }  /* update of multiplication matrix is finished */
    335 
    336   cMT=currRing->MT[UPMATELEM(j,i)];         //cMT=current MT
    337 
    338   poly x=pOne();pSetExp(x,j,1);pSetm(x);//var(j);
    339   poly y=pOne();pSetExp(y,i,1);pSetm(y);//var(i);  for convenience
     329     id_Delete((ideal *)&(r->MT[UPMATELEM(j,i)]),r);
     330     r->MT[UPMATELEM(j,i)] = tmp;
     331     r->MTsize[UPMATELEM(j,i)] = newcMTsize;
     332  }  /* The update of multiplication matrix is finished */
     333
     334  cMT=r->MT[UPMATELEM(j,i)];         //cMT=current MT
     335
     336  poly x=pOne();p_SetExp(x,j,1,r);p_Setm(x,r);//var(j);
     337  poly y=pOne();p_SetExp(y,i,1,r);pSetm(y,r);//var(i);  for convenience
    340338
    341339  int k,m;
     
    349347     if (t==NULL)   /* not computed yet */
    350348     {
    351         t=pCopy(MATELEM(cMT,k-1,1));
    352         t = pMultT2(y,t);
     349        t=p_Copy(MATELEM(cMT,k-1,1),r);
     350//        t = pMultT2(y,t);
     351        t = nc_m_Mult_pp(y,t,,r);
    353352        MATELEM(cMT,k,1) = t;
    354353     }
     
    363362     if (t==NULL)   //not computed yet
    364363     {
    365         t=pCopy(MATELEM(cMT,a,m-1));
    366         t = pMultT(t,x);
     364        t=p_Copy(MATELEM(cMT,a,m-1),r);
     365//        t = pMultT(t,x);
     366        t = nc_p_Mult_q(t,x,,r);
    367367        MATELEM(cMT,a,m) = t;
    368368     }
    369369     t=NULL;
    370370  }
    371   pDelete(&x); pDelete(&y);
     371  p_Delete(&x,r); p_Delete(&y,r);
    372372  t=MATELEM(cMT,a,b);
    373   return(pCopy(t));  /* as last computed element was cMT[a,b] */
     373  return(p_Copy(t,r));  /* as last computed element was cMT[a,b] */
    374374}
    375375#endif
  • Singular/gring.h

    rf2e8412 r5f524e  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: gring.h,v 1.1 2000-11-13 14:50:23 levandov Exp $ */
     6/* $Id: gring.h,v 1.2 2000-11-20 16:02:03 levandov Exp $ */
    77/*
    88* ABSTRACT additional defines etc for --with-plural
     
    1010
    1111#ifdef HAVE_PLURAL
     12#include "polys.h" // do we need it really?
     13#include "p_Procs.h"
     14
    1215#define UPMATELEM(i,j) ( ((pVariables) * ((i)-1) - ((i) * ((i)-1))/2 + (j)-1)-(i) )
    13 
     16// poly functions defined in p_Procs :
    1417poly nc_pp_Mult_mm(poly p, poly m, poly spNoether, const ring r);
    1518poly nc_p_Mult_mm(poly p, poly m, const ring r);
    1619poly nc_p_Minus_mm_Mult_qq(poly p, poly m, poly q,
    1720                           int &shorter, poly spNoether, const ring r);
     21// other routines we need in addition :
     22poly nc_m_Mult_pp(poly m, poly p, poly spNoether, const ring r);
     23poly nc_m_Mult_n(poly m, poly n, const ring r);
     24poly nc_mm_Mult_uu(poly p, poly m, const ring r);
     25poly nc_uu_Mult_ww(poly p, poly m, const ring r);
     26
     27// #define nc_pp_Mult_mm(p, m, spNoether) nc_pp_Mult_mm(p, poly m, poly spNoether, const ring r)
    1828
    1929#endif
Note: See TracChangeset for help on using the changeset viewer.